我正在用热图把一个html 5游戏发给我的朋友们。我创建了一个名为"popspike“的游戏,它来自@botfather,这是我的html 5游戏链接。下图是没有内联按钮的游戏示例。该按钮是自动生成的电报和按钮不是工作启动我的html 5游戏。
根据关于堆栈溢出的讨论和提供文件手册,我们需要使用callback_query.answer(url="your website")
来打开html 5游戏(popspike),所以我创建了一个内联按钮来调用查询数据。
@app.on_message(filters.command("popspike"))
async def start_command(client, message): #send game to user & inline button send callback query
await message.reply_game('popspike'
,reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Play popspike",callback_data='test',callback_game=CallbackGame())]])) #reply markup is the error
@app.on_callback_query()
async def openquery(client, callback_query): #show text "hello" and open my html 5 game through `url` para
await callback_query.answer("Hello", show_alert=True, url='https://lmjaedentai.github.io/popspike')
但是当我想调用这个命令/popspike
将我的游戏发送给用户时,我遇到了这个错误,所以我没有将游戏发送给用户。
Telegram says: [400 REPLY_MARKUP_GAME_EMPTY] - The provided reply markup for the game is empty (caused by "messages.SendMedia")
Traceback (most recent call last):
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\dispatcher.py", line 222, in handler_worker
await handler.callback(self.client, *args)
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyromod\listen\listen.py", line 93, in resolve_listener
await self.user_callback(client, message, *args)
File "d:\Desktop\coding\discordpy\telegram\main.py", line 118, in start_command
await message.reply_game('popspike',reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Play poxpspike",callback_data='test',callback_game=CallbackGame())]]))
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\types\messages_and_media\message.py", line 1633, in reply_game
return await self._client.send_game(
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\methods\bots\send_game.py", line 74, in send_game
r = await self.send(
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\methods\advanced\send.py", line 77, in send
r = await self.session.send(
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\session\session.py", line 362, in send
return await self._send(data, timeout=timeout)
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\session\session.py", line 332, in _send
RPCError.raise_it(result, type(data))
File "D:\Desktop\coding\discordpy\env\lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.ReplyMarkupGameEmpty: Telegram says: [400 REPLY_MARKUP_GAME_EMPTY] - The provided reply markup for the game is empty (caused by "messages.SendMedia")
我确实在send_game
中提供了send_game
,但是为什么电报说“游戏的回复标记是空的”?
我为这个漫长的问题道歉,因为我恐怕你无法理解我想问的问题。
希望你能帮我。谢谢。
发布于 2022-05-16 12:11:19
在第二段中这样做:
@app.on_callback_query(filters.regex('test'))
async def openquery(client, callback_query): #show text "hello" and open my html 5 game through `url` para
await callback_query.answer("Hello", show_alert=True, url='https://lmjaedentai.github.io/popspike')
在filters.regex('test')
中给出参数@app.on_callback_query()
发布于 2022-02-22 06:59:38
必须准确地使用其中一个可选字段。
因此,尝试从按钮的构造中删除callback_data='test'
。
编辑:更准确地说,send_game
将自动向您的消息中添加这样的按钮。如果您希望附加一个以上的按钮,只需要手动附加一个键盘。在这种情况下,第一个按钮必须是带有callback_game=CallbackGame()
的按钮。
注意,对于这个按钮,不需要callback_data
来解析生成的CallbackQuery
。这是因为CallbackQuery.data
不会出现,但CallbackQuery.game_short_name
会出现。
官方电报文档的相应解释
InlineKeyboardButton
中的字段callback_game。您可以添加额外的按钮,根据口味:例如,关于规则的描述,或打开游戏的官方社区。https://stackoverflow.com/questions/71216766
复制相似问题