mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
nonebot2 beta 2适配
This commit is contained in:
parent
7b5ce09585
commit
c3e10342b2
@ -1,7 +1,5 @@
|
|||||||
import copy
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import numpy
|
import numpy
|
||||||
|
@ -94,13 +94,13 @@ class FreqLimiter:
|
|||||||
self.default_cd = default_cd_seconds
|
self.default_cd = default_cd_seconds
|
||||||
|
|
||||||
def check(self, key) -> bool:
|
def check(self, key) -> bool:
|
||||||
return bool(time.time() >= self.next_time[key])
|
return bool(time() >= self.next_time[key])
|
||||||
|
|
||||||
def start_cd(self, key, cd_time=0):
|
def start_cd(self, key, cd_time=0):
|
||||||
self.next_time[key] = time.time() + (cd_time if cd_time > 0 else self.default_cd)
|
self.next_time[key] = time() + (cd_time if cd_time > 0 else self.default_cd)
|
||||||
|
|
||||||
def left_time(self, key) -> int:
|
def left_time(self, key) -> int:
|
||||||
return int(self.next_time[key] - time.time()) + 1
|
return int(self.next_time[key] - time()) + 1
|
||||||
|
|
||||||
|
|
||||||
# 获取可用的cookie
|
# 获取可用的cookie
|
||||||
|
Loading…
Reference in New Issue
Block a user