Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- from aiogram import Bot, Dispatcher, executor, types
- API_TOKEN = 'Тут токен'
- PROXY_URL = 'socks5://104.248.63.17:30588/'
- # Configure logging
- logging.basicConfig(level=logging.INFO)
- # Initialize bot and dispatcher
- bot = Bot(token=API_TOKEN)
- dp = Dispatcher(bot)
- @dp.message_handler(regexp='(^cat[s]?$|puss)')
- async def cats(message: types.Message):
- with open('data/cats.jpg', 'rb') as photo:
- '''
- # Old fashioned way:
- await bot.send_photo(
- message.chat.id,
- photo,
- caption='Cats are here 😺',
- reply_to_message_id=message.message_id,
- )
- '''
- await message.reply_photo(photo, caption='Cats are here 😺')
- @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)
Advertisement
Add Comment
Please, Sign In to add comment