mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Minor refactor examples/text_filter_example.py and examples/throtling_example.py
This commit is contained in:
parent
8538e6af57
commit
94811c57e1
2 changed files with 8 additions and 5 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue