Update docs

This commit is contained in:
Alex Root Junior 2020-11-08 00:54:56 +02:00
parent 36163690a5
commit 2870a4ca99
20 changed files with 42 additions and 79 deletions

27
examples/local_server.py Normal file
View file

@ -0,0 +1,27 @@
import logging
from aiogram import Bot, Dispatcher, executor, types
from aiogram.bot.api import TelegramAPIServer
from aiogram.types import ContentType
API_TOKEN = 'BOT TOKEN HERE'
# Configure logging
logging.basicConfig(level=logging.INFO)
# Create private Bot API server endpoints wrapper
local_server = TelegramAPIServer.from_base('http://localhost')
# Initialize bot with using local server
bot = Bot(token=API_TOKEN, server=local_server)
# ... and dispatcher
dp = Dispatcher(bot)
@dp.message_handler(content_types=ContentType.ANY)
async def echo(message: types.Message):
await message.copy_to(message.chat.id)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)