Skip to content

Commit 27fee39

Browse files
authored
fix: make typehinting for Extension.bot work (#1748)
1 parent caae85b commit 27fee39

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

interactions/models/internal/extension.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def some_command(self, context):
4747
4848
"""
4949

50-
bot: "Client"
50+
_bot: "Client"
5151
name: str
5252
extension_name: str
5353
description: str
@@ -77,8 +77,6 @@ class Metadata:
7777
def __new__(cls, bot: "Client", *args, **kwargs) -> "Extension":
7878
instance = super().__new__(cls)
7979
instance.bot = bot
80-
instance.client = bot
81-
8280
instance.name = cls.__name__
8381

8482
if instance.name in bot.ext:
@@ -140,6 +138,22 @@ def __new__(cls, bot: "Client", *args, **kwargs) -> "Extension":
140138
def __name__(self) -> str:
141139
return self.name
142140

141+
@property
142+
def bot(self) -> "Client":
143+
return self._bot
144+
145+
@bot.setter
146+
def bot(self, value: "Client") -> None:
147+
self._bot = value
148+
149+
@property
150+
def client(self) -> "Client":
151+
return self._bot
152+
153+
@client.setter
154+
def client(self, value: "Client") -> None:
155+
self._bot = value
156+
143157
@property
144158
def commands(self) -> List["BaseCommand"]:
145159
"""Get the commands from this Extension."""

0 commit comments

Comments
 (0)