Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2024-02-11 23:03:14 +08:00 committed by GitHub
parent a2e45072f4
commit 131e420d49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 94 additions and 52 deletions

View file

@ -26,12 +26,19 @@ TOS_TEMPBAN_TIME = Config('tos_temp_ban_time', 300)
counter_same = {} # 命令使用次数计数(重复使用单一命令) counter_same = {} # 命令使用次数计数(重复使用单一命令)
counter_all = {} # 命令使用次数计数(使用所有命令) counter_all = {} # 命令使用次数计数(使用所有命令)
temp_ban_counter = {} # 临时限制计数 temp_ban_counter = {} # 临时封禁计数
async def remove_temp_ban(msg: Bot.MessageSession): async def check_temp_ban(msg: Bot.MessageSession):
is_temp_banned = temp_ban_counter.get(msg.target.sender_id) is_temp_banned = temp_ban_counter.get(msg.target.sender_id)
if is_temp_banned: if is_temp_banned:
ban_time = datetime.now().timestamp() - is_temp_banned['ts']
return int(TOS_TEMPBAN_TIME - ban_time)
else:
return False
async def remove_temp_ban(msg: Bot.MessageSession):
if await check_temp_ban(msg.target.sender_id):
del temp_ban_counter[msg.target.sender_id] del temp_ban_counter[msg.target.sender_id]
@ -63,10 +70,10 @@ async def temp_ban_check(msg: Bot.MessageSession):
if ban_time < TOS_TEMPBAN_TIME: if ban_time < TOS_TEMPBAN_TIME:
if is_temp_banned['count'] < 2: if is_temp_banned['count'] < 2:
is_temp_banned['count'] += 1 is_temp_banned['count'] += 1
return await msg.finish(msg.locale.t("tos.tempbanned", ban_time=str(int(TOS_TEMPBAN_TIME - ban_time)))) await msg.finish(msg.locale.t("tos.tempbanned", ban_time=int(TOS_TEMPBAN_TIME - ban_time)))
elif is_temp_banned['count'] <= 5: elif is_temp_banned['count'] <= 5:
is_temp_banned['count'] += 1 is_temp_banned['count'] += 1
return await msg.finish(msg.locale.t("tos.tempbanned.warning", ban_time=str(int(TOS_TEMPBAN_TIME - ban_time)))) await msg.finish(msg.locale.t("tos.tempbanned.warning", ban_time=int(TOS_TEMPBAN_TIME - ban_time)))
else: else:
raise AbuseWarning(msg.locale.t("tos.reason.bypass")) raise AbuseWarning(msg.locale.t("tos.reason.bypass"))

View file

@ -139,6 +139,7 @@ class BotDBUtil:
options = self.options.copy() options = self.options.copy()
if k in options: if k in options:
options.pop(k) options.pop(k)
options = json.dumps(options)
self.query.options = options self.query.options = options
session.commit() session.commit()
return True return True

View file

@ -65,10 +65,10 @@
"time.time.nosec.format": "%H:%M", "time.time.nosec.format": "%H:%M",
"tos.reason": "原因:", "tos.reason": "原因:",
"tos.reason.abuse": "一段時間內使用指令的次數過多。", "tos.reason.abuse": "一段時間內使用指令的次數過多。",
"tos.reason.bypass": "無視暫時停權警告。", "tos.reason.bypass": "無視暫時封鎖警告。",
"tos.reason.cooldown": "一段時間內使用相同指令的次數過多。", "tos.reason.cooldown": "一段時間內使用相同指令的次數過多。",
"tos.tempbanned": "提示:\n由於你的行為觸發了警告我們已對你暫時停權。\n距解除時間還有 ${ban_time} 秒。", "tos.tempbanned": "提示:\n由於你的行為觸發了警告我們已對你暫時封鎖。\n距解除時間還有 ${ban_time} 秒。",
"tos.tempbanned.warning": "提示:\n即使已被暫時停權,嘗試繼續濫用指令可能會導致你被再次警告。\n距解除時間還有 ${ban_time} 秒。", "tos.tempbanned.warning": "提示:\n即使已被暫時封鎖,嘗試繼續濫用指令可能會導致你被再次警告。\n距解除時間還有 ${ban_time} 秒。",
"tos.warning": "警告:\n依據使用條款你已違反我們的行為準則。", "tos.warning": "警告:\n依據使用條款你已違反我們的行為準則。",
"tos.warning.appeal": "如果你有任何異義,請至 ${issue_url} 發起問題。", "tos.warning.appeal": "如果你有任何異義,請至 ${issue_url} 發起問題。",
"tos.warning.count": "這是第 ${current_warns} 次警告。如超過 ${warn_counts} 次警告,我們將會把你的帳戶加入黑名單。", "tos.warning.count": "這是第 ${current_warns} 次警告。如超過 ${warn_counts} 次警告,我們將會把你的帳戶加入黑名單。",

View file

@ -34,11 +34,13 @@
"core.help.version": "View bot version.", "core.help.version": "View bot version.",
"core.help.whoami": "Get the ID of the user account that sent the command inside the bot.", "core.help.whoami": "Get the ID of the user account that sent the command inside the bot.",
"core.message.abuse.ban.success": "Successfully banned ${user}.", "core.message.abuse.ban.success": "Successfully banned ${user}.",
"core.message.abuse.check.banned": "(This user has been banned.)",
"core.message.abuse.check.tempbanned": "(This user has been temporary banned. ${ban_time} second(s) remaining until unban.)",
"core.message.abuse.check.warns": "${user} has been warned ${warns} time(s).", "core.message.abuse.check.warns": "${user} has been warned ${warns} time(s).",
"core.message.abuse.clear.success": "Successfully cleared warning for ${user}.", "core.message.abuse.clear.success": "Successfully cleared warning for ${user}.",
"core.message.abuse.revoke.success": "Successfully removed ${count} warning(s) for ${user}. This user has been warned ${warn_count} time(s).", "core.message.abuse.revoke.success": "Successfully removed ${count} warning(s) for ${user}. This user has been warned ${warn_count} time(s).",
"core.message.abuse.unban.success": "Successfully unbanned ${user}.", "core.message.abuse.unban.success": "Successfully unbanned ${user}.",
"core.message.abuse.untempban.success": "Successfully removed temporary limit on ${user}.", "core.message.abuse.untempban.success": "Successfully removed temporary ban on ${user}.",
"core.message.abuse.warn.success": "Successfully warned ${user} ${count} time(s). This user has been warned ${warn_count} time(s).", "core.message.abuse.warn.success": "Successfully warned ${user} ${count} time(s). This user has been warned ${warn_count} time(s).",
"core.message.admin.add.success": "Success: ${user} was set as bot administrator.", "core.message.admin.add.success": "Success: ${user} was set as bot administrator.",
"core.message.admin.already": "This member is already a bot administrator.", "core.message.admin.already": "This member is already a bot administrator.",
@ -156,10 +158,11 @@
"core.message.resume.nothing": "No messages to be resumed.", "core.message.resume.nothing": "No messages to be resumed.",
"core.message.resume.processing": "Resuming ${counts} message(s)...", "core.message.resume.processing": "Resuming ${counts} message(s)...",
"core.message.resume.skip": "Skip a message, resuming ${counts} message(s)...", "core.message.resume.skip": "Skip a message, resuming ${counts} message(s)...",
"core.message.set.confirm.init": "This group is not initialized. Are you sure you want to do it?", "core.message.set.confirm.init": "This target is not initialized. Are you sure you want to do it?",
"core.message.set.help.option.success": "The following parameters were set for the object: ${k} -> ${v}", "core.message.set.option.edit.success": "The following parameters were set for the target: ${kry} -> ${value}",
"core.message.set.invalid": "Invalid ID format.", "core.message.set.invalid": "Invalid ID format.",
"core.message.set.module.success": "The following modules were successfully configured for the object: ", "core.message.set.module.disable.success": "The following modules were successfully disabled for the target: ",
"core.message.set.module.enable.success": "The following modules were successfully enabled for the target: ",
"core.message.setup.check.disable": "Check prompt disabled.", "core.message.setup.check.disable": "Check prompt disabled.",
"core.message.setup.check.enable": "Check prompt enabled.", "core.message.setup.check.enable": "Check prompt enabled.",
"core.message.setup.timeoffset.invalid": "Invalid time offset.", "core.message.setup.timeoffset.invalid": "Invalid time offset.",

View file

@ -34,11 +34,13 @@
"core.help.version": "查看机器人的版本号。", "core.help.version": "查看机器人的版本号。",
"core.help.whoami": "获取发送命令的账号在机器人内部的 ID。", "core.help.whoami": "获取发送命令的账号在机器人内部的 ID。",
"core.message.abuse.ban.success": "成功封禁 ${user}。", "core.message.abuse.ban.success": "成功封禁 ${user}。",
"core.message.abuse.check.banned": "(此用户已被封禁。)",
"core.message.abuse.check.tempban": "(此用户已被临时封禁,距离解封时间还有 ${ban_time} 秒。)",
"core.message.abuse.check.warns": "${user} 已被警告 ${warns} 次。", "core.message.abuse.check.warns": "${user} 已被警告 ${warns} 次。",
"core.message.abuse.clear.success": "成功清除 ${user} 的警告。", "core.message.abuse.clear.success": "成功清除 ${user} 的警告。",
"core.message.abuse.revoke.success": "成功移除警告 ${user} 的 ${count} 次警告。此用户已被警告 ${warn_count} 次。", "core.message.abuse.revoke.success": "成功移除警告 ${user} 的 ${count} 次警告。此用户已被警告 ${warn_count} 次。",
"core.message.abuse.unban.success": "成功解除 ${user} 的封禁。", "core.message.abuse.unban.success": "成功解除 ${user} 的封禁。",
"core.message.abuse.untempban.success": "成功解除 ${user} 的临时限制。", "core.message.abuse.untempban.success": "成功解除 ${user} 的临时封禁。",
"core.message.abuse.warn.success": "成功警告 ${user} ${count} 次。此用户已被警告 ${warn_count} 次。", "core.message.abuse.warn.success": "成功警告 ${user} ${count} 次。此用户已被警告 ${warn_count} 次。",
"core.message.admin.add.success": "成功:已将 ${user} 设置为机器人管理员。", "core.message.admin.add.success": "成功:已将 ${user} 设置为机器人管理员。",
"core.message.admin.already": "此成员已是机器人管理员。", "core.message.admin.already": "此成员已是机器人管理员。",
@ -77,7 +79,7 @@
"core.message.help.legacy.base": "基础命令:", "core.message.help.legacy.base": "基础命令:",
"core.message.help.legacy.external": "模块扩展命令:", "core.message.help.legacy.external": "模块扩展命令:",
"core.message.help.legacy.more_information": "使用“${prefix}help <对应模块名>”查看详细信息。\n使用“${prefix}module list”查看所有的可用模块。", "core.message.help.legacy.more_information": "使用“${prefix}help <对应模块名>”查看详细信息。\n使用“${prefix}module list”查看所有的可用模块。",
"core.message.help.more_information": "此处展示的帮助文档仅展示已开启的模块,若需要查看全部模块的帮助文档,请使用“${prefix}module list”。", "core.message.help.more_information": "本框架由akari-bot驱动。本自搭建版本仅供已授权的群聊使用Bot生成内容与本bot开发者、服务器所有人无关亦不代表开发者或自搭建版本运维方立场。\n本分支项目维护代码地址https://github.com/TopRealm/akari-bot欢迎贡献模块。",
"core.message.help.more_information.document": "你也可以通过查阅在线文档获取帮助:\n${url}", "core.message.help.more_information.document": "你也可以通过查阅在线文档获取帮助:\n${url}",
"core.message.help.more_information.donate": "若你有经济实力,欢迎给孩子们在爱发电上打钱:\n${url}", "core.message.help.more_information.donate": "若你有经济实力,欢迎给孩子们在爱发电上打钱:\n${url}",
"core.message.help.not_found": "此模块可能不存在,请检查输入。", "core.message.help.not_found": "此模块可能不存在,请检查输入。",
@ -154,12 +156,13 @@
"core.message.resume.clear": "已清理全部消息。", "core.message.resume.clear": "已清理全部消息。",
"core.message.resume.done": "重发完成。", "core.message.resume.done": "重发完成。",
"core.message.resume.nothing": "没有需要重发的消息。", "core.message.resume.nothing": "没有需要重发的消息。",
"core.message.resume.processing": "正在重发 ${counts} 条消息…", "core.message.resume.processing": "正在重发 ${counts} 条消息……",
"core.message.resume.skip": "跳过一条消息,正在重发 ${counts} 条消息…", "core.message.resume.skip": "跳过一条消息,正在重发 ${counts} 条消息……",
"core.message.set.confirm.init": "该群未初始化,确认进行操作吗?", "core.message.set.confirm.init": "该目标未初始化,确认进行操作吗?",
"core.message.set.help.option.success": "成功为对象设置了以下参数:${k} -> ${v}",
"core.message.set.invalid": "ID 格式错误。", "core.message.set.invalid": "ID 格式错误。",
"core.message.set.module.success": "成功为对象配置了以下模块:", "core.message.set.module.disable.success": "成功为目标关闭了以下模块:",
"core.message.set.module.enable.success": "成功为目标打开了以下模块:",
"core.message.set.option.edit.success": "成功为目标设置了以下参数:${key} -> ${value}",
"core.message.setup.check.disable": "已关闭错字检查提示。", "core.message.setup.check.disable": "已关闭错字检查提示。",
"core.message.setup.check.enable": "已开启错字检查提示。", "core.message.setup.check.enable": "已开启错字检查提示。",
"core.message.setup.timeoffset.invalid": "无效的时间偏移量。", "core.message.setup.timeoffset.invalid": "无效的时间偏移量。",

View file

@ -34,11 +34,13 @@
"core.help.version": "檢視機器人的版本號。", "core.help.version": "檢視機器人的版本號。",
"core.help.whoami": "取得傳送指令的帳戶在機器人內部的 ID。", "core.help.whoami": "取得傳送指令的帳戶在機器人內部的 ID。",
"core.message.abuse.ban.success": "成功封鎖 ${user}。", "core.message.abuse.ban.success": "成功封鎖 ${user}。",
"core.message.abuse.check.banned": "(此使用者已被封鎖。)",
"core.message.abuse.check.tempbanned": "(此使用者已被暫時封鎖,距解除時間還有 ${ban_time} 秒。)",
"core.message.abuse.check.warns": "${user} 已被警告 ${warns} 次。", "core.message.abuse.check.warns": "${user} 已被警告 ${warns} 次。",
"core.message.abuse.clear.success": "成功移除 ${user} 的警告。", "core.message.abuse.clear.success": "成功移除 ${user} 的警告。",
"core.message.abuse.revoke.success": "成功移除警告 ${user} 的 ${count} 次警告。此使用者已被警告 ${warn_count} 次。", "core.message.abuse.revoke.success": "成功移除警告 ${user} 的 ${count} 次警告。此使用者已被警告 ${warn_count} 次。",
"core.message.abuse.unban.success": "成功解除 ${user} 的封鎖。", "core.message.abuse.unban.success": "成功解除 ${user} 的封鎖。",
"core.message.abuse.untempban.success": "成功移除 ${user} 的暫時限制。", "core.message.abuse.untempban.success": "成功移除 ${user} 的暫時封鎖。",
"core.message.abuse.warn.success": "成功警告 ${user} ${count} 次。此使用者已被警告 ${warn_count} 次。", "core.message.abuse.warn.success": "成功警告 ${user} ${count} 次。此使用者已被警告 ${warn_count} 次。",
"core.message.admin.add.success": "成功:已將 ${user} 設定為機器人管理員。", "core.message.admin.add.success": "成功:已將 ${user} 設定為機器人管理員。",
"core.message.admin.already": "此成員已是機器人管理員。", "core.message.admin.already": "此成員已是機器人管理員。",
@ -91,7 +93,7 @@
"core.message.leave.confirm": "此行為不可逆,你確定嗎?", "core.message.leave.confirm": "此行為不可逆,你確定嗎?",
"core.message.leave.success": "已執行,再見。", "core.message.leave.success": "已執行,再見。",
"core.message.locale": "目前使用的語言:${lang}", "core.message.locale": "目前使用的語言:${lang}",
"core.message.locale.contribute": "歡迎前往 Crowdin 協助翻譯:\n${url}", "core.message.locale.contribute": "歡迎前往協助翻譯:\n${url}",
"core.message.locale.langlist": "已支援的語言碼:${langlist}", "core.message.locale.langlist": "已支援的語言碼:${langlist}",
"core.message.locale.reload.failed": "以下字串重新加載失敗:\n${detail}", "core.message.locale.reload.failed": "以下字串重新加載失敗:\n${detail}",
"core.message.locale.set.invalid": "語言碼無效。", "core.message.locale.set.invalid": "語言碼無效。",
@ -154,12 +156,13 @@
"core.message.resume.clear": "已清理全部訊息。", "core.message.resume.clear": "已清理全部訊息。",
"core.message.resume.done": "重傳完成。", "core.message.resume.done": "重傳完成。",
"core.message.resume.nothing": "沒有需要重傳的訊息。", "core.message.resume.nothing": "沒有需要重傳的訊息。",
"core.message.resume.processing": "正在重傳 ${counts} 條訊息...", "core.message.resume.processing": "正在重傳 ${counts} 條訊息……",
"core.message.resume.skip": "跳過一條訊息,正在重傳 ${counts} 條訊息...", "core.message.resume.skip": "跳過一條訊息,正在重傳 ${counts} 條訊息……",
"core.message.set.confirm.init": "此群組未初始化,確認操作嗎?", "core.message.set.confirm.init": "此目標未初始化,確認操作嗎?",
"core.message.set.help.option.success": "成功為物件設定了以下參數:${k} -> ${v}",
"core.message.set.invalid": "ID 格式錯誤。", "core.message.set.invalid": "ID 格式錯誤。",
"core.message.set.module.success": "成功為物件配置了以下模組:", "core.message.set.module.disable.success": "成功為目標禁用了以下模組:",
"core.message.set.module.enable.success": "成功為目標啟用了以下模組:",
"core.message.set.option.edit.success": "成功為目標設定了以下參數:${key} -> ${value}",
"core.message.setup.check.disable": "已停用指令錯誤檢查提醒。", "core.message.setup.check.disable": "已停用指令錯誤檢查提醒。",
"core.message.setup.check.enable": "已啟用指令錯誤檢查提醒。", "core.message.setup.check.enable": "已啟用指令錯誤檢查提醒。",
"core.message.setup.timeoffset.invalid": "無效的時間偏移量。", "core.message.setup.timeoffset.invalid": "無效的時間偏移量。",

View file

@ -15,7 +15,7 @@ from core.component import module
from core.exceptions import NoReportException, TestException from core.exceptions import NoReportException, TestException
from core.loader import ModulesManager from core.loader import ModulesManager
from core.logger import Logger from core.logger import Logger
from core.parser.message import remove_temp_ban from core.parser.message import check_temp_ban, remove_temp_ban
from core.tos import pardon_user, warn_user from core.tos import pardon_user, warn_user
from core.utils.cache import random_cache_path from core.utils.cache import random_cache_path
from core.utils.info import Info from core.utils.info import Info
@ -166,7 +166,8 @@ async def _(msg: Bot.MessageSession):
set_ = module('set', required_superuser=True, base=True) set_ = module('set', required_superuser=True, base=True)
@set_.command('modules <target> <modules> ...') @set_.command('module enable <target> <modules> ...',
'module disable <target> <modules> ...')
async def _(msg: Bot.MessageSession, target: str): async def _(msg: Bot.MessageSession, target: str):
if not target.startswith(f'{msg.target.target_from}|'): if not target.startswith(f'{msg.target.target_from}|'):
await msg.finish(msg.locale.t("core.message.set.invalid")) await msg.finish(msg.locale.t("core.message.set.invalid"))
@ -177,12 +178,18 @@ async def _(msg: Bot.MessageSession, target: str):
await msg.finish() await msg.finish()
modules = [m for m in [msg.parsed_msg['<modules>']] + msg.parsed_msg.get('...', []) modules = [m for m in [msg.parsed_msg['<modules>']] + msg.parsed_msg.get('...', [])
if m in ModulesManager.return_modules_list(msg.target.target_from)] if m in ModulesManager.return_modules_list(msg.target.target_from)]
target_data.enable(modules) if 'enable' in msg.parsed_msg:
await msg.finish(msg.locale.t("core.message.set.module.success") + ", ".join(modules)) target_data.enable(modules)
await msg.finish(msg.locale.t("core.message.set.module.enable.success") + ", ".join(modules))
if 'disable' in msg.parsed_msg:
target_data.disable(modules)
await msg.finish(msg.locale.t("core.message.set.module.disable.success") + ", ".join(modules))
@set_.command('option <target> <k> <v>') @set_.command('option get <target> [<k>]',
async def _(msg: Bot.MessageSession, target: str, k: str, v: str): 'option edit <target> <k> <v>',
'option remove <target> <k>')
async def _(msg: Bot.MessageSession, target: str):
if not target.startswith(f'{msg.target.target_from}|'): if not target.startswith(f'{msg.target.target_from}|'):
await msg.finish(msg.locale.t("core.message.set.invalid")) await msg.finish(msg.locale.t("core.message.set.invalid"))
target_data = BotDBUtil.TargetInfo(target) target_data = BotDBUtil.TargetInfo(target)
@ -190,14 +197,36 @@ async def _(msg: Bot.MessageSession, target: str, k: str, v: str):
confirm = await msg.wait_confirm(msg.locale.t("core.message.set.confirm.init"), append_instruction=False) confirm = await msg.wait_confirm(msg.locale.t("core.message.set.confirm.init"), append_instruction=False)
if not confirm: if not confirm:
await msg.finish() await msg.finish()
if v.startswith(('[', '{')): if 'get' in msg.parsed_msg:
v = json.loads(v) k = msg.parsed_msg.get('<k>', None)
elif v.upper() == 'TRUE': await msg.finish(str(target_data.get_option(k)))
v = True elif 'edit' in msg.parsed_msg:
elif v.upper() == 'FALSE': k = msg.parsed_msg.get('<k>')
v = False v = msg.parsed_msg.get('<v>')
target_data.edit_option(k, v) if v.startswith(('[', '{')):
await msg.finish(msg.locale.t("core.message.set.help.option.success", k=k, v=v)) v = json.loads(v)
elif v.upper() == 'TRUE':
v = True
elif v.upper() == 'FALSE':
v = False
target_data.edit_option(k, v)
await msg.finish(msg.locale.t("core.message.set.option.edit.success", key=k, value=v))
elif 'remove' in msg.parsed_msg:
k = msg.parsed_msg.get('<k>')
target_data.remove_option(k)
await msg.finish(msg.locale.t("success"))
if Bot.client_name == 'QQ':
post_whitelist = module('post_whitelist', required_superuser=True, base=True)
@post_whitelist.command('<group_id>')
async def _(msg: Bot.MessageSession, group_id: str):
target_data = BotDBUtil.TargetInfo(group_id)
k = 'in_post_whitelist'
v = not target_data.options.get(k, False)
target_data.edit_option(k, v)
await msg.finish(msg.locale.t("core.message.set.option.edit.success", key=k, value=v))
ae = module('abuse', alias='ae', required_superuser=True, base=True) ae = module('abuse', alias='ae', required_superuser=True, base=True)
@ -205,10 +234,17 @@ ae = module('abuse', alias='ae', required_superuser=True, base=True)
@ae.command('check <user>') @ae.command('check <user>')
async def _(msg: Bot.MessageSession, user: str): async def _(msg: Bot.MessageSession, user: str):
stat = ''
if not user.startswith(f'{msg.target.sender_from}|'): if not user.startswith(f'{msg.target.sender_from}|'):
await msg.finish(msg.locale.t("core.message.set.invalid")) await msg.finish(msg.locale.t("core.message.set.invalid"))
warns = BotDBUtil.SenderInfo(user).query.warns warns = BotDBUtil.SenderInfo(user).query.warns
await msg.finish(msg.locale.t("core.message.abuse.check.warns", user=user, warns=warns)) temp_banned_time = await check_temp_ban(msg.target.sender_id)
is_banned = BotDBUtil.SenderInfo(user).query.isInBlockList
if temp_banned_time:
stat += '\n' + msg.locale.t("core.message.abuse.check.tempbanned", ban_time=temp_banned_time)
if is_banned:
stat += '\n' + msg.locale.t("core.message.abuse.check.banned")
await msg.finish(msg.locale.t("core.message.abuse.check.warns", user=user, warns=warns) + stat)
@ae.command('warn <user> [<count>]') @ae.command('warn <user> [<count>]')
@ -545,17 +581,6 @@ if Config('enable_petal'):
await msg.finish(msg.locale.t('core.message.petal.clear.self')) await msg.finish(msg.locale.t('core.message.petal.clear.self'))
if Bot.client_name == 'QQ':
post_whitelist = module('post_whitelist', required_superuser=True, base=True)
@post_whitelist.command('<group_id>')
async def _(msg: Bot.MessageSession, group_id: str):
target_data = BotDBUtil.TargetInfo(group_id)
k = 'in_post_whitelist'
v = not target_data.options.get(k, False)
target_data.edit_option(k, v)
await msg.finish(msg.locale.t("core.message.set.help.option.success", k=k, v=v))
lagrange = module('lagrange', required_superuser=True, base=True) lagrange = module('lagrange', required_superuser=True, base=True)
@lagrange.command() @lagrange.command()