Skip to content

Commit

Permalink
Update handlers.py
Browse files Browse the repository at this point in the history
Signed-off-by: ˹ᴧɴσɴʏᴍσᴜs ꭙ˼ <TheAnonymousX1025@gmail.com>
  • Loading branch information
AnonymousX1025 authored Oct 2, 2023
1 parent 372cf60 commit 11c53bd
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions FallenRobot/modules/helper_funcs/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
BucketFullException,
Duration,
Limiter,
MemoryListBucket,
RequestRate,
Rate,
)
from telegram import Update
from telegram.ext import CommandHandler, Filters, MessageHandler, RegexHandler
Expand All @@ -28,17 +27,12 @@ def __init__(self):
)
# Values are HIGHLY experimental, its recommended you pay attention to our commits as we will be adjusting the values over time with what suits best.
Duration.CUSTOM = 15 # Custom duration, 15 seconds
self.sec_limit = RequestRate(6, Duration.CUSTOM) # 6 / Per 15 Seconds
self.min_limit = RequestRate(20, Duration.MINUTE) # 20 / Per minute
self.hour_limit = RequestRate(100, Duration.HOUR) # 100 / Per hour
self.daily_limit = RequestRate(1000, Duration.DAY) # 1000 / Per day
self.limiter = Limiter(
self.sec_limit,
self.min_limit,
self.hour_limit,
self.daily_limit,
bucket_class=MemoryListBucket,
)
self.sec_limit = Rate(6, Duration.CUSTOM) # 6 / Per 15 Seconds
self.min_limit = Rate(20, Duration.MINUTE) # 20 / Per minute
self.hour_limit = Rate(100, Duration.HOUR) # 100 / Per hour
self.daily_limit = Rate(1000, Duration.DAY) # 1000 / Per day
self.rates = [self.sec_limit, self.min_limit, self.hour_limit, self.daily_limit]
self.limiter = Limiter(self.rates)

def check_user(self, user):
"""
Expand Down

0 comments on commit 11c53bd

Please sign in to comment.