Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- from aiogram.types import Message
- from aiogram import Bot, Dispatcher
- token = '7462807969:AAGTsJa6NpVfTWeupQINXU3ZP4lNMrYAXtY'
- async def start_bot(bot: Bot):
- await bot.send_message(7462807969, text='Бот запущен')
- async def stop_bot(bot: Bot):
- await bot.send_message(7462807969, text='Бот остановлен')
- async def get_start(message: Message, bot: Bot):
- await bot.send_message(message.from_user.id, f'Привет {message.from_user.first_name}')
- await message.answer(f'Привет {message.from_user.first_name}')
- await message.reply(f'Привет {message.from_user.first_name}')
- async def start():
- bot = Bot(token=token)
- dp = Dispatcher()
- dp.startup.register(start_bot)
- dp.shutdown.register(stop_bot)
- dp.message.register(get_start)
- try:
- await dp.start_polling(bot)
- finally:
- await bot.session.close()
- if __name__ == "__main__":
- asyncio.run(start())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement