mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-01-17 19:45:12 +00:00
Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com> Co-authored-by: Josh <josh.ja.butt@gmail.com>
This commit is contained in:
@@ -198,7 +198,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
self.last_message_id: Optional[int] = utils._get_as_snowflake(data, 'last_message_id')
|
||||
self._fill_overwrites(data)
|
||||
|
||||
async def _get_channel(self):
|
||||
async def _get_channel(self) -> Self:
|
||||
return self
|
||||
|
||||
@property
|
||||
@@ -283,7 +283,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
async def edit(self) -> Optional[TextChannel]:
|
||||
...
|
||||
|
||||
async def edit(self, *, reason=None, **options):
|
||||
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[TextChannel]:
|
||||
"""|coro|
|
||||
|
||||
Edits the channel.
|
||||
@@ -908,7 +908,7 @@ class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hasha
|
||||
return self.guild.id, self.id
|
||||
|
||||
def _update(self, guild: Guild, data: Union[VoiceChannelPayload, StageChannelPayload]) -> None:
|
||||
self.guild = guild
|
||||
self.guild: Guild = guild
|
||||
self.name: str = data['name']
|
||||
self.rtc_region: Optional[str] = data.get('rtc_region')
|
||||
self.video_quality_mode: VideoQualityMode = try_enum(VideoQualityMode, data.get('video_quality_mode', 1))
|
||||
@@ -1076,7 +1076,7 @@ class VoiceChannel(VocalGuildChannel):
|
||||
async def edit(self) -> Optional[VoiceChannel]:
|
||||
...
|
||||
|
||||
async def edit(self, *, reason=None, **options):
|
||||
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[VoiceChannel]:
|
||||
"""|coro|
|
||||
|
||||
Edits the channel.
|
||||
@@ -1220,7 +1220,7 @@ class StageChannel(VocalGuildChannel):
|
||||
|
||||
def _update(self, guild: Guild, data: StageChannelPayload) -> None:
|
||||
super()._update(guild, data)
|
||||
self.topic = data.get('topic')
|
||||
self.topic: Optional[str] = data.get('topic')
|
||||
|
||||
@property
|
||||
def requesting_to_speak(self) -> List[Member]:
|
||||
@@ -1361,7 +1361,7 @@ class StageChannel(VocalGuildChannel):
|
||||
async def edit(self) -> Optional[StageChannel]:
|
||||
...
|
||||
|
||||
async def edit(self, *, reason=None, **options):
|
||||
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[StageChannel]:
|
||||
"""|coro|
|
||||
|
||||
Edits the channel.
|
||||
@@ -1522,7 +1522,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
|
||||
async def edit(self) -> Optional[CategoryChannel]:
|
||||
...
|
||||
|
||||
async def edit(self, *, reason=None, **options):
|
||||
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[CategoryChannel]:
|
||||
"""|coro|
|
||||
|
||||
Edits the channel.
|
||||
@@ -1578,7 +1578,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
|
||||
return self.__class__(state=self._state, guild=self.guild, data=payload) # type: ignore
|
||||
|
||||
@utils.copy_doc(discord.abc.GuildChannel.move)
|
||||
async def move(self, **kwargs):
|
||||
async def move(self, **kwargs: Any) -> None:
|
||||
kwargs.pop('category', None)
|
||||
await super().move(**kwargs)
|
||||
|
||||
@@ -1772,7 +1772,7 @@ class StoreChannel(discord.abc.GuildChannel, Hashable):
|
||||
async def edit(self) -> Optional[StoreChannel]:
|
||||
...
|
||||
|
||||
async def edit(self, *, reason=None, **options):
|
||||
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[StoreChannel]:
|
||||
"""|coro|
|
||||
|
||||
Edits the channel.
|
||||
@@ -1874,7 +1874,7 @@ class DMChannel(discord.abc.Messageable, Hashable):
|
||||
self.me: ClientUser = me
|
||||
self.id: int = int(data['id'])
|
||||
|
||||
async def _get_channel(self):
|
||||
async def _get_channel(self) -> Self:
|
||||
return self
|
||||
|
||||
def __str__(self) -> str:
|
||||
@@ -2026,7 +2026,7 @@ class GroupChannel(discord.abc.Messageable, Hashable):
|
||||
else:
|
||||
self.owner = utils.find(lambda u: u.id == self.owner_id, self.recipients)
|
||||
|
||||
async def _get_channel(self):
|
||||
async def _get_channel(self) -> Self:
|
||||
return self
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user