首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Pyrogram:为游戏提供的回复标记为空(由“messages.SendMedia”引起)

Pyrogram:为游戏提供的回复标记为空(由“messages.SendMedia”引起)
EN

Stack Overflow用户
提问于 2022-02-22 06:26:43
回答 2查看 372关注 0票数 0

我正在用热图把一个html 5游戏发给我的朋友们。我创建了一个名为"popspike“的游戏,它来自@botfather,这是我的html 5游戏链接。下图是没有内联按钮的游戏示例。该按钮是自动生成的电报和按钮不是工作启动我的html 5游戏。

根据关于堆栈溢出的讨论提供文件手册,我们需要使用callback_query.answer(url="your website")来打开html 5游戏(popspike),所以我创建了一个内联按钮来调用查询数据。

代码语言:javascript
运行
复制
@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将我的游戏发送给用户时,我遇到了这个错误,所以我没有将游戏发送给用户。

代码语言:javascript
运行
复制
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,但是为什么电报说“游戏的回复标记是空的”?

我为这个漫长的问题道歉,因为我恐怕你无法理解我想问的问题。

希望你能帮我。谢谢。

EN

Stack Overflow用户

回答已采纳

发布于 2022-05-16 12:11:19

在第二段中这样做:

代码语言:javascript
运行
复制
@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()

票数 2
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71216766

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档