+
    rpÐj�Y  ã                  óÈ  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^RIHt ^RI	H
t
 ^RIHt ^RI5 ^RIHtHtHtHtHt ^RIHt ^ R	IHtHtHtHtHtHtHtHt ]'       d2   ^ R
IH t  ^RIH!t! ^RI"H#t# ^RI$H%t% ^RI&H't' ^RI	H(t(  ! R R](RR7      t)R t*]PV                  ! ],4      t- ! R R4      t. ! R R4      t/ ! R R4      t0 ! R R4      t1 ! R R4      t2 ! R R]
4      t3R# )!a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
)ÚannotationsN)ÚAutoShardedConnectionState)ÚClient)ÚExponentialBackoff)Ú*)ÚClientExceptionÚHTTPExceptionÚGatewayNotFoundÚConnectionClosedÚPrivilegedIntentsRequired)ÚStatus)ÚTYPE_CHECKINGÚAnyÚCallableÚTupleÚTypeÚOptionalÚListÚDict)ÚUnpack)ÚDiscordWebSocket)ÚBaseActivity)ÚIntents)ÚSessionStartLimit)Ú_ClientOptionsc                  ó,   € ] tR t^9t$ R]R&   R]R&   RtR# )Ú_AutoShardedClientOptionsz	List[int]Ú	shard_idszOptional[float]Úshard_connect_timeout© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__Ú__static_attributes__r   ó    Ú?/opt/hermes/.venv/lib/python3.14/site-packages/discord/shard.pyr   r   9   s   ‡ ØÓØ.×.r&   r   F)ÚtotalÚAutoShardedClientÚ	ShardInfoÚSessionStartLimitsc                  ó.   € ] tR t^Gt^ t^t^t^t^t^t	Rt
R# )Ú	EventTyper   N)r    r!   r"   r#   ÚcloseÚ	reconnectÚresumeÚidentifyÚ	terminateÚclean_closer%   r   r&   r'   r-   r-   G   s    † Ø€EØ€IØ€FØ€HØ€IØ„Kr&   r-   c                  óJ   € ] tR t^PtRtR R ltR R ltR R ltR R ltR	t	R
# )Ú	EventItemc               ó(   € V ^8„  d   QhRRRRRRRR/# )	é   ÚetypeÚintÚshardzOptional['Shard']ÚerrorzOptional[Exception]ÚreturnÚNoner   )Úformats   "r'   Ú__annotate__ÚEventItem.__annotate__S   s+   € ÷ 0ñ 0˜cð 0Ð*;ð 0ÐDWð 0Ð\`ñ 0r&   c                	ó*   € Wn         W n        W0n        R # ©N©Útyper:   r;   )Úselfr8   r:   r;   s   &&&&r'   Ú__init__ÚEventItem.__init__S   s   € ØŒ	Ø(-Œ
Ø*/Ž
r&   c               ó    € V ^8„  d   QhRRRR/# ©r7   ÚotherÚobjectr<   Úboolr   )r>   s   "r'   r?   r@   X   s   € ÷ &ñ &˜Fð & tñ &r&   c                	ól   € \        V\        4      '       g   \        # V P                  VP                  8  # rB   ©Ú
isinstancer5   ÚNotImplementedrD   ©rE   rJ   s   &&r'   Ú__lt__ÚEventItem.__lt__X   s(   € Ü˜%¤×+Ò+Ü!Ð!Ø�y‰y˜5Ÿ:™:Ñ%Ð%r&   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r>   s   "r'   r?   r@   ]   s   € ÷ 'ñ '˜Fð ' tñ 'r&   c                	ól   € \        V\        4      '       g   \        # V P                  VP                  8H  # rB   rN   rQ   s   &&r'   Ú__eq__ÚEventItem.__eq__]   s(   € Ü˜%¤×+Ò+Ü!Ð!Ø�y‰y˜EŸJ™JÑ&Ð&r&   c               ó   € V ^8„  d   QhRR/# ©r7   r<   r9   r   )r>   s   "r'   r?   r@   b   s   € ÷ ñ ˜#ñ r&   c                	ó,   € \        V P                  4      # rB   )ÚhashrD   ©rE   s   &r'   Ú__hash__ÚEventItem.__hash__b   s   € Ü�D—I‘I‹Ðr&   )r;   r:   rD   NrC   )
r    r!   r"   r#   Ú	__slots__rF   rR   rV   r]   r%   r   r&   r'   r5   r5   P   s    † Ø*€Iõ0õ
&õ
'÷
ñ r&   r5   c                  ó˜   € ] tR t^ftR R lt]R R l4       tR R ltR R ltR	 R
 lt	R R lt
R R ltR R ltR R ltR R ltRtR# )ÚShardc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r7   Úwsr   Úclientr)   Ú	queue_putzCallable[[EventItem], None]r<   r=   r   )r>   s   "r'   r?   ÚShard.__annotate__g   s,   € ÷ 
ñ 
Ð+ð 
Ð5Fð 
ÐSnð 
Ðswñ 
r&   c                	ó  € Wn         W n        VP                  V n        W0n        R V n        VP                  V n        \        4       V n        RV n	        \        \        \        \        \        P                  \         P"                  3V n        R# )FN)rc   Ú_clientÚdispatchÚ	_dispatchÚ
_queue_putÚ_disconnectÚ
_reconnectr   Ú_backoffÚ_taskÚOSErrorr   r	   r
   ÚaiohttpÚClientErrorÚasyncioÚTimeoutErrorÚ_handled_exceptions)rE   rc   rd   re   s   &&&&r'   rF   ÚShard.__init__g   sk   € Ø$&ŒØ%ŒØ.4¯o©oˆŒØ7@ŒØ!&ˆÔØ ×+Ñ+ˆŒÜ,>Ó,@ˆŒØ-1ˆŒ
äÜÜÜÜ×ÑÜ× Ñ ðA
ˆÖ r&   c               ó   € V ^8„  d   QhRR/# rY   r   )r>   s   "r'   r?   rf   z   s   € ÷  ñ  �Cñ  r&   c                	ó.   € V P                   P                  # rB   )rc   Úshard_idr\   s   &r'   ÚidÚShard.idy   s   € ð �w‰w×ÑÐr&   c               ó   € V ^8„  d   QhRR/# ©r7   r<   r=   r   )r>   s   "r'   r?   rf   ~   s   € ÷ Bñ B˜ñ Br&   c                	óv   € V P                   P                  P                  V P                  4       4      V n        R # rB   )rh   ÚloopÚcreate_taskÚworkerro   r\   s   &r'   ÚlaunchÚShard.launch~   s$   € Ø—\‘\×&Ñ&×2Ñ2°4·;±;³=ÓAˆŽ
r&   c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rf   �   s   € ÷  ñ  ˜dñ  r&   c                	óž   € V P                   e?   V P                   P                  4       '       g   V P                   P                  4        R # R # R # rB   )ro   ÚdoneÚcancelr\   s   &r'   Ú_cancel_taskÚShard._cancel_task�   s4   € Ø�:‰:Ò!¨$¯*©*¯/©/×*;Ò*;Ø�J‰J×ÑÖñ +<Ñ!r&   c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rf   …   s   € ÷ 'ñ '˜Tñ 'r&   c              ƒ  	óz   "  € V P                  4        V P                  P                  R R7      G Rj  x€L
  R#  L5i)éè  )ÚcodeN)rˆ   rc   r.   r\   s   &r'   r.   ÚShard.close…   s)   é € Ø×ÑÔØ�g‰g�m‰m ˆmÓ&×&Ô&ùs   ‚0;²9³;c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rf   ‰   s   € ÷ 4ñ 4 $ñ 4r&   c              ƒ  	óz   "  € V P                  4       G R j  x€L
  V P                  RV P                  4       R #  L"5i)NÚshard_disconnect)r.   rj   rz   r\   s   &r'   Ú
disconnectÚShard.disconnect‰   s,   é € Ø�j‰j‹l×ÐØ�‰Ð)¨4¯7©7Ö3ñ 	ùs   ‚;–9—#;c               ó    € V ^8„  d   QhRRRR/# )r7   ÚeÚ	Exceptionr<   r=   r   )r>   s   "r'   r?   rf   �   s   € ÷ Añ A¨)ð A¸ñ Ar&   c           	   ƒ  	óF  "  € V P                  R 4       V P                  RV P                  4       V P                  '       g,   V P                  \	        \
        P                  W4      4       R# V P                  P                  4       '       d   R# \        V\        4      '       dT   VP                  R	9   dC   \        V P                  RR7      pV P                  \	        \
        P                  W4      4       R# \        V\        4      '       d�   VP                  R8X  d@   V P                  \	        \
        P                   V \#        V P                  4      4      4       R# VP                  R8w  d,   V P                  \	        \
        P                  W4      4       R# V P$                  P'                  4       p\(        P+                  RV P                  W1R7       \,        P.                  ! V4      G Rj  x€L
  V P                  \	        \
        P0                  W4      4       R#  L/5i)
r’   r‘   NT)r0   é®  rŒ   z/Attempting a reconnect for shard ID %s in %.2fs)Úexc_info)é6   iF'  )rj   rz   rm   rk   r5   r-   r.   rh   Ú	is_closedrO   rp   ÚerrnoÚReconnectWebSocketr0   r
   r�   r2   r   rn   ÚdelayÚ_logr;   rs   Úsleepr/   )rE   r•   ÚexcÚretrys   &&  r'   Ú_handle_disconnectÚShard._handle_disconnect�   sc  é € Ø�‰�|Ô$Ø�‰Ð)¨4¯7©7Ô3Ø��ˆØ�O‰OœI¤i§o¡o°tÓ?Ô@Ùà�<‰<×!Ñ!×#Ò#Ùä�aœ×!Ò! a§g¡g°Ô&<ä$ T§W¡W°TÔ:ˆCØ�O‰OœI¤i×&6Ñ&6¸ÓBÔCÙä�aÔ)×*Ò*Ø�v‰v˜Œ~Ø—‘¤	¬)×*=Ñ*=¸tÔE^Ð_c×_fÑ_fÓEgÓ hÔiÙØ�v‰v˜Œ~Ø—‘¤	¬)¯/©/¸4Ó CÔDÙà—‘×#Ñ#Ó%ˆÜ�
‰
ÐDÀdÇgÁgÈuˆ
ÔaÜ�mŠm˜EÓ"×"Ð"Ø�‰œ	¤)×"5Ñ"5°tÓ?Ö@ñ 	#ùs   ‚B
H!ÂE"H!Ç/HÇ00H!c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rf   ª   s   € ÷ ñ ˜dñ r&   c              ƒ  	óx  "  € V P                   P                  4       '       g&    V P                  P                  4       G R j  x€L
  KE  R #  L  \         dY   pTP
                  '       d   \        P
                  M\        P                  pT P                  \        Y T4      4        R p?R # R p?iT P                   d&   pT P                  T4      G R j  x€L 
   R p?R # R p?i\        P                   d     R # \         d5   pT P                  \        \        P                  Y4      4        R p?R # R p?ii ; i5irB   )rh   r›   rc   Ú
poll_eventr�   r0   r-   r1   rk   r5   ru   r£   rs   ÚCancelledErrorr–   r2   )rE   r•   r8   s   &  r'   r�   ÚShard.workerª   s×   é € Ø—,‘,×(Ñ(×*Ò*ðØ—g‘g×(Ñ(Ó*×*Ò*ñ +á*øÜ%ô Ø,-¯H¯H¨Hœ	×(Ò(¼)×:LÑ:L�Ø—‘¤	¨%°qÓ 9Ô:ÝûØ×+Ñ+ô Ø×-Ñ-¨aÓ0×0Ñ0ÝûÜ×)Ñ)ô ÚÜô Ø—‘¤	¬)×*=Ñ*=¸tÓ GÔHÝûðüs�   ‚ D:¤A ÁA
ÁA ÁD:Á
A ÁD7ÁAB*Â$D:Â*D7Â=D7Â>CÃCÃCÃD:ÃD7Ã5D7Ã6D:Ã9D7ÄD7Ä)D2Ä,D:Ä2D7Ä7D:c               ó    € V ^8„  d   QhRRRR/# )r7   r¡   r�   r<   r=   r   )r>   s   "r'   r?   rf   »   s   € ÷ ñ Ð$6ð ¸4ñ r&   c           	   ƒ  	óª  "  € V P                  4        V P                  R 4       V P                  RV P                  4       \        P	                  RVP
                  V P                  4        \        P                  ! V P                  VP                  VP                  '       g   RMV P                  P                  V P                  V P                  P                  V P                  P                  R7      p\        P                  ! VRR7      G Rj  x€L
 V n
        V P!                  4        R#  L  T P"                   d&   pT P%                  T4      G Rj  x€L 
   Rp?R# Rp?i\&         d�   p\        P	                  RTP
                  TP
                  T P                  4       TP                  '       d   \(        P                  M\(        P*                  pT P-                  \/        Y@T4      4        Rp?R# Rp?i\        P0                   d     R# \2         d5   pT P-                  \/        \(        P4                  Y4      4        Rp?R# Rp?ii ; i5i)r’   r‘   z1Got a request to %s the websocket at Shard ID %s.N)r0   Úgatewayry   ÚsessionÚsequenceç      N@©Útimeoutz:Somehow got a signal to %s while trying to %s shard ID %s.)rˆ   rj   rz   rŸ   ÚdebugÚopr   Úfrom_clientrh   r0   rc   r¬   Ú
session_idr®   rs   Úwait_forr‚   ru   r£   r�   r-   r1   rk   r5   r¨   r–   r2   )rE   r¡   Úcoror•   r³   s   &&   r'   Ú
reidentifyÚShard.reidentify»   s’  é € Ø×ÑÔØ�‰�|Ô$Ø�‰Ð)¨4¯7©7Ô3Ü�
‰
ÐFÈÏÉÐPT×PWÑPWÔXð	Ü#×/Ò/Ø—‘Ø—z‘zØ$'§J§J J™°D·G±G·O±OØŸ™ØŸ™×*Ñ*ØŸ™×)Ñ)ôˆDô $×,Ò,¨T¸4Ô@×@ˆDŒGð �K‰KŽMñ AøØ×'Ñ'ô 	-Ø×)Ñ)¨!Ó,×,×,ûÜ!ô 	4Ü�J‰JÐSÐUV×UYÑUYÐ[^×[aÑ[aÐcg×cjÑcjÔkØ%&§X§X X”×!Ò!´9×3EÑ3EˆBØ�O‰OœI b°Ó2×3Ò3ûÜ×%Ñ%ô 	ÚÜô 	EØ�O‰OœI¤i×&9Ñ&9¸4ÓC×DÒDûð	Eüs’   ‚A)IÁ,B%D/ ÄD-Ä	D/ ÄIÄ-D/ Ä/IÅ E ÅEÅE ÅIÅ IÅ-IÅ.BG7Ç1IÇ7IÈIÈIÈIÈIÈ)IÉIÉIÉIc               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rf   ×   s   € ÷ ñ  ñ r&   c              ƒ  	ó  "  € V P                  4         \        P                  ! V P                  V P                  R 7      p\
        P                  ! VRR7      G Rj  x€L
 V n        V P                  4        R#  L  T P                   d&   pT P                  T4      G Rj  x€L 
   Rp?R# Rp?i\
        P                   d     R# \         d5   pT P                  \        \        P                   Y4      4        Rp?R# Rp?ii ; i5i))ry   r¯   r°   N)rˆ   r   r´   rh   rz   rs   r¶   rc   r‚   ru   r£   r¨   r–   rk   r5   r-   r2   )rE   r·   r•   s   &  r'   r/   ÚShard.reconnect×   s¹   é € Ø×ÑÔð
	Ü#×/Ò/°·±ÀtÇwÁwÔOˆDÜ#×,Ò,¨T¸4Ô@×@ˆDŒGð �K‰KŽMñ AøØ×'Ñ'ô 	-Ø×)Ñ)¨!Ó,×,×,ûÜ×%Ñ%ô 	ÚÜô 	EØ�O‰OœI¤i×&9Ñ&9¸4ÓC×DÒDûð	Eüsw   ‚D”AA9 ÁA7Á	A9 Á%DÁ7A9 Á9DÂ
B*ÂB!ÂB*Â$DÂ*DÃDÃDÃDÃDÃ)C>Ã8DÃ>DÄD)	rn   rh   rl   rj   ru   rk   rm   ro   rc   N)r    r!   r"   r#   rF   Úpropertyrz   r‚   rˆ   r.   r’   r£   r�   r¸   r/   r%   r   r&   r'   ra   ra   f   sJ   † õ
ð$ ô ó ð õBõ õ'õ4õAõ:õ"÷8ñ r&   ra   c                  ó|   € ] tR t^ætRtRtR R ltR R ltR R ltR R	 lt	R
 R lt
]R R l4       tR R ltRtR# )r*   a�  A class that gives information and control over a specific shard.

You can retrieve this object via :meth:`AutoShardedClient.get_shard`
or :attr:`AutoShardedClient.shards`.

.. versionadded:: 1.4

Attributes
------------
id: :class:`int`
    The shard ID for this shard.
shard_count: Optional[:class:`int`]
    The shard count for this cluster. If this is ``None`` then the bot has not started yet.
c               ó$   € V ^8„  d   QhRRRRRR/# )r7   Úparentra   Úshard_countúOptional[int]r<   r=   r   )r>   s   "r'   r?   ÚShardInfo.__annotate__ø   s!   € ÷ 6ñ 6˜uð 6°=ð 6ÀTñ 6r&   c                	ó@   € Wn         VP                  V n        W n        R # rB   ©Ú_parentrz   rÁ   )rE   rÀ   rÁ   s   &&&r'   rF   ÚShardInfo.__init__ø   s   € Ø$ŒØ—y‘yˆŒØ*5Ör&   c               ó   € V ^8„  d   QhRR/# ©r7   r<   rL   r   )r>   s   "r'   r?   rÃ   ý   s   € ÷ (ñ (˜4ñ (r&   c                óL   € V P                   P                  P                  '       * # )z@:class:`bool`: Whether the shard connection is currently closed.)rÆ   rc   Úopenr\   s   &r'   r›   ÚShardInfo.is_closedý   s   € à—<‘<—?‘?×'Ñ'Ô'Ð'r&   c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rÃ     s   € ÷ (ñ ( $ñ (r&   c              ƒ  ó†   "  € V P                  4       '       d   R# V P                  P                  4       G Rj  x€L
  R#  L5i)z˜|coro|

Disconnects a shard. When this is called, the shard connection will no
longer be open.

If the shard is already disconnected this does nothing.
N)r›   rÆ   r’   r\   s   &r'   r’   ÚShardInfo.disconnect  s-   é € ð �>‰>×ÒÙà�l‰l×%Ñ%Ó'×'Ô'ùó   ‚6A¸?¹Ac               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rÃ     s   € ÷ 'ñ ' ñ 'r&   c              ƒ  óÊ   "  € V P                  4       '       g#   V P                  P                  4       G Rj  x€L
  V P                  P                  4       G Rj  x€L
  R#  L( L5i)z7|coro|

Disconnects and then connects the shard again.
N)r›   rÆ   r’   r/   r\   s   &r'   r/   ÚShardInfo.reconnect  sH   é € ð
 �~‰~×ÒØ—,‘,×)Ñ)Ó+×+Ð+Ø�l‰l×$Ñ$Ó&×&Ò&ñ ,Ù&ùs!   ‚4A#¶A·!A#ÁA!ÁA#Á!A#c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   rÃ     s   € ÷ 'ñ '˜tñ 'r&   c              ƒ  ó†   "  € V P                  4       '       g   R# V P                  P                  4       G Rj  x€L
  R#  L5i)zO|coro|

Connects a shard. If the shard is already connected this does nothing.
N)r›   rÆ   r/   r\   s   &r'   ÚconnectÚShardInfo.connect  s-   é € ð
 �~‰~×ÒÙà�l‰l×$Ñ$Ó&×&Ô&ùrÐ   c               ó   € V ^8„  d   QhRR/# ©r7   r<   Úfloatr   )r>   s   "r'   r?   rÃ   "  s   € ÷ 'ñ '˜ñ 'r&   c                óB   € V P                   P                  P                  # )zc:class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard.)rÆ   rc   Úlatencyr\   s   &r'   rÜ   ÚShardInfo.latency!  s   € ð �|‰|�‰×&Ñ&Ð&r&   c               ó   € V ^8„  d   QhRR/# rÉ   r   )r>   s   "r'   r?   rÃ   &  s   € ÷ 0ñ 0 4ñ 0r&   c                óJ   € V P                   P                  P                  4       # )zÁ:class:`bool`: Whether the websocket is currently rate limited.

This can be useful to know when deciding whether you should query members
using HTTP or via the gateway.

.. versionadded:: 1.6
)rÆ   rc   Úis_ratelimitedr\   s   &r'   Úis_ws_ratelimitedÚShardInfo.is_ws_ratelimited&  s   € ð �|‰|�‰×-Ñ-Ó/Ð/r&   rÅ   N)r    r!   r"   r#   Ú__doc__r_   rF   r›   r’   r/   rÖ   r½   rÜ   rá   r%   r   r&   r'   r*   r*   æ   sE   † ñð 1€Iõ6õ
(õ(õ'õ'ð ô'ó ð'÷0ñ 0r&   c                  ó*   € ] tR tRtRtRtR R ltRtR# )r+   i1  aÅ  A class that holds info about session start limits

.. versionadded:: 2.5

Attributes
----------
total: :class:`int`
    The total number of session starts the current user is allowed
remaining: :class:`int`
    Remaining remaining number of session starts the current user is allowed
reset_after: :class:`int`
    The number of milliseconds until the limit resets
max_concurrency: :class:`int`
    The number of identify requests allowed per 5 seconds
c               ó   € V ^8„  d   QhRR/# )r7   ÚkwargszUnpack[SessionStartLimit]r   )r>   s   "r'   r?   ÚSessionStartLimits.__annotate__D  s   € ÷ >ñ >Ð!:ñ >r&   c                	óv   € VR ,          V n         VR,          V n        VR,          V n        VR,          V n        R# )r(   Ú	remainingÚreset_afterÚmax_concurrencyN©r(   ré   rê   rë   )rE   ræ   s   &,r'   rF   ÚSessionStartLimits.__init__D  s4   € Ø  �/ˆŒ
Ø$ [Õ1ˆŒØ & }Õ 5ˆÔØ$*Ð+<Õ$=ˆÖr&   )rë   ré   rê   r(   Nrì   )r    r!   r"   r#   rã   r_   rF   r%   r   r&   r'   r+   r+   1  s   † ñð  I€I÷>ñ >r&   c                  óL  a a€ ] tR tRt0 o$ Rt]'       d   R]R&   R V 3R lltR,RR/R	 R
 llltR R lt	]
R R l4       t]
R R l4       tR R lt]
R R l4       tR R ltRR/R R lltR R ltR V 3R lltRR /R! R" lltR# R$ ltR%RR&RRR/R' R( lltR) R* ltR+tV ;t# )-r)   iK  ae  A client similar to :class:`Client` except it handles the complications
of sharding for the user into a more manageable and transparent single
process bot.

When using this client, you will be able to use it as-if it was a regular
:class:`Client` with a single shard when implementation wise internally it
is split up into multiple shards. This allows you to not have to deal with
IPC or other complicated infrastructure.

It is recommended to use this client only if you have surpassed at least
1000 guilds.

If no :attr:`.shard_count` is provided, then the library will use the
Bot Gateway endpoint call to figure out how many shards to use.

If a ``shard_ids`` parameter is given, then those shard IDs will be used
to launch the internal shards. Note that :attr:`.shard_count` must be provided
if this is used. By default, when omitted, the client will launch shards from
0 to ``shard_count - 1``.

.. container:: operations

    .. describe:: async with x

        Asynchronously initialises the client and automatically cleans up.

        .. versionadded:: 2.0

Attributes
------------
shard_ids: Optional[List[:class:`int`]]
    An optional list of shard_ids to launch the shards with.
shard_connect_timeout: Optional[:class:`float`]
    The maximum number of seconds to wait before timing out when launching a shard.
    Defaults to 180 seconds.

    .. versionadded:: 2.4
r   Ú_connectionc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r7   Úargsr   Úintentsr   ræ   z!Unpack[_AutoShardedClientOptions]r<   r=   r   )r>   s   "r'   r?   ÚAutoShardedClient.__annotate__v  s*   € ÷ 4ñ 4˜cð 4¨Gð 4Ð?`ð 4Ðeiñ 4r&   c               	óÌ  <a € VP                  R R4       VP                  RR4      S n        VP                  RR4      S n        \        SS `  ! VRV/VB  S P                  eK   S P
                  f   \        R4      h\        S P                  \        \        34      '       g   \        R4      h/ S n
        S P                  S P                  n        V 3R lS P                  n        R# )	ry   Nr   r   g     €f@rò   z>When passing manual shard_ids, you must provide a shard_count.z.shard_ids parameter must be a list or a tuple.c                 ó   <€ S # rB   r   r\   s   €r'   Ú<lambda>Ú,AutoShardedClient.__init__.<locals>.<lambda>‡  s   ø€ ©tr&   )Úpopr   r   ÚsuperrF   rÁ   r   rO   ÚlistÚtupleÚ_AutoShardedClient__shardsÚ_get_websocketrï   Ú_get_client)rE   rò   rñ   ræ   Ú	__class__s   f$*,€r'   rF   ÚAutoShardedClient.__init__v  s½   ù€ Ø�
‰
�:˜tÔ$Ø.4¯j©j¸ÀdÓ.KˆŒØ6<·j±jÐAXÐZ_Ó6`ˆÔ"ä‰Ò˜$Ð:¨Ð:°6Ò:à�>‰>Ò%Ø×ÑÒ'Ü%Ð&fÓgÐgÜ §¡´´u°×>Ò>Ü%Ð&VÓWÐWð ˆŒØ*.×*=Ñ*=ˆ×ÑÔ'Ü'3ˆ×ÑÖ$r&   Nry   c               ó$   € V ^8„  d   QhRRRRRR/# )r7   Úguild_idrÂ   ry   r<   r   r   )r>   s   "r'   r?   ró   ‰  s"   € ÷ *ñ * }ð *È-ð *Ðcsñ *r&   c               	óx   € Vf   V^,	          V P                   ,          pV P                  V,          P                  # rB   )rÁ   rü   rc   )rE   r  ry   s   &&$r'   rý   Ú AutoShardedClient._get_websocket‰  s1   € ØÒà  B�¨$×*:Ñ*:Õ:ˆHØ�}‰}˜XÕ&×)Ñ)Ð)r&   c               ó    € V ^8„  d   QhRRRR/# )r7   Úoptionsr   r<   r   r   )r>   s   "r'   r?   ró   �  s   € ÷ 
ñ 
 Cð 
Ð,Fñ 
r&   c                	óx   € \        RR V P                  RV P                  RV P                  RV P                  /VB # )ri   ÚhandlersÚhooksÚhttpr   )r   ri   Ú	_handlersÚ_hooksr
  )rE   r  s   &,r'   Ú
_get_stateÚAutoShardedClient._get_state�  sM   € Ü)ñ 
Ø—]‘]ð
à—^‘^ð
ð —+‘+ð
ð —‘ð	
ð
 ñ
ð 	
r&   c               ó   € V ^8„  d   QhRR/# rÙ   r   )r>   s   "r'   r?   ró   ™  s   € ÷ 	Rñ 	R˜ñ 	Rr&   c                ó¨   € V P                   '       g   \        R4      # \        R V P                   4       4      \	        V P                   4      ,          # )a9  :class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.

This operates similarly to :meth:`Client.latency` except it uses the average
latency of every shard's latency. To get a list of shard latency, check the
:attr:`latencies` property. Returns ``nan`` if there are no shards ready.
Únanc              3  ó*   "  € T F	  w  rVx € K  	  R # 5irB   r   )Ú.0Ú_rÜ   s   &  r'   Ú	<genexpr>Ú,AutoShardedClient.latency.<locals>.<genexpr>¢  s   é € Ð<©^™z˜q•7«^ùs   ‚)rü   rÚ   ÚsumÚ	latenciesÚlenr\   s   &r'   rÜ   ÚAutoShardedClient.latency˜  s:   € ð �}�}ˆ}Ü˜“<ÐÜÑ<¨T¯^ª^Ó<Ó<¼sÀ4Ç=Á=Ó?QÕQÐQr&   c               ó   € V ^8„  d   QhRR/# )r7   r<   zList[Tuple[int, float]]r   )r>   s   "r'   r?   ró   ¥  s   € ÷ [ñ [Ð2ñ [r&   c                ó”   € V P                   P                  4        UUu. uF  w  rWP                  P                  3NK  	  upp# u uppi )z¹List[Tuple[:class:`int`, :class:`float`]]: A list of latencies between a HEARTBEAT and a HEARTBEAT_ACK in seconds.

This returns a list of tuples with elements ``(shard_id, latency)``.
)rü   Úitemsrc   rÜ   )rE   ry   r:   s   &  r'   r  ÚAutoShardedClient.latencies¤  s<   € ð EIÇMÁM×DWÑDWÔDYÔZÑDY±°�Ÿ8™8×+Ñ+Ó,ÑDYÒZÐZùÓZs   ž"Ac               ó    € V ^8„  d   QhRRRR/# )r7   ry   r9   r<   zOptional[ShardInfo]r   )r>   s   "r'   r?   ró   ¬  s   € ÷ 7ñ 7 #ð 7Ð-@ñ 7r&   c               óx   €  V P                   V,          p\        W P                  4      #   \         d     R# i ; i)a  
Gets the shard information at a given shard ID or ``None`` if not found.

.. versionchanged:: 2.0

    ``shard_id`` parameter is now positional-only.

Returns
--------
Optional[:class:`ShardInfo`]
    Information about the shard with given ID. ``None`` if not found.
N)rü   r*   rÁ   ÚKeyError©rE   ry   rÀ   s   "" r'   Ú	get_shardÚAutoShardedClient.get_shard¬  s<   € ð	7Ø—]‘] 8Õ,ˆFô ˜V×%5Ñ%5Ó6Ð6øô ô 	Úð	ús   ‚* ª9¸9c               ó   € V ^8„  d   QhRR/# )r7   r<   zDict[int, ShardInfo]r   )r>   s   "r'   r?   ró   Á  s   € ÷ mñ mÐ,ñ mr&   c           	     ó’   € V P                   P                  4        UUu/ uF  w  rV\        W P                  4      bK  	  upp# u uppi )zaMapping[int, :class:`ShardInfo`]: Returns a mapping of shard IDs to their respective info object.)rü   r  r*   rÁ   r"  s   &  r'   ÚshardsÚAutoShardedClient.shardsÀ  sB   € ð W[×VcÑVc×ViÑViÔVkÔlÑVkÑBRÀ(�œ) F×,<Ñ,<Ó=Ò=ÑVkÒlÐlùÓls   ž!Ac               ó   € V ^8„  d   QhRR/# )r7   r<   r+   r   )r>   s   "r'   r?   ró   Å  s   € ÷ ,ñ ,Ð2Dñ ,r&   c              ƒ  ón   "  € V P                   P                  4       G Rj  x€L
 w   r\        R/ VB #  L5i)a  |coro|

Get the session start limits.

This is not typically needed, and will be handled for you by default.

At the point where you are launching multiple instances
with manual shard ranges and are considered required to use large bot
sharding by Discord, this function when used along IPC and a
before_identity_hook can speed up session start.

.. versionadded:: 2.5

Returns
-------
:class:`SessionStartLimits`
    A class containing the session start limits

Raises
------
GatewayNotFound
    The gateway was unreachable
Nr   )r
  Úget_bot_gatewayr+   )rE   r  Úlimitss   &  r'   Úfetch_session_start_limitsÚ,AutoShardedClient.fetch_session_start_limitsÅ  s3   é € ð0 "ŸY™Y×6Ñ6Ó8×8‰ˆˆ1Ü!Ñ+ FÑ+Ð+ñ 9ùs   ‚5 3¡5ÚinitialFc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r7   r¬   zyarl.URLry   r9   r/  rL   r<   r=   r   )r>   s   "r'   r?   ró   à  s)   € ÷ ñ ¨(ð ¸cð Ètð Ð`dñ r&   c             ƒ  	óÔ  "  €  \         P                  ! WWR 7      p\        P                  ! W@P                  R7      G Rj  x€L
 p\        YPT P                  P                  4      ;T P                  T&   pTP                  4        R#  LE  \
         dS    \        P                  RT4       \        P                  ! R4      G Rj  x€L 
  T P                  Y4      G Rj  x€L 
 u # i ; i5i))r/  r¬   ry   r°   Nz/Failed to connect for shard_id: %s. Retrying...g      @)r   r´   rs   r¶   r   r–   rŸ   Ú	exceptionr    Úlaunch_shardra   Ú_AutoShardedClient__queueÚ
put_nowaitrü   r‚   )rE   r¬   ry   r/  r·   rc   Úrets   &&&$   r'   r3  ÚAutoShardedClient.launch_shardà  s°   é € ð	>Ü#×/Ò/°ÈwÔjˆDÜ×'Ò'¨×6PÑ6PÔQ×QˆBô ).¨b¸¿¹×8OÑ8OÓ(PÐPˆ�‰�hÑ #Ø�
‰
Žñ RøÜô 	>Ü�N‰NÐLÈhÔWÜ—-’- Ó$×$Ñ$Ø×*Ñ*¨7Ó=×=Ð=Ò=ð	>üsS   ‚C(„<B Á BÁB ÁAC(ÂB Â:C%ÃCÃC%ÃCÃC%Ã"C(Ã$C%Ã%C(c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   ró   í  s   € ÷ Hñ H Tñ Hr&   c              ƒ  	ó  "  € V P                  4       '       d   R # V P                  fD   V  V P                  P                  4       G R j  x€L
 w  V n        r\        P
                  ! V4      pM\        P                  pV P                  V P                  n        V P                  ;'       g    \        V P                  4      pW@P                  n	        V F)  pWT^ ,          8H  pV P                  W5VR7      G R j  x€L
  K+  	  R #  L¸ L5i)N)r/  )r›   rÁ   r
  r+  ÚyarlÚURLr   ÚDEFAULT_GATEWAYrï   r   Úranger3  )rE   Úgateway_urlÚ_session_start_limitr¬   r   ry   r/  s   &      r'   Úlaunch_shardsÚAutoShardedClient.launch_shardsí  sÒ   é € Ø�>‰>×ÒÙà×ÑÒ#ÙØHLÏ	É	×HaÑHaÓHc×BcÑ?ˆDÔ˜kÜ—h’h˜{Ó+‰Gä&×6Ñ6ˆGà'+×'7Ñ'7ˆ×ÑÔ$à—N‘N×=Ð=¤e¨D×,<Ñ,<Ó&=ˆ	Ø%.×ÑÔ"ã!ˆHØ¨A¥,Ñ.ˆGØ×#Ñ# G¸wÐ#ÓG×GÒGó "ñ Cdñ Hùs,   ‚ADÁDÁ	A DÂ*ADÃ6DÃ7DÄDc               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   ró     s   € ÷ /ñ /¨ñ /r&   c              ƒ  	ót   <"  € \         SV `  4       G R j  x€L
  \        P                  ! 4       V n        R #  L 5irB   )rù   Ú_async_setup_hookrs   ÚPriorityQueuer4  )rE   rÿ   s   &€r'   rD  Ú#AutoShardedClient._async_setup_hook  s,   øé € Ü‰gÑ'Ó)×)Ð)Ü×,Ò,Ó.ˆŽñ 	*ùs   ƒ8•6–!8r/   Tc               ó    € V ^8„  d   QhRRRR/# )r7   r/   rL   r<   r=   r   )r>   s   "r'   r?   ró     s   € ÷ ñ ¨$ð ¸$ñ r&   c             ƒ  	ód  "  € Wn         V P                  4       G R j  x€L
  V P                  4       '       Egè   V P                  P	                  4       G R j  x€L
 pVP
                  \        P                  8X  d�   V P                  4       G R j  x€L
  \        VP                  \        4      '       dc   VP                  P                  R8X  d!   \        VP                  P                  4      R hVP                  P                  R8w  d   VP                  hR # VP
                  \        P                  \        P                   39   d1   VP                  P#                  VP                  4      G R j  x€L
  EKS  VP
                  \        P$                  8X  d&   VP                  P%                  4       G R j  x€L
  EK—  VP
                  \        P&                  8X  d%   V P                  4       G R j  x€L
  VP                  hVP
                  \        P(                  8X  g   EKü  R # R #  EL ELÏ EL› L½ L{ LC5i)Nr˜   rŒ   )rm   r@  r›   r4  ÚgetrD   r-   r.   rO   r;   r
   r�   r   r:   rz   r1   r0   r¸   r/   r2   r3   )rE   r/   Úitems   &$ r'   rÖ   ÚAutoShardedClient.connect  so  é € Ø#ŒØ× Ñ Ó"×"Ð"à—.‘.×"Ó"ØŸ™×)Ñ)Ó+×+ˆDØ�y‰yœIŸO™OÔ+Ø—j‘j“l×"Ð"Ü˜dŸj™jÔ*:×;Ò;Ø—z‘z—‘¨$Ô.Ü7¸¿
¹
¿¹ÓFÈDÐPØ—z‘z—‘¨$Ô.Ø"Ÿj™jÐ(ÙØ—‘œy×1Ñ1´9×3CÑ3CÐDÔDØ—j‘j×+Ñ+¨D¯J©JÓ7×7Ó7Ø—‘œi×1Ñ1Ô1Ø—j‘j×*Ñ*Ó,×,Ó,Ø—‘œi×1Ñ1Ô1Ø—j‘j“l×"Ð"Ø—j‘jÐ Ø—‘œi×3Ñ3×3Ùñ% #ò 	#ò ,â"ñ 8á,á"ùsv   ‚H0œH!�H0¸H0ÁH$Á6H0ÂH'ÂCH0Å,H*Å-AH0Æ0H,Æ19H0Ç*H.Ç+,H0ÈH0È$H0È'H0È*H0È,H0È.H0c               ó   € V ^8„  d   QhRR/# r}   r   )r>   s   "r'   r?   ró     s   € ÷ !ñ !˜Tñ !r&   c              ƒ  óØ   a "  € S P                   '       d   S P                   G Rj  x€L
 # V 3R lp\        P                  ! V! 4       4      S n         S P                   G Rj  x€L
  R#  L@ L5i)z*|coro|

Closes the connection to Discord.
Nc               “  ó  <"  € SP                   P                  4       G R j  x€L
  SP                  P                  4        U u. uF3  p \        P
                  ! V P                  4       SP                  R7      NK5  	  pp V'       d   \        P                  ! V4      G R j  x€L
  SP                  P                  4       G R j  x€L
  SP                  P                  \        \        P                  R R 4      4       R #  LÙu up i  Lc LC5i)N)r   )rï   r.   rü   Úvaluesrs   Úensure_futurer   Úwaitr
  r4  r5  r5   r-   r3   )r:   Úto_closerE   s     €r'   Ú_closeÚ'AutoShardedClient.close.<locals>._close%  s³   øé € Ø×"Ñ"×(Ñ(Ó*×*Ð*àZ^×ZgÑZg×ZnÑZnÔZpÓqÑZpÐQVœ×-Ò-¨e¯k©k«mÀ$Ç)Á)×LÑZpˆHÐqßÜ—l’l 8Ó,×,Ð,à—)‘)—/‘/Ó#×#Ð#Ø�L‰L×#Ñ#¤I¬i×.CÑ.CÀTÈ4Ó$PÖQñ +ùâqá,á#ùs?   ƒD¡C;¢ DÁ9C=Á;#DÂDÂ!DÃ DÃ;DÃ=DÄD)Ú_closing_taskrs   r€   )rE   rS  s   f r'   r.   ÚAutoShardedClient.close  sY   øé € ð
 ××ÐØ×+Ñ+×+Ð+õ	Rô %×0Ò0±³Ó:ˆÔØ× Ñ × Ò ñ ,ñ 	!ùs!   ƒ"A*¥A&¦9A*ÁA(Á A*Á(A*ÚactivityÚstatusc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r7   rW  zOptional[BaseActivity]rX  zOptional[Status]ry   rÂ   r<   r=   r   )r>   s   "r'   r?   ró   2  s:   € ÷ E$ñ E$ð )ðE$ð !ð	E$ð
  ðE$ð 
ñE$r&   c             ƒ  ó²  "  € Vf   Rp\         P                  pM4V\         P                  J d   Rp\         P                  pMTp\        V4      pVf]   V P                  P                  4        F'  pVP                  P                  WR7      G Rj  x€L
  K)  	  V P                  P                  pMnV P                  V,          pVP                  P                  WR7      G Rj  x€L
  V P                  P                   Uu. uF  qˆP                  V8X  g   K  VNK  	  ppVf   RMV3p	V F!  p
V
P                  pVf   K  W›n        W[n        K#  	  R#  L¿ Lou upi 5i)av  |coro|

Changes the client's presence.

Example: ::

    game = discord.Game("with the API")
    await client.change_presence(status=discord.Status.idle, activity=game)

.. versionchanged:: 2.0
    Removed the ``afk`` keyword-only parameter.

.. versionchanged:: 2.0
    This function will now raise :exc:`TypeError` instead of
    ``InvalidArgument``.

Parameters
----------
activity: Optional[:class:`BaseActivity`]
    The activity being done. ``None`` if no currently active activity is done.
status: Optional[:class:`Status`]
    Indicates what status to change to. If ``None``, then
    :attr:`Status.online` is used.
shard_id: Optional[:class:`int`]
    The shard_id to change the presence to. If not specified
    or ``None``, then it will change the presence of every
    shard the bot can see.

Raises
------
TypeError
    If the ``activity`` parameter is not of proper type.
NÚonlineÚ	invisible)rW  rX  r   )r   r[  ÚofflineÚstrrü   rO  rc   Úchange_presencerï   Úguildsry   ÚmeÚ
activitiesrX  )rE   rW  rX  ry   Ústatus_valueÚstatus_enumr:   r`  Úgrb  Úguildra  s   &$$$        r'   r_  Ú!AutoShardedClient.change_presence2  s(  é € ðR Š>Ø#ˆLÜ Ÿ-™-‰KØ”v—~‘~Ó%Ø&ˆLÜ Ÿ.™.‰Kà ˆKÜ˜v›;ˆLàÒØŸ™×-Ñ-Ö/�Ø—h‘h×.Ñ.¸Ð.ÓV×VÒVñ 0ð ×%Ñ%×,Ñ,‰Fà—M‘M (Õ+ˆEØ—(‘(×*Ñ*°HÐ*ÓR×RÐRØ!%×!1Ñ!1×!8Ò!8ÓSÑ!8˜A¿J¹JÈ(Ñ<R—a�aÑ!8ˆFÐSà#Ò+‘R°(°ˆ
ÛˆEØ—‘ˆBØŠzÙð 'ŒMØ#ŽIó ñ Wñ
 SùÚSùs=   ‚BEÂEÂAEÃ EÃ!EÃ=EÄEÄ5EÅEÅEc               ó   € V ^8„  d   QhRR/# rÉ   r   )r>   s   "r'   r?   ró   y  s   € ÷ Rñ R 4ñ Rr&   c                óÊ   € \         ;QJ d4    R V P                  P                  4        4       F  '       g   K   R# 	  R# ! R V P                  P                  4        4       4      # )aM  :class:`bool`: Whether the websocket is currently rate limited.

This can be useful to know when deciding whether you should query members
using HTTP or via the gateway.

This implementation checks if any of the shards are rate limited.
For more granular control, consider :meth:`ShardInfo.is_ws_ratelimited`.

.. versionadded:: 1.6
c              3  óT   "  € T F  qP                   P                  4       x € K   	  R # 5irB   )rc   rà   )r  r:   s   & r'   r  Ú6AutoShardedClient.is_ws_ratelimited.<locals>.<genexpr>„  s    é € ÐQÑ:P°—8‘8×*Ñ*×,Ð,Ó:Pùs   ‚&(TF)Úanyrü   rO  r\   s   &r'   rá   Ú#AutoShardedClient.is_ws_ratelimitedy  sG   € ÷ ‹sÑQ¸$¿-¹-×:NÑ:NÔ:PÓQ�sŒsÐQŠsÐQˆsÑQ¸$¿-¹-×:NÑ:NÔ:PÓQÓQÐQr&   )Ú__queueÚ__shardsrU  rm   r   rÁ   r   rB   )r    r!   r"   r#   rã   r   r$   rF   rý   r  r½   rÜ   r  r#  r'  r-  r3  r@  rD  rÖ   r.   r_  rá   r%   Ú__classcell__)rÿ   Ú__conditional_annotations__s   @@r'   r)   r)   K  så   ù‡ � ñ%÷N Ø/Ó/÷4ð 4ñ&*ÐZ^÷ *ð *õ
ð ô	Ró ð	Rð ô[ó ð[õ7ð( ômó ðmõ,ð6ÐV[÷ õH÷(/ð /ð°÷ õ0!ð*E$ð ,0ðE$ð $(ð	E$ð
 #'÷E$÷NRó Rr&   )r)   r*   r+   )4rã   Ú
__future__r   rs   Úloggingrq   r:  Ústater   rd   r   Úbackoffr   r¬   Úerrorsr   r   r	   r
   r   Úenumsr   Útypingr   r   r   r   r   r   r   r   Útyping_extensionsr   r   rW  r   Úflagsr   Útypes.gatewayr   r   r   Ú__all__Ú	getLoggerr    rŸ   r-   r5   ra   r*   r+   r)   r   r&   r'   Ú<module>r~     sÃ   ðñõ0 #ã Û ã Û å -Ý Ý 'Ü ÷õ õ ç R× RÓ RçÝ(Ý)Ý&ÝÝ0Ý&ô/ N¸%õ /ð
€ð ×Ò˜Ó"€÷ñ ÷ñ ÷,}ñ }÷@H0ñ H0÷V>ñ >ô4yR˜ö yRr&   