feat: Custom resend interval support

This commit is contained in:
LWR
2023-07-08 00:36:32 +08:00
parent 0eba95b52b
commit 6caa5340a0
2 changed files with 4 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ class Bot(BaseModel):
await self.__bot.send_friend_message(config.get("MASTER_QQ"), "补发队列为空~")
return
interval = config.get("RESEND_INTERVAL")
task_start_tip = f"补发任务已启动, 补发队列长度: {len(self.__queue)}"
logger.info(task_start_tip)
if config.get("MASTER_QQ"):
@@ -101,7 +102,7 @@ class Bot(BaseModel):
self.__banned = False
logger.info(f"{self.qq} -> 群[{msg_id}] : {message.safe_display}")
self.__queue.pop(0)
await asyncio.sleep(3)
await asyncio.sleep(interval)
except AccountMuted:
logger.warning(f"Bot({self.qq}) 在群 {msg_id} 中被禁言")
self.__queue.pop(0)

View File

@@ -119,6 +119,8 @@ DEFAULT_CONFIG = {
"BAN_RESEND": True,
# 启用风控消息补发时,被风控时是否继续尝试发送消息,关闭后,发生风控时,后续需要发送的消息将不再尝试发送,而是被直接暂存,需使用 ”补发“ 命令后恢复正常,用于防止风控期间频繁尝试发送消息导致更严重的冻结
"BAN_CONTINUE_SEND_MESSAGE": True,
# 补发每条消息的间隔时间,频率太快可能会被再次风控,建议设置为 3 秒以上,单位:秒
"RESEND_INTERVAL": 3,
# 风控发送失败消息滞留时间上限消息因风控滞留超出此时长不会进行补发0 为无限制,单位:秒
"RESEND_TIME_LIMIT": 0,
# 是否补发开播推送、下播推送、直播报告、动态推送中的 @全体成员 和 @群成员 消息,可能造成不必要的打扰,不推荐开启