From a50fe35ed0db2c3e7bbacc3faa79b5a73bca168b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=B4=E8=B2=93?= Date: Thu, 29 Aug 2024 17:30:52 +0800 Subject: [PATCH] Update mc.py --- extra/discord/admin/mc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extra/discord/admin/mc.py b/extra/discord/admin/mc.py index aa9dc22..17571a3 100644 --- a/extra/discord/admin/mc.py +++ b/extra/discord/admin/mc.py @@ -139,13 +139,19 @@ def __init__(self, bot: Bot) -> None: @discord.slash_command(guild_only=True, name="移除雲鎮白名單") @discord.option("mc_id", str) - async def del_whitelist(self, ctx: ApplicationContext, mc_id: str): + @discord.option( + "group", + str, + default="trial", + autocomplete=basic_autocomplete(get_whitelist_groups), + ) + async def del_whitelist(self, ctx: ApplicationContext, mc_id: str, group: str): if not await check_role(self.base_guild, ctx): return # 移除白名單 yaml_data = yaml.load(BC_WHITELIST_CONFIG_PATH.read_text(encoding="utf-8")) - whitelisted: list[str] = yaml_data["whitelist"]["trial"] + whitelisted: list[str] = yaml_data["whitelist"][group] if mc_id in set(whitelisted): whitelisted.remove(mc_id)