-
Notifications
You must be signed in to change notification settings - Fork 0
/
tgrtd_bot.py
37 lines (23 loc) · 1.02 KB
/
tgrtd_bot.py
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
27
28
29
30
31
32
33
34
35
36
37
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
import logging
from random import randint
from config import TOKEN
logging.basicConfig(level=logging.INFO)
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=["start"])
async def process_start_command(message: types.Message):
await message.reply("Привет!\nНапиши мне что-нибудь!")
@dp.message_handler(commands=["help"])
async def process_help_command(message: types.Message):
await message.reply("Напиши мне что-нибудь, и я отпрпавлю этот текст тебе в ответ!")
@dp.message_handler(commands=["roll", "r"])
async def process_roll_command(message: types.Message):
await bot.send_message(message.from_user.id, randint(1, 20))
@dp.message_handler()
async def echo_message(message: types.Message):
await bot.send_message(message.from_user.id, message.text)
if __name__ == "__main__":
executor.start_polling(dp)