Skip to content

Commit e9cdd4f

Browse files
committed
social.py: Readd token_bucket
1 parent fa80b68 commit e9cdd4f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/social.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import emoji_data
1919
import numpy as np
2020
import pymongo
21+
import token_bucket
2122
import pytz
2223
import yaml
2324
from discord import app_commands
@@ -38,6 +39,10 @@ def __init__(self, bot):
3839

3940
self.Games = self.bot.get_cog('Games')
4041

42+
# !profile ratelimits
43+
self.bucket_storage = token_bucket.MemoryStorage()
44+
self.profile_bucket = token_bucket.Limiter(1 / 30, 2, self.bucket_storage) # burst limit 2, renews at 1 / 30 s
45+
4146
# Add context menus to command tree
4247
self.profileContextMenu = app_commands.ContextMenu(
4348
name='View Profile Card', callback=self._profile_view, type=discord.AppCommandType.user

0 commit comments

Comments
 (0)