add bot
This commit is contained in:
commit
8d6d1ffb1d
37
bot.py
Normal file
37
bot.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
from aiogram import Bot, Dispatcher, executor, types
|
||||||
|
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
# Initialize bot and dispatcher
|
||||||
|
bot = Bot(token=API_TOKEN)
|
||||||
|
dp = Dispatcher(bot)
|
||||||
|
@dp.message_handler(commands=['start', 'help'])
|
||||||
|
async def send_welcome(message: types.Message):
|
||||||
|
"""
|
||||||
|
This handler will be called when user sends `/start` or `/help` command
|
||||||
|
"""
|
||||||
|
await message.reply("Дарова пидорас!")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@dp.message_handler()
|
||||||
|
async def echo(message: types.Message):
|
||||||
|
# old style:
|
||||||
|
# await bot.send_message(message.chat.id, message.text)
|
||||||
|
|
||||||
|
if 'привет' in message.text:
|
||||||
|
await message.answer('pidor')
|
||||||
|
else:
|
||||||
|
await message.answer(message.text)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
executor.start_polling(dp, skip_updates=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
executor.start_polling(dp, skip_updates=True)
|
Loading…
Reference in New Issue
Block a user