@@ -306,7 +306,7 @@ def _update(self, guild: Guild, data: TextChannelPayload) -> None:
306306 )
307307 self ._fill_overwrites (data )
308308
309- async def _get_channel (self ):
309+ async def _get_channel (self ) -> Self :
310310 return self
311311
312312 @property
@@ -1227,7 +1227,7 @@ def members(self) -> List[Member]:
12271227 if isinstance (self .guild , Object ):
12281228 return []
12291229
1230- ret = []
1230+ ret : List [ Member ] = []
12311231 for user_id , state in self .guild ._voice_states .items ():
12321232 if state .channel and state .channel .id == self .id :
12331233 member = self .guild .get_member (user_id )
@@ -1392,7 +1392,7 @@ def _update(self, guild: Guild, data: VoiceChannelPayload) -> None:
13921392 self .slowmode_delay : int = data .get ("rate_limit_per_user" , 0 )
13931393 self .last_message_id : Optional [int ] = utils ._get_as_snowflake (data , "last_message_id" )
13941394
1395- async def _get_channel (self ) :
1395+ async def _get_channel (self : Self ) -> Self :
13961396 return self
13971397
13981398 @property
@@ -2079,7 +2079,7 @@ def _update(self, guild: Guild, data: StageChannelPayload) -> None:
20792079 self .slowmode_delay : int = data .get ("rate_limit_per_user" , 0 )
20802080 self .last_message_id : Optional [int ] = utils ._get_as_snowflake (data , "last_message_id" )
20812081
2082- async def _get_channel (self ):
2082+ async def _get_channel (self ) -> Self :
20832083 return self
20842084
20852085 @property
@@ -3108,7 +3108,7 @@ def channels(self) -> List[GuildChannelType]:
31083108 if isinstance (self .guild , Object ):
31093109 return []
31103110
3111- def comparator (channel ) :
3111+ def comparator (channel : GuildChannelType ) -> Tuple [ bool , int ] :
31123112 return (
31133113 not isinstance (channel , (TextChannel , ThreadOnlyGuildChannel )),
31143114 channel .position ,
@@ -4789,7 +4789,7 @@ def __init__(self, *, me: ClientUser, state: ConnectionState, data: DMChannelPay
47894789 )
47904790 self ._flags : int = data .get ("flags" , 0 )
47914791
4792- async def _get_channel (self ):
4792+ async def _get_channel (self ) -> Self :
47934793 return self
47944794
47954795 def __str__ (self ) -> str :
@@ -4962,7 +4962,7 @@ def _update_group(self, data: GroupChannelPayload) -> None:
49624962 else :
49634963 self .owner = utils .find (lambda u : u .id == self .owner_id , self .recipients )
49644964
4965- async def _get_channel (self ):
4965+ async def _get_channel (self ) -> Self :
49664966 return self
49674967
49684968 def __str__ (self ) -> str :
@@ -5133,7 +5133,9 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
51335133 return PartialMessage (channel = self , id = message_id )
51345134
51355135
5136- def _guild_channel_factory (channel_type : int ):
5136+ def _guild_channel_factory (
5137+ channel_type : int ,
5138+ ) -> Tuple [Optional [Type [GuildChannelType ]], ChannelType ]:
51375139 value = try_enum (ChannelType , channel_type )
51385140 if value is ChannelType .text :
51395141 return TextChannel , value
@@ -5153,7 +5155,11 @@ def _guild_channel_factory(channel_type: int):
51535155 return None , value
51545156
51555157
5156- def _channel_factory (channel_type : int ):
5158+ def _channel_factory (
5159+ channel_type : int ,
5160+ ) -> Tuple [
5161+ Optional [Union [Type [GuildChannelType ], Type [DMChannel ], Type [GroupChannel ]]], ChannelType
5162+ ]:
51575163 cls , value = _guild_channel_factory (channel_type )
51585164 if value is ChannelType .private :
51595165 return DMChannel , value
@@ -5163,14 +5169,21 @@ def _channel_factory(channel_type: int):
51635169 return cls , value
51645170
51655171
5166- def _threaded_channel_factory (channel_type : int ):
5172+ def _threaded_channel_factory (
5173+ channel_type : int ,
5174+ ) -> Tuple [
5175+ Optional [Union [Type [GuildChannelType ], Type [DMChannel ], Type [GroupChannel ], Type [Thread ]]],
5176+ ChannelType ,
5177+ ]:
51675178 cls , value = _channel_factory (channel_type )
51685179 if value in (ChannelType .private_thread , ChannelType .public_thread , ChannelType .news_thread ):
51695180 return Thread , value
51705181 return cls , value
51715182
51725183
5173- def _threaded_guild_channel_factory (channel_type : int ):
5184+ def _threaded_guild_channel_factory (
5185+ channel_type : int ,
5186+ ) -> Tuple [Optional [Union [Type [GuildChannelType ], Type [Thread ]]], ChannelType ]:
51745187 cls , value = _guild_channel_factory (channel_type )
51755188 if value in (ChannelType .private_thread , ChannelType .public_thread , ChannelType .news_thread ):
51765189 return Thread , value
0 commit comments