Skip to content

Commit

Permalink
[Discord] Separate audio empty and empty into distinct commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Nov 19, 2023
1 parent 7900729 commit 2726432
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Discord/cogs/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, bot):
command.parent is None and
name not in (
"audio", "join", "leave", "pause", "resume", "replay",
"queue", "deafen", "mute", "undeafen", "unmute"
"empty", "queue", "deafen", "mute", "undeafen", "unmute"
)
):
self.bot.add_command(command)
Expand Down Expand Up @@ -370,14 +370,27 @@ async def insert(self, ctx, position_number : int, *, song : str):
finally:
await response.edit(embed = embed)

@commands.command(aliases = ["clear"])
@audio.command(name = "empty", aliases = ["clear"])
@checks.is_voice_connected()
@commands.check_any(checks.is_permitted(), checks.is_guild_owner())
async def empty(self, ctx):
async def audio_empty(self, ctx):
'''Empty the queue'''
# Note: empty command invokes this command
await self.players[ctx.guild.id].empty_queue()
await ctx.embed_reply(":wastebasket: Emptied queue")

@commands.command(aliases = ["clear"])
@checks.is_voice_connected()
@commands.check_any(checks.is_permitted(), checks.is_guild_owner())
async def empty(self, ctx):
'''Empty the queue'''
if command := ctx.bot.get_command("audio empty"):
await ctx.invoke(command)
else:
raise RuntimeError(
"audio empty command not found when empty command invoked"
)

@commands.command()
@checks.is_voice_connected()
@commands.check_any(checks.is_permitted(), checks.is_guild_owner())
Expand Down

0 comments on commit 2726432

Please sign in to comment.