Last active
December 27, 2020 11:49
-
-
Save vsecoder-old-account/93a846f1a5758f81eca6dc1a2fcefd64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# импорт модулей библиотеки aiogram | |
from aiogram import Bot, types | |
from aiogram.dispatcher import Dispatcher | |
from aiogram.utils import executor | |
# token бота | |
bot_token = '<token>' | |
# Создание бота | |
bot = Bot(token=bot_token) | |
dp = Dispatcher(bot) | |
# Обработчик команды /start | |
@dp.message_handler(commands=['start']) | |
async def welcome(message: types.Message): | |
await bot.send_message(message.chat.id, 'Здравствуйте!') | |
# всё что текст, но не /start повторить | |
@dp.message_handler(content_types=['text']) | |
async def reply(message: types.Message): | |
await bot.send_message(message.chat.id, message.text) | |
# запуск бота | |
if __name__ == "__main__": | |
executor.start_polling(dp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment