Skip to content

Instantly share code, notes, and snippets.

@bottifyDev
Created February 1, 2023 21:11
Show Gist options
  • Save bottifyDev/0d075159e444697feb2aa6504512ee32 to your computer and use it in GitHub Desktop.
Save bottifyDev/0d075159e444697feb2aa6504512ee32 to your computer and use it in GitHub Desktop.
"""
Стартовый бот
"""
import logging
from aiogram import Bot, Dispatcher, executor, types
API_TOKEN = 'BOT TOKEN HERE'
# Configure logging
logging.basicConfig(level=logging.INFO)
# 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("Hi!\nI'm EchoBot!\nPowered by aiogram.")
@dp.message_handler()
async def echo(message: types.Message):
# old style:
# await bot.send_message(message.chat.id, message.text)
await message.answer(message.text)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment