@@ -172,7 +172,10 @@ def permissions_for(self, member):
172172 @property
173173 def members (self ):
174174 """List[:class:`Member`]: Returns all members that can see this channel."""
175- return [m for m in self .guild .members if self .permissions_for (m ).read_messages ]
175+ return [
176+ m for m in self .guild .members
177+ if self .permissions_for (m ).read_messages
178+ ]
176179
177180 def is_nsfw (self ):
178181 """:class:`bool`: Checks if the channel is NSFW."""
@@ -201,11 +204,8 @@ def last_message(self):
201204 Optional[:class:`Message`]
202205 The last message in this channel or ``None`` if not found.
203206 """
204- return (
205- self ._state ._get_message (self .last_message_id )
206- if self .last_message_id
207- else None
208- )
207+ return (self ._state ._get_message (self .last_message_id )
208+ if self .last_message_id else None )
209209
210210 async def edit (self , * , reason = None , ** options ):
211211 """|coro|
@@ -321,22 +321,21 @@ async def delete_messages(self, messages):
321321 return
322322
323323 if len (messages ) > 100 :
324- raise ClientException ("Can only bulk delete messages up to 100 messages" )
324+ raise ClientException (
325+ "Can only bulk delete messages up to 100 messages" )
325326
326327 message_ids = [m .id for m in messages ]
327328 await self ._state .http .delete_messages (self .id , message_ids )
328329
329- async def purge (
330- self ,
331- * ,
332- limit = 100 ,
333- check = None ,
334- before = None ,
335- after = None ,
336- around = None ,
337- oldest_first = False ,
338- bulk = True
339- ):
330+ async def purge (self ,
331+ * ,
332+ limit = 100 ,
333+ check = None ,
334+ before = None ,
335+ after = None ,
336+ around = None ,
337+ oldest_first = False ,
338+ bulk = True ):
340339 """|coro|
341340
342341 Purges a list of messages that meet the criteria given by the predicate
@@ -413,14 +412,10 @@ def check(m):
413412 ret = []
414413 count = 0
415414
416- minimum_time = (
417- int ((time .time () - 14 * 24 * 60 * 60 ) * 1000.0 - 1420070400000 ) << 22
418- )
419- strategy = (
420- self .delete_messages
421- if self ._state .is_bot and bulk
422- else _single_delete_strategy
423- )
415+ minimum_time = (int ((time .time () - 14 * 24 * 60 * 60 ) * 1000.0 -
416+ 1420070400000 ) << 22 )
417+ strategy = (self .delete_messages if self ._state .is_bot and bulk else
418+ _single_delete_strategy )
424419
425420 while True :
426421 try :
@@ -520,9 +515,10 @@ async def create_webhook(self, *, name, avatar=None, reason=None):
520515 if avatar is not None :
521516 avatar = utils ._bytes_to_base64_data (avatar )
522517
523- data = await self ._state .http .create_webhook (
524- self .id , name = str (name ), avatar = avatar , reason = reason
525- )
518+ data = await self ._state .http .create_webhook (self .id ,
519+ name = str (name ),
520+ avatar = avatar ,
521+ reason = reason )
526522 return Webhook .from_state (data , state = self ._state )
527523
528524 async def follow (self , * , destination , reason = None ):
@@ -565,15 +561,16 @@ async def follow(self, *, destination, reason=None):
565561
566562 if not isinstance (destination , TextChannel ):
567563 raise InvalidArgument (
568- "Expected TextChannel received {0.__name__}" .format (type ( destination ))
569- )
564+ "Expected TextChannel received {0.__name__}" .format (
565+ type ( destination )) )
570566
571567 from .webhook import Webhook
572568
573569 data = await self ._state .http .follow_webhook (
574- self .id , webhook_channel_id = destination .id , reason = reason
575- )
576- return Webhook ._as_follower (data , channel = destination , user = self ._state .user )
570+ self .id , webhook_channel_id = destination .id , reason = reason )
571+ return Webhook ._as_follower (data ,
572+ channel = destination ,
573+ user = self ._state .user )
577574
578575 def get_partial_message (self , message_id ):
579576 """Creates a :class:`PartialMessage` from the message ID.
@@ -599,7 +596,8 @@ def get_partial_message(self, message_id):
599596 return PartialMessage (channel = self , id = message_id )
600597
601598
602- class VocalGuildChannel (discord .abc .Connectable , discord .abc .GuildChannel , Hashable ):
599+ class VocalGuildChannel (discord .abc .Connectable , discord .abc .GuildChannel ,
600+ Hashable ):
603601 __slots__ = (
604602 "name" ,
605603 "id" ,
@@ -756,7 +754,10 @@ def type(self):
756754 @utils .copy_doc (discord .abc .GuildChannel .clone )
757755 async def clone (self , * , name = None , reason = None ):
758756 return await self ._clone_impl (
759- {"bitrate" : self .bitrate , "user_limit" : self .user_limit },
757+ {
758+ "bitrate" : self .bitrate ,
759+ "user_limit" : self .user_limit
760+ },
760761 name = name ,
761762 reason = reason ,
762763 )
@@ -859,7 +860,7 @@ class StageChannel(VocalGuildChannel):
859860 A value of ``None`` indicates automatic voice region detection.
860861 """
861862
862- __slots__ = ("topic" ,)
863+ __slots__ = ("topic" , )
863864
864865 def __repr__ (self ):
865866 attrs = [
@@ -885,8 +886,7 @@ def _update(self, guild, data):
885886 def requesting_to_speak (self ):
886887 """List[:class:`Member`]: A list of members who are requesting to speak in the stage channel."""
887888 return [
888- member
889- for member in self .members
889+ member for member in self .members
890890 if member .voice .requested_to_speak_at is not None
891891 ]
892892
@@ -1003,8 +1003,7 @@ def __init__(self, *, state, guild, data):
10031003
10041004 def __repr__ (self ):
10051005 return "<CategoryChannel id={0.id} name={0.name!r} position={0.position} nsfw={0.nsfw}>" .format (
1006- self
1007- )
1006+ self )
10081007
10091008 def _update (self , guild , data ):
10101009 self .guild = guild
@@ -1029,7 +1028,9 @@ def is_nsfw(self):
10291028
10301029 @utils .copy_doc (discord .abc .GuildChannel .clone )
10311030 async def clone (self , * , name = None , reason = None ):
1032- return await self ._clone_impl ({"nsfw" : self .nsfw }, name = name , reason = reason )
1031+ return await self ._clone_impl ({"nsfw" : self .nsfw },
1032+ name = name ,
1033+ reason = reason )
10331034
10341035 async def edit (self , * , reason = None , ** options ):
10351036 """|coro|
@@ -1079,7 +1080,6 @@ def channels(self):
10791080
10801081 These are sorted by the official Discord UI, which places voice channels below the text channels.
10811082 """
1082-
10831083 def comparator (channel ):
10841084 return (not isinstance (channel , TextChannel ), channel .position )
10851085
@@ -1091,8 +1091,7 @@ def comparator(channel):
10911091 def text_channels (self ):
10921092 """List[:class:`TextChannel`]: Returns the text channels that are under this category."""
10931093 ret = [
1094- c
1095- for c in self .guild .channels
1094+ c for c in self .guild .channels
10961095 if c .category_id == self .id and isinstance (c , TextChannel )
10971096 ]
10981097 ret .sort (key = lambda c : (c .position , c .id ))
@@ -1102,8 +1101,7 @@ def text_channels(self):
11021101 def voice_channels (self ):
11031102 """List[:class:`VoiceChannel`]: Returns the voice channels that are under this category."""
11041103 ret = [
1105- c
1106- for c in self .guild .channels
1104+ c for c in self .guild .channels
11071105 if c .category_id == self .id and isinstance (c , VoiceChannel )
11081106 ]
11091107 ret .sort (key = lambda c : (c .position , c .id ))
@@ -1116,16 +1114,18 @@ def stage_channels(self):
11161114 .. versionadded:: 1.7
11171115 """
11181116 ret = [
1119- c
1120- for c in self .guild .channels
1117+ c for c in self .guild .channels
11211118 if c .category_id == self .id and isinstance (c , StageChannel )
11221119 ]
11231120 ret .sort (key = lambda c : (c .position , c .id ))
11241121 return ret
11251122
1126- async def create_text_channel (
1127- self , name , * , overwrites = None , reason = None , ** options
1128- ):
1123+ async def create_text_channel (self ,
1124+ name ,
1125+ * ,
1126+ overwrites = None ,
1127+ reason = None ,
1128+ ** options ):
11291129 """|coro|
11301130
11311131 A shortcut method to :meth:`Guild.create_text_channel` to create a :class:`TextChannel` in the category.
@@ -1135,13 +1135,18 @@ async def create_text_channel(
11351135 :class:`TextChannel`
11361136 The channel that was just created.
11371137 """
1138- return await self .guild .create_text_channel (
1139- name , overwrites = overwrites , category = self , reason = reason , ** options
1140- )
1141-
1142- async def create_voice_channel (
1143- self , name , * , overwrites = None , reason = None , ** options
1144- ):
1138+ return await self .guild .create_text_channel (name ,
1139+ overwrites = overwrites ,
1140+ category = self ,
1141+ reason = reason ,
1142+ ** options )
1143+
1144+ async def create_voice_channel (self ,
1145+ name ,
1146+ * ,
1147+ overwrites = None ,
1148+ reason = None ,
1149+ ** options ):
11451150 """|coro|
11461151
11471152 A shortcut method to :meth:`Guild.create_voice_channel` to create a :class:`VoiceChannel` in the category.
@@ -1151,13 +1156,18 @@ async def create_voice_channel(
11511156 :class:`VoiceChannel`
11521157 The channel that was just created.
11531158 """
1154- return await self .guild .create_voice_channel (
1155- name , overwrites = overwrites , category = self , reason = reason , ** options
1156- )
1157-
1158- async def create_stage_channel (
1159- self , name , * , overwrites = None , reason = None , ** options
1160- ):
1159+ return await self .guild .create_voice_channel (name ,
1160+ overwrites = overwrites ,
1161+ category = self ,
1162+ reason = reason ,
1163+ ** options )
1164+
1165+ async def create_stage_channel (self ,
1166+ name ,
1167+ * ,
1168+ overwrites = None ,
1169+ reason = None ,
1170+ ** options ):
11611171 """|coro|
11621172
11631173 A shortcut method to :meth:`Guild.create_stage_channel` to create a :class:`StageChannel` in the category.
@@ -1169,9 +1179,11 @@ async def create_stage_channel(
11691179 :class:`StageChannel`
11701180 The channel that was just created.
11711181 """
1172- return await self .guild .create_stage_channel (
1173- name , overwrites = overwrites , category = self , reason = reason , ** options
1174- )
1182+ return await self .guild .create_stage_channel (name ,
1183+ overwrites = overwrites ,
1184+ category = self ,
1185+ reason = reason ,
1186+ ** options )
11751187
11761188
11771189class StoreChannel (discord .abc .GuildChannel , Hashable ):
@@ -1228,8 +1240,7 @@ def __init__(self, *, state, guild, data):
12281240
12291241 def __repr__ (self ):
12301242 return "<StoreChannel id={0.id} name={0.name!r} position={0.position} nsfw={0.nsfw}>" .format (
1231- self
1232- )
1243+ self )
12331244
12341245 def _update (self , guild , data ):
12351246 self .guild = guild
@@ -1263,7 +1274,9 @@ def is_nsfw(self):
12631274
12641275 @utils .copy_doc (discord .abc .GuildChannel .clone )
12651276 async def clone (self , * , name = None , reason = None ):
1266- return await self ._clone_impl ({"nsfw" : self .nsfw }, name = name , reason = reason )
1277+ return await self ._clone_impl ({"nsfw" : self .nsfw },
1278+ name = name ,
1279+ reason = reason )
12671280
12681281 async def edit (self , * , reason = None , ** options ):
12691282 """|coro|
@@ -1487,7 +1500,8 @@ def _update_group(self, data):
14871500 if owner_id == self .me .id :
14881501 self .owner = self .me
14891502 else :
1490- self .owner = utils .find (lambda u : u .id == owner_id , self .recipients )
1503+ self .owner = utils .find (lambda u : u .id == owner_id ,
1504+ self .recipients )
14911505
14921506 async def _get_channel (self ):
14931507 return self
@@ -1543,7 +1557,11 @@ def icon_url_as(self, *, format="webp", size=1024):
15431557 :class:`Asset`
15441558 The resulting CDN asset.
15451559 """
1546- return Asset ._from_icon (self ._state , self , "channel" , format = format , size = size )
1560+ return Asset ._from_icon (self ._state ,
1561+ self ,
1562+ "channel" ,
1563+ format = format ,
1564+ size = size )
15471565
15481566 @property
15491567 def created_at (self ):
0 commit comments