Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
f872943
1
Parent(s):
cc7b19b
Update flood.py
Browse fileswill resolve the error `RuntimeError`
- Powers/plugins/flood.py +10 -8
Powers/plugins/flood.py
CHANGED
@@ -350,15 +350,17 @@ async def flood_watcher(c: Gojo, m: Message):
|
|
350 |
if not len(dic):
|
351 |
z = {c_id : {u_id : [[],[]]}}
|
352 |
dic.update(z)
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
|
|
362 |
sec = round(time.time())
|
363 |
try:
|
364 |
dic[c_id][u_id][0].append(sec)
|
|
|
350 |
if not len(dic):
|
351 |
z = {c_id : {u_id : [[],[]]}}
|
352 |
dic.update(z)
|
353 |
+
try:
|
354 |
+
dic[c_id] # access and check weather the c_id present or not
|
355 |
+
except KeyError:
|
356 |
+
z = {c_id : {u_id : [[],[]]}}
|
357 |
+
dic.update(z)
|
358 |
|
359 |
+
try:
|
360 |
+
dic[c_id][u_id]
|
361 |
+
except KeyError:
|
362 |
+
z = {u_id : [[],[]]}
|
363 |
+
dic[c_id].update(z) # make the dic something like {c_id : {u_id : [[for time],[for msg]]}}
|
364 |
sec = round(time.time())
|
365 |
try:
|
366 |
dic[c_id][u_id][0].append(sec)
|