@@ -147,7 +147,7 @@ def __init__(self, *, data: VoiceChannelEffectPayload, state: ConnectionState) -
147147 else :
148148 sound_data : PartialSoundboardSoundPayload = {
149149 "sound_id" : sound_id ,
150- "volume" : data .get ("sound_volume" ), # type : ignore # assume this exists if sound_id is set
150+ "volume" : data .get ("sound_volume" ), # pyright : ignore[reportAssignmentType] # assume this exists if sound_id is set
151151 }
152152 self .sound = PartialSoundboardSound (data = sound_data , state = state )
153153
@@ -541,7 +541,7 @@ async def edit(
541541 )
542542 if payload is not None :
543543 # the payload will always be the proper channel payload
544- return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # type : ignore
544+ return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # pyright : ignore[reportArgumentType]
545545 return None
546546
547547 async def clone (
@@ -1089,26 +1089,22 @@ async def create_thread(
10891089 :class:`Thread`
10901090 The newly created thread
10911091 """
1092- if not ((message is None ) ^ (type is None )):
1093- msg = "Exactly one of message and type must be provided."
1094- raise ValueError (msg )
1095-
10961092 if auto_archive_duration is not None :
10971093 auto_archive_duration = cast (
10981094 "ThreadArchiveDurationLiteral" , try_enum_to_int (auto_archive_duration )
10991095 )
11001096
1101- if message is None :
1097+ if message is None and type is not None :
11021098 data = await self ._state .http .start_thread_without_message (
11031099 self .id ,
11041100 name = name ,
11051101 auto_archive_duration = auto_archive_duration or self .default_auto_archive_duration ,
1106- type = type .value , # type: ignore
1102+ type = type .value ,
11071103 invitable = invitable if invitable is not None else True ,
11081104 rate_limit_per_user = slowmode_delay ,
11091105 reason = reason ,
11101106 )
1111- else :
1107+ elif message is not None and type is None :
11121108 data = await self ._state .http .start_thread_with_message (
11131109 self .id ,
11141110 message .id ,
@@ -1117,6 +1113,9 @@ async def create_thread(
11171113 rate_limit_per_user = slowmode_delay ,
11181114 reason = reason ,
11191115 )
1116+ else :
1117+ msg = "Exactly one of message and type must be provided."
1118+ raise ValueError (msg )
11201119
11211120 return Thread (guild = self .guild , state = self ._state , data = data )
11221121
@@ -1705,7 +1704,7 @@ async def edit(
17051704 )
17061705 if payload is not None :
17071706 # the payload will always be the proper channel payload
1708- return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # type : ignore
1707+ return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # pyright : ignore[reportArgumentType]
17091708 return None
17101709
17111710 async def delete_messages (self , messages : Iterable [Snowflake ]) -> None :
@@ -2563,7 +2562,7 @@ async def edit(
25632562 )
25642563 if payload is not None :
25652564 # the payload will always be the proper channel payload
2566- return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # type : ignore
2565+ return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # pyright : ignore[reportArgumentType]
25672566 return None
25682567
25692568 async def delete_messages (self , messages : Iterable [Snowflake ]) -> None :
@@ -3056,7 +3055,7 @@ async def edit(
30563055 )
30573056 if payload is not None :
30583057 # the payload will always be the proper channel payload
3059- return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # type : ignore
3058+ return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # pyright : ignore[reportArgumentType]
30603059 return None
30613060
30623061 @overload
@@ -3472,7 +3471,7 @@ def last_thread(self) -> Optional[Thread]:
34723471 :class:`Thread` | :data:`None`
34733472 The last created thread in this channel or :data:`None` if not found.
34743473 """
3475- return self ._state .get_channel (self .last_thread_id ) if self .last_thread_id else None # type : ignore
3474+ return self ._state .get_channel (self .last_thread_id ) if self .last_thread_id else None # pyright : ignore[reportReturnType]
34763475
34773476 @property
34783477 def available_tags (self ) -> list [ForumTag ]:
@@ -4220,7 +4219,7 @@ async def edit(
42204219 )
42214220 if payload is not None :
42224221 # the payload will always be the proper channel payload
4223- return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # type : ignore
4222+ return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # pyright : ignore[reportArgumentType]
42244223 return None
42254224
42264225 async def clone (
@@ -4619,7 +4618,7 @@ async def edit(
46194618 )
46204619 if payload is not None :
46214620 # the payload will always be the proper channel payload
4622- return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # type : ignore
4621+ return self .__class__ (state = self ._state , guild = self .guild , data = payload ) # pyright : ignore[reportArgumentType]
46234622 return None
46244623
46254624 async def clone (
@@ -4794,7 +4793,7 @@ def __init__(self, *, me: ClientUser, state: ConnectionState, data: DMChannelPay
47944793 self ._state : ConnectionState = state
47954794 self .recipient : Optional [User ] = None
47964795 if recipients := data .get ("recipients" ):
4797- self .recipient = state .store_user (recipients [0 ]) # type : ignore
4796+ self .recipient = state .store_user (recipients [0 ]) # pyright : ignore[reportArgumentType]
47984797
47994798 self .me : ClientUser = me
48004799 self .id : int = int (data ["id" ])
0 commit comments