From a552e6895fb5cef50c23293c96fe02ffc279bef2 Mon Sep 17 00:00:00 2001 From: ziro Date: Tue, 14 Feb 2023 17:48:49 +0700 Subject: [PATCH] fix(mute/set): `>mute set` command is broken --- CHANGELOG.md | 3 ++- src/main/exts/mod/mod.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 458f45b7..b6f191b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ ### Bugfixes - [**Fixed**] Guild only (slash) commands is registered to DMs -- [**Fixed**] Duration parser stop working +- [**Fixed**] Duration parser stopped working - [**Fixed**] `1 spam` is parsed as 1 seconds +- [**Fixed**] `>mute set` command stopped working ### Improvements - [**Changed**] Rename some command (only affecting for slash) diff --git a/src/main/exts/mod/mod.py b/src/main/exts/mod/mod.py index ae8d3929..7e6ec175 100644 --- a/src/main/exts/mod/mod.py +++ b/src/main/exts/mod/mod.py @@ -16,6 +16,7 @@ from ...core.errors import MissingMuteRole from ...core.menus import ZMenuPagesView from ...core.mixin import CogMixin +from ...exts.admin._flags import RoleCreateFlags, RoleSetFlags from ...exts.timer.timer import Timer, TimerData from ...utils.cache import CacheUniqueViolation from ...utils.format import formatDateTime @@ -310,9 +311,17 @@ async def doMute(self, _n, member: discord.Member, /, reason: str, **kwargs): usage="[role name]", ) async def muteCreate(self, ctx, name: Union[discord.Role, str] = "Muted"): + cmd = "create" if isinstance(name, str) else "set" + argString = f"role: {getattr(name, 'id', name)} type: muted" + + if cmd == "create": + argument = await RoleCreateFlags.convert(ctx, arguments=argString) + else: + argument = await RoleSetFlags.convert(ctx, arguments=argString) + await ctx.try_invoke( - "role create" if isinstance(name, str) else "role set", - arguments=f"{getattr(name, 'id', name)} type: muted", + f"role {cmd}", + arguments=argument, ) @commands.command(