Closed rust1122 closed 6 months ago
I cannot reproduce this. The following code works perfectly fine for me:
const bot = new Bot("<token>");
bot.on("message", async (ctx) => {
await ctx.reply("okay", {
reply_markup: new InlineKeyboard().add(
InlineKeyboard.webApp("web", "https://127.0.0.1:5173/"),
),
});
});
bot.start();
You must be doing something else wrong.
I cannot reproduce this. The following code works perfectly fine for me:
const bot = new Bot("<token>"); bot.on("message", async (ctx) => { await ctx.reply("okay", { reply_markup: new InlineKeyboard().add( InlineKeyboard.webApp("web", "https://127.0.0.1:5173/"), ), }); }); bot.start();
You must be doing something else wrong.
yeah i did recive the right menu in this repaly way. but when i try send menu proactive,not in a ctx, like bot.api.sendMessage
, it cant work well
today when i run code, i found an other error in line
GrammyError: Call to 'sendMessage' failed! (400: Bad Request: group chat was upgraded to a supergroup chat)
,
my code is
bot.start();
const inlineKeyboard = new InlineKeyboard().add(
InlineKeyboard.webApp('web', 'https://127.0.0.1:5173/')
)
bot.api.sendMessage('id', 'send a menu', {
reply_markup: inlineKeyboard
})
not in a ctx, like
bot.api.sendMessage
, it cant work well
It works the exact same way. You probably just try to send the menu to a chat where mini apps are not supported.
today when i run code, i found an other error in line
GrammyError: Call to 'sendMessage' failed! (400: Bad Request: group chat was upgraded to a supergroup chat)
, my code isbot.start(); const inlineKeyboard = new InlineKeyboard().add( InlineKeyboard.webApp('web', 'https://127.0.0.1:5173/') ) bot.api.sendMessage('id', 'send a menu', { reply_markup: inlineKeyboard })
You cannot send messages to that chat anymore. You need to send it to the corresponding supergroup.
send the menu to a chat where mini apps are not supported.
sorry but how judge min apps are not supported in a group, i send it to a group chat which are built by myself, and i take the bot in and set it all adminitor rights, but it still faill, there is the debugger info
composer.js:56:9 {
method: 'sendMessage',
payload: {
chat_id: -1002062964288,
text: 'okay',
reply_markup: [InlineKeyboard]
},
ok: false,
error_code: 400,
description: 'Bad Request: BUTTON_TYPE_INVALID',
parameters: {}
},
ctx: Context {
update: { update_id: 301699273, message: [Object] },
api: Api { raw: {}, config: [Object] },
me: {
id: 6880774341,
is_bot: true,
first_name: 'WebTest',
username: 'WebTestbot',
can_join_groups: true,
can_read_all_group_messages: false,
supports_inline_queries: false
}
},
name: 'BotError'
}
i guss the error is about tg config and setting but i dont kown how config it :(
Did you read https://core.telegram.org/bots/api#inlinekeyboardbutton yet? You are not able to send web apps in group chats, ever.
Did you read https://core.telegram.org/bots/api#inlinekeyboardbutton yet? You are not able to send web apps in group chats, ever.
sorry i miss this part, i will check the detail in this doc. thx a lot for helping
This seems solved, feel free to reopen otherwise
i want send a message that inlineboard contain a webapp, grammy get wrong
my code is:
when i run code, console said:
i found there is a api in https://deno.land/x/grammy@v1.21.1/mod.ts?s=InlineKeyboard&p=webApp, how i solve this