Advertisement
FanaticExplorer

test_local_server

Oct 17th, 2021
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import logging
  2.  
  3. from aiogram import Bot, Dispatcher, executor, types
  4. from aiogram.bot.api import TelegramAPIServer
  5. from aiogram.types import ContentType
  6.  
  7. API_TOKEN = '2051732171:AAE6SHQjqDipQLMQO9oqSJN_21ApjYD38R0'
  8.  
  9. logging.basicConfig(level=logging.INFO)
  10.  
  11. local_server = TelegramAPIServer.from_base('http://мой_айпи:3001')
  12.  
  13. bot = Bot(token=API_TOKEN, server=local_server)
  14. dp = Dispatcher(bot)
  15.  
  16.  
  17. @dp.message_handler(content_types=ContentType.ANY)
  18. async def echo(message: types.Message):
  19.     await message.copy_to(message.chat.id)
  20.  
  21.  
  22. executor.start_polling(dp, skip_updates=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement