+
    kHàj   ã                  óž   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^RIH	t	H
t
 ]! RR4      tR R	 ltR
RRRRRRR/R ltR R ltRtR R ltR# )zïQQ Bot platform plugin: interactive setup and registry entry.

The adapter stays in ``adapter.py``. This module is the only thing ``__init__``
exports, so importing the package registers the platform and does not open a portal
connection.
)Úannotations)Úenv_is_connected)Úconfig_connected_extra)ÚStandaloneSendPolicy)Ú	QQAdapterÚcheck_qq_requirementsÚ	QQ_APP_IDÚQQ_CLIENT_SECRETc               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚbool© )Úformats   "ÚE/home/ubuntu/.hermes/hermes-agent/plugins/platforms/qqbot/register.pyÚ__annotate__r      s   € ÷ $ñ $˜Tñ $ó    c                ó*  € \        V RR4      ;'       g    / p\        VP                  R4      ;'       g    R4      P                  4       '       d;   \        VP                  R4      ;'       g    R4      P                  4       '       d   R# \	        V 4      # )zLBoth credentials from ``extra`` (config.yaml) or the profile env / ``.env``.ÚextraNÚapp_idÚ Úclient_secretT)ÚgetattrÚstrÚgetÚstripÚ_env_configured)Úpconfigr   s   & r   Úis_connectedr      sp   € ä�G˜W dÓ+×1Ð1¨r€EÜ
ˆ5�9‰9�XÓ×$Ð$ "Ó%×+Ñ+×-Ò-´#°e·i±iÀÓ6P×6VÐ6VÐTVÓ2W×2]Ñ2]×2_Ò2_ÙÜ˜7Ó#Ð#r   Ú	thread_idNÚmedia_filesÚforce_documentFÚcaptionc          
   ƒ  óB   "  € ^RI Hp V! WW$VW5R7      G Rj  x€L
 #  L5i)zRLate-import the REST sender so cron delivery works without a live gateway process.)Ú
send_qqbot)r    r"   r   r!   N)Úsendr$   )r   Úchat_idÚmessager   r    r!   r"   r$   s   &&&$$$$ r   Ústandalone_sendr(      s+   é € õ !ÙØ˜'ÀGØô÷ ð ñ ùs   ‚˜™c               ó   € V ^8„  d   QhRR/# ©r   r   ÚNoner   )r   s   "r   r   r   &   s   € ÷ V5ñ V5�Tñ V5r   c                 ó0  € ^ RI Hp HpHp ^ RIHp ^ RIHpHpH	pH
pHp ^ RIHp	Hp
Hp V! R4       V! RRR4      '       g   R	# \!        4        R
R.pR	pV
! RV^ 4      ^ 8X  d    ^RIHp V! 4       pT'       g	   T ! R4       V'       g�   \!        4        V ! R4       V ! R4       \!        4        V	! RRR7      pV'       g   V! R4       R	# V	! RRR7      pV'       g   V! R4       R	# RVP)                  4       RVP)                  4       RR/pV! RVR,          4       V! RVR,          4       VP+                  RR4      p\!        4        . R1OpV
! RV^ 4      pV^ 8X  dX   V! RR4       RpV'       d+   \!        4        V! R V R!2R4      '       d   TpV! R"V 24       V! R#V4       V! R$4       V ! R%4       M?V^8X  d   V! R&RR'7       V! R(4       M%T! R)T;'       g    R4      pV! RVR'7       V! R*4       \!        4        V'       d   V! R+VR,4       MBV	! R-RR7      pV'       d1   V! R+VP)                  4       4       V! R.VP)                  4        24       \!        4        V! R/4       V ! R0VR,           24       R	#   \&         d    \!        4        T! R4        R	# i ; i)2zCInteractive setup: scan-to-configure or manual App ID / App Secret.)Ú
print_infoÚprint_successÚprint_warning)Úsave_env_value)Úconfirm_reconfigureÚoffer_home_channelÚprint_setup_headerÚ
prompt_csvÚsave_env_values)ÚpromptÚprompt_choiceÚprompt_yes_nou   ðŸ�§ QQ BotúQQ Botr   r	   Nz3Scan QR code to add bot automatically (recommended)z-Enter existing App ID and App Secret manuallyz&  How would you like to set up QQ Bot?)Úqr_registerz  QQ Bot setup cancelled.z:  QR setup did not complete. Continuing with manual input.z:  Go to https://q.qq.com to register a QQ Bot application.z<  Note your App ID and App Secret from the application page.z  App IDF)Úpasswordu2     Skipped â€” QQ Bot won't work without an App ID.z  App SecretTu6     Skipped â€” QQ Bot won't work without an App Secret.r   r   Úuser_openidr   z+  How should direct messages be authorized?ÚQQ_ALLOW_ALL_USERSÚfalsez  Add yourself (z) to the allow list?z  Allow list set to ÚQQ_ALLOWED_USERSz  DM pairing enabled.zJ  Unknown users can request access; approve with `hermes pairing approve`.Útrue)r=   r?   z$  Open DM access enabled for QQ Bot.z(  Allowed user OpenIDs (comma-separated)z  Allowlist saved.ÚQQBOT_HOME_CHANNELzyour QQ user IDz8  Home channel OpenID (for cron/notifications, or empty)z  Home channel set to u   ðŸ�§ QQ Bot configured!z
  App ID: )z%Use DM pairing approval (recommended)zAllow all direct messageszOnly allow listed user OpenIDs)Úhermes_cli.cli_outputr-   r.   r/   Úhermes_cli.configr0   Úhermes_cli.gateway_setup_wizardr1   r2   r3   r4   r5   Úhermes_cli.setupr6   r7   r8   ÚprintÚonboardr:   ÚKeyboardInterruptr   r   )r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   Úmethod_choicesÚcredentialsr:   r   Ú
app_secretr<   Úaccess_choicesÚ
access_idxÚallowedÚ	allowlistÚhome_channels                          r   Úsetup_qqbotrQ   &   s�  € çNÑNÝ0÷õ ÷ FÑEá�}Ô%Ù˜x¨Ð6H×IÒIÙä	„Gà=Ø7ð€Nð €KÙÐ=¸~ÈqÓQÐUVÔVð	Ý,Ù%›-ˆK÷
 ÙÐSÔTçÜŒÙÐOÔPÙÐQÔRÜŒÙ˜
¨UÔ3ˆßÙÐNÔOÙÙ˜N°TÔ:ˆ
ßÙÐRÔSÙØ §¡£°À*×BRÑBRÓBTÐVcÐegÐhˆá�; ¨HÕ 5Ô6ÙÐ% {°?Õ'CÔDØ—/‘/ -°Ó4€Kä	„Gò€Nñ
 ÐLÈnÐ^_Ó`€JØ�Q„ÙÐ+¨WÔ5ØˆßÜŒGÙÐ/°¨}Ð<PÐQÐSW×XÒXØ%�ÙÐ 4°[°MÐBÔCÙÐ)¨7Ô3ÙÐ-Ô.ÙÐ_Õ`Ø	�qŒÙ¨6ÀBÕGÙÐ<Õ=áÐIÈ;×K\ÐK\ÐZ\Ó]ˆ	Ù¨7ÀYÕOÙÐ*Ô+ä	„GßÙÐ/°Ð>OÕPáÐXÐchÔiˆßÙÐ/°×1CÑ1CÓ1EÔFÙÐ2°<×3EÑ3EÓ3GÐ2HÐIÔJä	„GÙÐ+Ô,Ù�˜K¨Õ1Ð2Ð3Ö4øô !ô 	ÜŒGÙÐ5Ô6Úð	ús   Á#I4 É4JÊJa  You are on QQ, a popular Chinese messaging platform. QQ supports markdown formatting and emoji. You can send media files natively: include MEDIA:/absolute/path/to/file in your response. Images are sent as native photos, and other files arrive as downloadable documents.c               ó   € V ^8„  d   QhRR/# r*   r   )r   s   "r   r   r   ‡   s   € ÷ ñ �Tñ r   c                óF  € ^RI Hp V P                  ! R#/ R\        RRRRR7      bRRbRR	bR
RbRR$bRRbR\        bR\
        bR\        bR\        RR4      bRRR.bRRbR\        bRRbRRbR\        bR\        bR VP                  bR!VP                  bVP                  B  R"# )%é   )Úgateway_envr(   r9   T)ÚlabelÚmediaÚcaptionableÚtext_directÚnameÚqqbotÚdashboard_descriptionz5Connect Hermes to a QQ Bot from the QQ Open Platform.Údocs_urlzhttps://q.qq.comÚdashboard_env_varsr   r	   rV   Úadapter_factoryÚcheck_fnr   Úconfig_connected_fnr   r   Úrequired_envÚinstall_hintzIQQBot: aiohttp/httpx missing or QQ_APP_ID/QQ_CLIENT_SECRET not configuredÚsetup_fnÚemojiu   ðŸ�§Úcron_deliver_env_varrA   Ústandalone_sender_fnÚplatform_hintÚenv_overridesÚenv_enable_credentialsNr   )r   r	   r?   )r   rU   Úregister_platformr   r   r   r   r   rQ   r(   Ú_PLATFORM_HINTÚENV_OVERRIDESÚENV_ENABLE_CREDENTIALSÚAUTHZ)ÚctxrU   s   & r   Úregisterrq   ‡   sþ   € ÝØ×Òò Ü,°8À4ÐUYÐgkÕlðáðñ Vðñ $ð	ñ
 Qðñ ðõ "ðõ 'ðõ "ðô 3°8¸_ÔMðð "Ð#5Ñ6ðñ aðõ ðñ ðñ 2ðõ  -ð!õ$ %ð%ð& "×/Ò/ð'ð(  +×AÒAÀ[×EVÑEVô)r   )Ú__doc__Ú
__future__r   Úgateway.platforms._sharedr   r   Úgateway.platforms.send_targetsr   Úadapterr   r   r   r   r(   rQ   rl   rq   r   r   r   Ú<module>rw      sj   ðñõ #å 6Ý <Ý ?ç 5ñ # ;Ð0BÓC€õ$ðÀ$ð ÐTXð Ø).ðØ8<ôõV5ðvið ÷r   