Skip to content

Commit

Permalink
fix: make typehinting for Extension.bot work
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS committed Jan 2, 2025
1 parent 5b07e41 commit 94435be
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions interactions/models/internal/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def some_command(self, context):
"""

bot: "Client"
_bot: "Client"
name: str
extension_name: str
description: str
Expand Down Expand Up @@ -77,8 +77,6 @@ class Metadata:
def __new__(cls, bot: "Client", *args, **kwargs) -> "Extension":
instance = super().__new__(cls)
instance.bot = bot
instance.client = bot

instance.name = cls.__name__

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

@property
def bot(self) -> "Client":
return self._bot

@bot.setter
def bot(self, value: "Client") -> None:
self._bot = value

@property
def client(self) -> "Client":
return self._bot

@client.setter
def client(self, value: "Client") -> None:
self._bot = value

@property
def commands(self) -> List["BaseCommand"]:
"""Get the commands from this Extension."""
Expand Down

0 comments on commit 94435be

Please sign in to comment.