1import logging
2
3from aiogram import Bot, Dispatcher, executor, types
4from aiogram.bot.api import TelegramAPIServer
5from aiogram.types import ContentType
6
7API_TOKEN = 'BOT TOKEN HERE'
8
9# Configure logging
10logging.basicConfig(level=logging.INFO)
11
12# Create private Bot API server endpoints wrapper
13local_server = TelegramAPIServer.from_base('http://localhost')
14
15# Initialize bot with using local server
16bot = Bot(token=API_TOKEN, server=local_server)
17# ... and dispatcher
18dp = Dispatcher(bot)
19
20
21@dp.message_handler(content_types=ContentType.ANY)
22async def echo(message: types.Message):
23 await message.copy_to(message.chat.id)
24
25
26if __name__ == '__main__':
27 executor.start_polling(dp, skip_updates=True)