通过pyrogram
,get_history
,读取到对方机器人发送的如下message
,有没有方法可以通过pyrogram
的api
,模拟点击reply_markup
中的签到(checkin)
按钮?
以下的四个好像都不对,尤其是那个 query_id ,这个是发送方随机生成的吗(用来标识便于把结果和请求对应起来)?
await app.send_inline_bot_result(_id, message.chat.id, "checkin", reply_to_message_id=message.id, )
await message.reply_inline_bot_result(message.id, "checkin")
await message.edit_reply_markup(message.reply_markup.inline_keyboard[1][0])
await app.answer_callback_query(message.id, "checkin")
{
"_": "Message",
"id": 99075,
"from_user": {
"_": "User",
"id": *********,
"is_self": false,
"is_contact": false,
"is_mutual_contact": false,
"is_deleted": false,
"is_bot": true,
"is_verified": false,
"is_restricted": false,
"is_scam": false,
"is_fake": false,
"is_support": false,
"is_premium": false,
"first_name": "333",
"username": "******",
"dc_id": 5,
"photo": {
"_": "ChatPhoto",
"small_file_id": "AQADBQAEuDEbbLBJVQAQAgAD3e8ZlAEAA4qgtQNkdRPaAAQeBA",
"small_photo_unique_id": "AgAEuDEbbLBJVQ",
"big_file_id": "AQADBQAEuDEbbLBJVQAQAwAD3e8ZlAEAA4qgtQNkdRPaAAQeBA",
"big_photo_unique_id": "AgAEuDEbbLBJVQ"
}
},
"date": "2024-01-23 17:25:58",
"chat": {
"_": "Chat",
"id": *********,
"type": "ChatType.BOT",
"is_verified": false,
"is_restricted": false,
"is_scam": false,
"is_fake": false,
"is_support": false,
"username": "******",
"first_name": "333",
"photo": {
"_": "ChatPhoto",
"small_file_id": "AQADBQAEuDEbbLBJVQAQAgAD3e8ZlAEAA4qgtQNkdRPaAAQeBA",
"small_photo_unique_id": "AgAEuDEbbLBJVQ",
"big_file_id": "AQADBQAEuDEbbLBJVQAQAwAD3e8ZlAEAA4qgtQNkdRPaAAQeBA",
"big_photo_unique_id": "AgAEuDEbbLBJVQ"
},
"dc_id": 5
},
"mentioned": false,
"scheduled": false,
"from_scheduled": false,
"has_protected_content": false,
"text": "🌟请选择您要使用的功能",
"outgoing": false,
"reply_markup": {
"_": "InlineKeyboardMarkup",
"inline_keyboard": [
[
{
"_": "InlineKeyboardButton",
"text": "💰 [充值使用付费功能] ",
"callback_data": "recharge"
},
{
"_": "InlineKeyboardButton",
"text": "🤖 [ Bot 功能使用说明] ",
"callback_data": "guide"
}
],
[
{
"_": "InlineKeyboardButton",
"text": "🎁 [签到] ",
"callback_data": "checkin"
},
{
"_": "InlineKeyboardButton",
"text": "🌟 [个人信息] ",
"callback_data": "personal_info"
}
]
]
}
}
1
yaocf OP 找到了,可能是算是新手吧,api 文档中的 tg 专业名词太多了。
https://docs.pyrogram.org/api/methods/request_callback_answer 如题示例: ```python await app.request_callback_answer(_id, message.id, "checkin", 0) ``` 最后的 timeout 参数不知道该怎么填,不过效果已经达到了。 |