Skip to content

Instantly share code, notes, and snippets.

@Birdi7
Created August 24, 2019 13:20
Show Gist options
  • Save Birdi7/61190b0543fa9e4d590cc811ea35a800 to your computer and use it in GitHub Desktop.
Save Birdi7/61190b0543fa9e4d590cc811ea35a800 to your computer and use it in GitHub Desktop.
from aiogram import Bot, Dispatcher, executor
import logging
from aiogram.contrib.fsm_storage.memory import MemoryStorage
logging.basicConfig(level=logging.INFO)
token = 'BOT_TOKEN_HERE'
bot = Bot(token)
dp = Dispatcher(bot, storage=MemoryStorage())
@dp.message_handler(lambda m: True)
async def ha(msg):
is_throttled = await dp.throttle(key='ha', no_error=True, user=123)
if is_throttled:
pass
else:
pass
if __name__ == '__main__':
executor.start_polling(dp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment