我如何在电信机器人中添加菜单按钮

发布于 2025-02-06 14:46:07 字数 215 浏览 2 评论 0 原文

如何使用 telegraf

菜单按钮 在电报机器人中添加菜单按钮

how can I add Menu button in telegram bot using telegraf

menu button like this
Menu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

想挽留 2025-02-13 14:46:07

您可以通过两种方式实现这一目标。通过

You can achieve this in two ways. Either by

摇划花蜜的午后 2025-02-13 14:46:07

我通过添加一个新框架创建菜单按钮“ grammy

首先安装grammy: npm npm install grammy

const { Bot } = require("grammy");
const bot = new Bot(BOT_TOKEN); // <-- place your bot token in this string

bot.api.setMyCommands([
{ command: "start", description: "إبدأ من جديد" },
{ command: "help", description: "طلب مساعدة " },
{ command: "list", description: "القائمة " },
]);

I create a menu button by add a new framework " Grammy "

first install grammy : npm install grammy

seconde add this code :

const { Bot } = require("grammy");
const bot = new Bot(BOT_TOKEN); // <-- place your bot token in this string

create list of commands :

bot.api.setMyCommands([
{ command: "start", description: "إبدأ من جديد" },
{ command: "help", description: "طلب مساعدة " },
{ command: "list", description: "القائمة " },
]);
暖心男生 2025-02-13 14:46:07

如果您在这里打开该按钮的Mini-App, /setCommands是错误的方法。

这是您可以从电报启动应用程序的方式

/mybots
select your bot
Bot Settings
Menu Button

,然后添加您的URL和按钮的titter

open telegram mini app from telegram bot

If you're here to open your mini-app from that button, /setcommands is the wrong way to achieve that.

Here is how you can launch apps from telegram both

/mybots
select your bot
Bot Settings
Menu Button

Then add your url and tittle of your button

多像笑话 2025-02-13 14:46:07

为简单起见,您可以使用Botfather并将其直接从那里设置。

  1. 打开botfather- https://t.me/botfather
  2. 发送命令/setCommands

For simplicity, you can use BotFather and set it directly from there.

  1. Open BotFather - https://t.me/BotFather
  2. send him the command /setcommands

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文