Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
8d76755
1
Parent(s):
0b9159c
Update flood_db.py
Browse files- Powers/database/flood_db.py +15 -8
Powers/database/flood_db.py
CHANGED
@@ -26,14 +26,21 @@ class Floods(MongoDB):
|
|
26 |
curr = self.find_one({"chat_id": chat_id})
|
27 |
if curr:
|
28 |
if not(limit == int(curr['limit']) and within == int(curr['within']) and action == str(curr['action'])):
|
29 |
-
|
30 |
-
|
31 |
-
"chat_id": chat_id,
|
32 |
-
"limit": limit
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
return self.insert_one(
|
38 |
{
|
39 |
"chat_id" : chat_id,
|
|
|
26 |
curr = self.find_one({"chat_id": chat_id})
|
27 |
if curr:
|
28 |
if not(limit == int(curr['limit']) and within == int(curr['within']) and action == str(curr['action'])):
|
29 |
+
if limit != int(curr['limit'])
|
30 |
+
return self.update(
|
31 |
+
{"chat_id": chat_id,"within": within,"action": action},
|
32 |
+
{"limit": limit}
|
33 |
+
)
|
34 |
+
elif within != int(curr['within']):
|
35 |
+
return self.update(
|
36 |
+
{"chat_id": chat_id,"limit": limit,"action": action},
|
37 |
+
{"within": within}
|
38 |
+
)
|
39 |
+
elif action != str(curr['action']):
|
40 |
+
return self.update(
|
41 |
+
{"chat_id": chat_id,"limit": limit,"within": within},
|
42 |
+
{"action": action}
|
43 |
+
)
|
44 |
return self.insert_one(
|
45 |
{
|
46 |
"chat_id" : chat_id,
|