Browse Source

Add narrowed overloads for edit methods on channels

pull/7909/head
lightningyx 3 years ago
committed by GitHub
parent
commit
19fb8ac447
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 70
      discord/channel.py

70
discord/channel.py

@ -257,6 +257,14 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
"""
return self._state._get_message(self.last_message_id) if self.last_message_id else None
@overload
async def edit(self) -> Optional[TextChannel]:
...
@overload
async def edit(self, *, position: int, reason: Optional[str] = ...) -> None:
...
@overload
async def edit(
self,
@ -272,11 +280,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
default_auto_archive_duration: ThreadArchiveDuration = ...,
type: ChannelType = ...,
overwrites: Mapping[Union[Role, Member, Snowflake], PermissionOverwrite] = ...,
) -> Optional[TextChannel]:
...
@overload
async def edit(self) -> Optional[TextChannel]:
) -> TextChannel:
...
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[TextChannel]:
@ -1288,6 +1292,14 @@ class VoiceChannel(discord.abc.Messageable, VocalGuildChannel):
async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> VoiceChannel:
return await self._clone_impl({'bitrate': self.bitrate, 'user_limit': self.user_limit}, name=name, reason=reason)
@overload
async def edit(self) -> None:
...
@overload
async def edit(self, *, position: int, reason: Optional[str] = ...) -> None:
...
@overload
async def edit(
self,
@ -1303,11 +1315,7 @@ class VoiceChannel(discord.abc.Messageable, VocalGuildChannel):
rtc_region: Optional[str] = ...,
video_quality_mode: VideoQualityMode = ...,
reason: Optional[str] = ...,
) -> Optional[VoiceChannel]:
...
@overload
async def edit(self) -> Optional[VoiceChannel]:
) -> VoiceChannel:
...
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[VoiceChannel]:
@ -1582,6 +1590,14 @@ class StageChannel(VocalGuildChannel):
data = await self._state.http.get_stage_instance(self.id)
return StageInstance(guild=self.guild, state=self._state, data=data)
@overload
async def edit(self) -> None:
...
@overload
async def edit(self, *, position: int, reason: Optional[str] = ...) -> None:
...
@overload
async def edit(
self,
@ -1595,11 +1611,7 @@ class StageChannel(VocalGuildChannel):
rtc_region: Optional[str] = ...,
video_quality_mode: VideoQualityMode = ...,
reason: Optional[str] = ...,
) -> Optional[StageChannel]:
...
@overload
async def edit(self) -> Optional[StageChannel]:
) -> StageChannel:
...
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[StageChannel]:
@ -1749,6 +1761,14 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> CategoryChannel:
return await self._clone_impl({'nsfw': self.nsfw}, name=name, reason=reason)
@overload
async def edit(self) -> None:
...
@overload
async def edit(self, *, position: int, reason: Optional[str] = ...) -> None:
...
@overload
async def edit(
self,
@ -1758,11 +1778,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
nsfw: bool = ...,
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
reason: Optional[str] = ...,
) -> Optional[CategoryChannel]:
...
@overload
async def edit(self) -> Optional[CategoryChannel]:
) -> CategoryChannel:
...
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[CategoryChannel]:
@ -2032,6 +2048,14 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
{'topic': self.topic, 'nsfw': self.nsfw, 'rate_limit_per_user': self.slowmode_delay}, name=name, reason=reason
)
@overload
async def edit(self) -> None:
...
@overload
async def edit(self, *, position: int, reason: Optional[str] = ...) -> None:
...
@overload
async def edit(
self,
@ -2047,11 +2071,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
default_auto_archive_duration: ThreadArchiveDuration = ...,
type: ChannelType = ...,
overwrites: Mapping[Union[Role, Member, Snowflake], PermissionOverwrite] = ...,
) -> Optional[ForumChannel]:
...
@overload
async def edit(self) -> Optional[ForumChannel]:
) -> ForumChannel:
...
async def edit(self, *, reason: Optional[str] = None, **options: Any) -> Optional[ForumChannel]:

Loading…
Cancel
Save