Skip to content

Commit

Permalink
fix(mute/set): >mute set command is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Feb 14, 2023
1 parent 10fcc97 commit a552e68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 11 additions & 2 deletions src/main/exts/mod/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a552e68

Please sign in to comment.