messageable base

This commit is contained in:
grey-cat-1908 2022-03-30 22:19:38 +03:00
parent 0888054587
commit 5226073408

View file

@ -235,44 +235,9 @@ class Channel(APIModelBase):
return message return message
class TextChannel(Channel): class MessageableChannel(Channel):
"""A subclass of ``Channel`` representing text channels with all the same attributes.""" """A subclass of ``Channel`` with methods that are only available for channels,
where user can send messages."""
@overload
async def edit(
self,
*,
name: Optional[str] = None,
type: Optional[ChannelType] = None,
position: Optional[int] = None,
topic: Optional[str] = None,
nsfw: Optional[bool] = None,
rate_limit_per_user: Optional[int] = None,
bitrate: Optional[int] = None,
user_limit: Optional[int] = None,
permission_overwrite: Optional[List[Dict[str, Any]]] = None,
parent_id: Optional[Union[str, int, Snowflake]] = None,
rtc_region: Optional[str] = None,
video_quality_mode: Optional[int] = None,
default_auto_archive_duration: Optional[int] = None,
) -> TextChannel:
...
async def edit(self, **kwargs):
"""|coro|
Edit a text channel with the specified keyword arguments.
Parameters
----------
\\*\\*kwargs :
The keyword arguments to edit the channel with.
Returns
-------
:class:`~melisa.models.guild.channel.TextChannel`
The updated channel object.
"""
return await super().edit(**kwargs)
async def history( async def history(
self, self,
@ -500,6 +465,46 @@ class TextChannel(Channel):
return return
class TextChannel(MessageableChannel):
"""A subclass of ``Channel`` representing text channels with all the same attributes."""
@overload
async def edit(
self,
*,
name: Optional[str] = None,
type: Optional[ChannelType] = None,
position: Optional[int] = None,
topic: Optional[str] = None,
nsfw: Optional[bool] = None,
rate_limit_per_user: Optional[int] = None,
bitrate: Optional[int] = None,
user_limit: Optional[int] = None,
permission_overwrite: Optional[List[Dict[str, Any]]] = None,
parent_id: Optional[Union[str, int, Snowflake]] = None,
rtc_region: Optional[str] = None,
video_quality_mode: Optional[int] = None,
default_auto_archive_duration: Optional[int] = None,
) -> TextChannel:
...
async def edit(self, **kwargs):
"""|coro|
Edit a text channel with the specified keyword arguments.
Parameters
----------
\\*\\*kwargs :
The keyword arguments to edit the channel with.
Returns
-------
:class:`~melisa.models.guild.channel.TextChannel`
The updated channel object.
"""
return await super().edit(**kwargs)
# noinspection PyTypeChecker # noinspection PyTypeChecker
channel_types_for_converting: Dict[ChannelType, Channel] = { channel_types_for_converting: Dict[ChannelType, Channel] = {
ChannelType.GUILD_TEXT: TextChannel ChannelType.GUILD_TEXT: TextChannel