🎨 修改部分命令并更新 help 命令列表

This commit is contained in:
洛水居室 2022-09-08 09:49:44 +08:00
parent 8f424bf0d4
commit 84a06e915b
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
3 changed files with 13 additions and 9 deletions

View File

@ -32,15 +32,15 @@ class AddUserCommandData(TelegramObject):
CHECK_SERVER, CHECK_COOKIES, COMMAND_RESULT = range(10100, 10103) CHECK_SERVER, CHECK_COOKIES, COMMAND_RESULT = range(10100, 10103)
class AddUser(Plugin.Conversation, BasePlugin.Conversation): class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
"""用户绑定""" """Cookie绑定"""
def __init__(self, user_service: UserService = None, cookies_service: CookiesService = None): def __init__(self, user_service: UserService = None, cookies_service: CookiesService = None):
self.cookies_service = cookies_service self.cookies_service = cookies_service
self.user_service = user_service self.user_service = user_service
@conversation.entry_point @conversation.entry_point
@handler.command(command='adduser', filters=filters.ChatType.PRIVATE, block=True) @handler.command(command='setcookies', filters=filters.ChatType.PRIVATE, block=True)
@restricts() @restricts()
@error_callable @error_callable
async def command_start(self, update: Update, context: CallbackContext) -> int: async def command_start(self, update: Update, context: CallbackContext) -> int:

View File

@ -28,7 +28,7 @@ class AddUserCommandData(TelegramObject):
CHECK_SERVER, CHECK_UID, COMMAND_RESULT = range(10100, 10103) CHECK_SERVER, CHECK_UID, COMMAND_RESULT = range(10100, 10103)
class SetUid(Plugin.Conversation, BasePlugin.Conversation): class SetUserUid(Plugin.Conversation, BasePlugin.Conversation):
"""UID用户绑定""" """UID用户绑定"""
def __init__(self, user_service: UserService = None, cookies_service: CookiesService = None, def __init__(self, user_service: UserService = None, cookies_service: CookiesService = None,
@ -38,7 +38,7 @@ class SetUid(Plugin.Conversation, BasePlugin.Conversation):
self.user_service = user_service self.user_service = user_service
@conversation.entry_point @conversation.entry_point
@handler.command(command='set_uid', filters=filters.ChatType.PRIVATE, block=True) @handler.command(command='setuid', filters=filters.ChatType.PRIVATE, block=True)
@restricts() @restricts()
@error_callable @error_callable
async def command_start(self, update: Update, context: CallbackContext) -> int: async def command_start(self, update: Update, context: CallbackContext) -> int:
@ -49,7 +49,8 @@ class SetUid(Plugin.Conversation, BasePlugin.Conversation):
if add_user_command_data is None: if add_user_command_data is None:
cookies_command_data = AddUserCommandData() cookies_command_data = AddUserCommandData()
context.chat_data["add_uid_command_data"] = cookies_command_data context.chat_data["add_uid_command_data"] = cookies_command_data
text = f'你好 {user.mention_markdown_v2()} {escape_markdown("!请选择要绑定的服务器!或回复退出取消操作")}' text = f'你好 {user.mention_markdown_v2()} ' \
f'{escape_markdown("本次绑定只绑定UID未绑定Cookies部分功能无法使用。请选择要绑定的服务器或回复退出取消操作")}'
reply_keyboard = [['米游社', 'HoYoLab'], ["退出"]] reply_keyboard = [['米游社', 'HoYoLab'], ["退出"]]
await message.reply_markdown_v2(text, reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)) await message.reply_markdown_v2(text, reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True))
return CHECK_SERVER return CHECK_SERVER

View File

@ -115,10 +115,13 @@
派蒙的十万个为什么 派蒙的十万个为什么
</div> </div>
</div> </div>
<div class="command"> <div class="command">
<div class="command-name">/adduser</div> <div class="command-name">/setuid</div>
<div class="command-description">添加账号请私聊BOT</div> <div class="command-description">添加UID请私聊BOT</div>
</div>
<div class="command">
<div class="command-name">/setcookies</div>
<div class="command-description">添加Cookies请私聊BOT</div>
</div> </div>
<div class="command rounded-xl flex-1"> <div class="command rounded-xl flex-1">
<div class="command-name">/cancel</div> <div class="command-name">/cancel</div>