最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Telegram Mini App: can't transfer data from mini app to bot - Stack Overflow

programmeradmin2浏览0评论

I am writing a bot for Telegram using the python-telegram-bot library. I am connecting mini app to it. The application starts and can even receive data from the bot, but for some reason the data does not pass in the opposite direction: tg.sendData is called in the mini application, but the message handler in the bot is not called.

Update: I've explored various examples and implementations of mini-apps and discovered that replacing InlineKeyboardButton with KeyboardButton and InlineKeyboardMarkup with ReplyKeyboardMarkup makes data transmission work. Does this mean that InlineKeyboardButton cannot be used to launch mini-apps? However, I’ve seen bots that launch mini-apps using InlineKeyboardButton. Does this imply that additional steps are required to make it work with inline buttons?

The bot code:

from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, WebAppInfo
from telegram.ext import Application, CommandHandler, MessageHandler, ContextTypes, filters
from telegram_token import TELEGRAM_TOKEN


async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    keyboard = [
        [InlineKeyboardButton(
            "
发布评论

评论列表(0)

  1. 暂无评论