-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# The source of the "https://pytelegrambotminiapp.vercel.app" can be found in https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/mini_app_web | ||
|
||
import asyncio | ||
from telebot.async_telebot import AsyncTeleBot | ||
from telebot.types import ( | ||
ReplyKeyboardMarkup, | ||
KeyboardButton, | ||
WebAppInfo, | ||
InlineKeyboardMarkup, | ||
InlineKeyboardButton | ||
) | ||
|
||
BOT_TOKEN = "" | ||
WEB_URL = "https://pytelegrambotminiapp.vercel.app" | ||
|
||
bot = AsyncTeleBot(BOT_TOKEN) | ||
|
||
@bot.message_handler(commands=["start"]) | ||
async def start(message): | ||
reply_keyboard_markup = ReplyKeyboardMarkup(resize_keyboard=True) | ||
reply_keyboard_markup.row(KeyboardButton("Start MiniApp", web_app=WebAppInfo(WEB_URL))) | ||
|
||
inline_keyboard_markup = InlineKeyboardMarkup() | ||
inline_keyboard_markup.row(InlineKeyboardButton('Start MiniApp', web_app=WebAppInfo(WEB_URL))) | ||
|
||
await bot.reply_to(message, "Click the bottom inline button to start MiniApp", reply_markup=inline_keyboard_markup) | ||
await bot.reply_to(message, "Click keyboard button to start MiniApp", reply_markup=reply_keyboard_markup) | ||
|
||
@bot.message_handler(content_types=['web_app_data']) | ||
async def web_app(message): | ||
await bot.reply_to(message, f'Your message is "{message.web_app_data.data}"') | ||
|
||
asyncio.run(bot.polling()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.