Minor refactor examples/text_filter_example.py and examples/throtling_example.py

This commit is contained in:
Suren Khorenyan 2019-08-11 21:59:56 +03:00
parent 8538e6af57
commit 94811c57e1
2 changed files with 8 additions and 5 deletions

View file

@ -4,7 +4,6 @@ Example for throttling manager.
You can use that for flood controlling.
"""
import asyncio
import logging
from aiogram import Bot, types
@ -13,14 +12,15 @@ from aiogram.dispatcher import Dispatcher
from aiogram.utils.exceptions import Throttled
from aiogram.utils.executor import start_polling
API_TOKEN = 'BOT TOKEN HERE'
API_TOKEN = 'BOT_TOKEN_HERE'
logging.basicConfig(level=logging.INFO)
bot = Bot(token=API_TOKEN)
# Throttling manager does not work without Leaky Bucket.
# Then need to use storages. For example use simple in-memory storage.
# You need to use a storage. For example use simple in-memory storage.
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage)