Skip to content

Instantly share code, notes, and snippets.

@vsecoder-old-account
Last active December 27, 2020 11:49
Show Gist options
  • Save vsecoder-old-account/93a846f1a5758f81eca6dc1a2fcefd64 to your computer and use it in GitHub Desktop.
Save vsecoder-old-account/93a846f1a5758f81eca6dc1a2fcefd64 to your computer and use it in GitHub Desktop.
# -*- 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