-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelegram_bot.py
More file actions
26 lines (19 loc) · 874 Bytes
/
telegram_bot.py
File metadata and controls
26 lines (19 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from aiogram.types.web_app_info import WebAppInfo
API_TOKEN = "TOKEN"
WEB_PAGE = "DOMAINE NAME"
bot = Bot(API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=["start"])
async def start(message: types.Message):
button = InlineKeyboardMarkup()
button.add(InlineKeyboardButton("Open", web_app=WebAppInfo(url=WEB_PAGE)))
await message.answer("Hello!", reply_markup=button)
@dp.message_handler(commands=["photo"])
async def photo(message: types.Message):
button = InlineKeyboardMarkup()
button.add(InlineKeyboardButton("Open", web_app=WebAppInfo(url=f"{WEB_PAGE}photos")))
await message.answer("There is your photos!", reply_markup=button)
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)