From e94a452e6e91865c9d965bce0a3488b051be6cde Mon Sep 17 00:00:00 2001 From: robot_nian <2660422452@qq.com> Date: Fri, 13 May 2022 00:37:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A6=81=E8=A8=80API?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEtimeout=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/db.py | 2 +- flow/operate.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dao/db.py b/dao/db.py index 9a444f0..2e81ff0 100644 --- a/dao/db.py +++ b/dao/db.py @@ -26,7 +26,7 @@ def __init__(self, host, db, user, password, port=3306): :param port:数据库端口 :param db:库名 :param user:用户名 - :param passwd:密码 + :param password:密码 :param charset:字符编码 """ self.host = host diff --git a/flow/operate.py b/flow/operate.py index 6af10b9..a429e30 100644 --- a/flow/operate.py +++ b/flow/operate.py @@ -1,20 +1,18 @@ -from datetime import datetime, date, timedelta - -from constant import config - import qqbot from qqbot.model.mute import MuteOption +from constant import config + APPID = config["token"]["appid"] TOKEN = config["token"]["token"] GUILD_ID = config["params"]["guildId"] async def mute_all(): - mute_api = qqbot.AsyncMuteAPI(qqbot.Token(APPID, TOKEN), False).with_timeout(5) + mute_api = qqbot.AsyncMuteAPI(qqbot.Token(APPID, TOKEN), False, timeout=5) await mute_api.mute_all(GUILD_ID, MuteOption(mute_seconds=str(8 * 3600))) async def end_mute_all(): - mute_api = qqbot.AsyncMuteAPI(qqbot.Token(APPID, TOKEN), False).with_timeout(5) + mute_api = qqbot.AsyncMuteAPI(qqbot.Token(APPID, TOKEN), False, timeout=5) await mute_api.mute_all(GUILD_ID, MuteOption(mute_seconds='0'))