Skip to content

Commit

Permalink
Update mc.py
Browse files Browse the repository at this point in the history
  • Loading branch information
a3510377 committed Aug 29, 2024
1 parent 110c835 commit a50fe35
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions extra/discord/admin/mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a50fe35

Please sign in to comment.