Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. # -*- coding: utf8 -*-
  2. from aiogram import Bot, types
  3. from aiogram.dispatcher import Dispatcher
  4. from aiogram.utils import executor
  5.  
  6. from config import TOKEN
  7.  
  8.  
  9. bot = Bot(token=TOKEN)
  10. dp = Dispatcher(bot)
  11.  
  12.  
  13. @dp.message_handler(commands=['start'])
  14. async def process_start_command(message: types.Message):
  15. await message.reply("Привет!\nНапиши мне что-нибудь!")
  16.  
  17.  
  18. @dp.message_handler(commands=['help'])
  19. async def process_help_command(message: types.Message):
  20. await message.reply("Напиши мне что-нибудь, и я отпрпавлю этот текст тебе в ответ!")
  21.  
  22.  
  23. @dp.message_handler()
  24. async def echo_message(msg: types.Message):
  25. await bot.send_message(msg.from_user.id, msg.text)
  26.  
  27.  
  28. if __name__ == '__main__':
  29. executor.start_polling(dp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement