nonebot2 beta 2适配

This commit is contained in:
CMHopeSunshine 2022-04-30 14:43:49 +08:00
parent 7b5ce09585
commit c3e10342b2
2 changed files with 3 additions and 5 deletions

View File

@ -1,7 +1,5 @@
import copy
import json
import os
from pathlib import Path
import datetime
import numpy

View File

@ -94,13 +94,13 @@ class FreqLimiter:
self.default_cd = default_cd_seconds
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):
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:
return int(self.next_time[key] - time.time()) + 1
return int(self.next_time[key] - time()) + 1
# 获取可用的cookie