Skip to content

Commit 6f0914d

Browse files
committed
antiflood impr 1
1 parent 35cccce commit 6f0914d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ alt="vtffijuUg5Y" width="240" height="180" border="10" /></a>
5050
- [x] Readme.md
5151
- [x] QR-code scanner
5252
- [ ] Analytics
53-
- [ ] Rate limit
53+
- [x] Rate limit
5454
- [ ] Inline buttons
5555
- [ ] Improved structure
5656
- [ ] Middlewares

bot/middlewares/antiflood.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ async def message_throttled(self, message: types.Message, throttled: Throttled):
123123

124124
# Prevent flooding
125125

126-
if throttled.exceeded_count <= 2:
127-
await message.reply("Too many requests! ")
126+
# if throttled.exceeded_count <= 2:
127+
# await message.reply("Too many requests! ")
128128

129129
# Sleep.
130130

131131
await asyncio.sleep(delta)
132132

133133
# Check lock status
134134

135-
thr = await dispatcher.check_key(key)
135+
# thr = await dispatcher.check_key(key)
136136

137137
# If current message is not last with current key - do not send message
138138

139-
if thr.exceeded_count == throttled.exceeded_count:
140-
await message.reply("Unlocked.")
139+
# if thr.exceeded_count == throttled.exceeded_count:
140+
# pass

0 commit comments

Comments
 (0)