Create bot.py
Browse files
bot.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import os
|
| 3 |
+
from aiogram import Bot, Dispatcher, types
|
| 4 |
+
from aiogram.filters import Command
|
| 5 |
+
from aiogram.enums import ParseMode
|
| 6 |
+
from aiogram.client.default import DefaultBotProperties
|
| 7 |
+
from aiogram.types import WebAppInfo
|
| 8 |
+
from dotenv import load_dotenv
|
| 9 |
+
|
| 10 |
+
load_dotenv()
|
| 11 |
+
BOT_TOKEN = os.getenv("BOT_TOKEN")
|
| 12 |
+
|
| 13 |
+
bot = Bot(token=BOT_TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
|
| 14 |
+
dp = Dispatcher()
|
| 15 |
+
|
| 16 |
+
@dp.message(Command("start"))
|
| 17 |
+
async def start_handler(message: types.Message):
|
| 18 |
+
kb = [[
|
| 19 |
+
types.InlineKeyboardButton(
|
| 20 |
+
text="🛠 Rename a File",
|
| 21 |
+
web_app=WebAppInfo(url="https://file-renamer-ui.vercel.app")
|
| 22 |
+
)
|
| 23 |
+
]]
|
| 24 |
+
await message.answer("Click below to rename a file", reply_markup=types.InlineKeyboardMarkup(inline_keyboard=kb))
|
| 25 |
+
|
| 26 |
+
async def main():
|
| 27 |
+
await dp.start_polling(bot)
|
| 28 |
+
|
| 29 |
+
if __name__ == "__main__":
|
| 30 |
+
asyncio.run(main())
|