mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
🎨 使用 update.effective_message
获取消息
This commit is contained in:
parent
a2aa8fbdc9
commit
0e6125e3ee
@ -85,7 +85,7 @@ class DailyNote(Plugin, BasePlugin):
|
||||
@error_callable
|
||||
async def command_start(self, update: Update, context: CallbackContext) -> Optional[int]:
|
||||
user = update.effective_user
|
||||
message = update.message
|
||||
message = update.effective_message
|
||||
logger.info(f"用户 {user.full_name}[{user.id}] 查询游戏状态命令请求")
|
||||
try:
|
||||
client = await get_genshin_client(user.id)
|
||||
|
@ -52,7 +52,7 @@ class Gacha(Plugin, BasePlugin):
|
||||
@restricts(restricts_time=3, restricts_time_of_groups=20)
|
||||
@error_callable
|
||||
async def command_start(self, update: Update, context: CallbackContext) -> None:
|
||||
message = update.message
|
||||
message = update.effective_message
|
||||
user = update.effective_user
|
||||
args = get_all_args(context)
|
||||
gacha_name = "角色活动"
|
||||
|
@ -31,7 +31,7 @@ class Map(Plugin, BasePlugin):
|
||||
@error_callable
|
||||
@restricts(restricts_time=20)
|
||||
async def command_start(self, update: Update, context: CallbackContext):
|
||||
message = update.message
|
||||
message = update.effective_message
|
||||
args = context.args
|
||||
user = update.effective_user
|
||||
if not self.init_resource_map:
|
||||
|
@ -134,7 +134,7 @@ class Post(Plugin.Conversation, BasePlugin):
|
||||
async def delete_photo(self, update: Update, context: CallbackContext) -> int:
|
||||
post_handler_data: PostHandlerData = context.chat_data.get("post_handler_data")
|
||||
photo_len = len(post_handler_data.post_images)
|
||||
message = update.message
|
||||
message = update.effective_message
|
||||
await message.reply_text("请回复你要删除的图片的序列,从1开始,如果删除多张图片回复的序列请以空格作为分隔符,"
|
||||
f"当前一共有 {photo_len} 张图片")
|
||||
return GTE_DELETE_PHOTO
|
||||
|
@ -49,7 +49,7 @@ class SetQuizPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
||||
@error_callable
|
||||
async def command_start(self, update: Update, context: CallbackContext) -> int:
|
||||
user = update.effective_user
|
||||
message = update.message
|
||||
message = update.effective_message
|
||||
logger.info(f"用户 {user.full_name}[{user.id}] set_quiz命令请求")
|
||||
quiz_command_data: QuizCommandData = context.chat_data.get("quiz_command_data")
|
||||
if quiz_command_data is None:
|
||||
@ -144,10 +144,11 @@ class SetQuizPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
||||
@conversation.state(state=GET_NEW_QUESTION)
|
||||
@handler.message(filters=filters.TEXT & ~filters.COMMAND, block=True)
|
||||
async def get_new_question(self, update: Update, context: CallbackContext) -> int:
|
||||
message = update.effective_message
|
||||
quiz_command_data: QuizCommandData = context.chat_data.get("quiz_command_data")
|
||||
reply_text = f"问题:`{escape_markdown(update.message.text, version=2)}`\n" \
|
||||
f"请填写正确答案:"
|
||||
quiz_command_data.new_question = update.message.text
|
||||
quiz_command_data.new_question = message.text
|
||||
await update.message.reply_markdown_v2(reply_text)
|
||||
return GET_NEW_CORRECT_ANSWER
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user