refactor(commands/voice): check if command allowed after argparse
So the help command always works.
This commit is contained in:
parent
5824fcdf16
commit
1b781ac6a0
@ -228,9 +228,6 @@ async def queue_or_play(message, edited=False):
|
||||
|
||||
|
||||
async def playing(message):
|
||||
if not command_allowed(message, immutable=True):
|
||||
return
|
||||
|
||||
tokens = commands.tokenize(message.content)
|
||||
parser = arguments.ArgumentParser(
|
||||
tokens[0], "get information about the currently playing song"
|
||||
@ -244,6 +241,9 @@ async def playing(message):
|
||||
if not (args := await parser.parse_args(message, tokens)):
|
||||
return
|
||||
|
||||
if not command_allowed(message, immutable=True):
|
||||
return
|
||||
|
||||
if source := message.guild.voice_client.source:
|
||||
if args.description:
|
||||
if description := source.description:
|
||||
@ -292,9 +292,6 @@ async def playing(message):
|
||||
|
||||
|
||||
async def fast_forward(message):
|
||||
if not command_allowed(message):
|
||||
return
|
||||
|
||||
tokens = commands.tokenize(message.content)
|
||||
parser = arguments.ArgumentParser(tokens[0], "fast forward audio playback")
|
||||
parser.add_argument(
|
||||
@ -305,6 +302,9 @@ async def fast_forward(message):
|
||||
if not (args := await parser.parse_args(message, tokens)):
|
||||
return
|
||||
|
||||
if not command_allowed(message):
|
||||
return
|
||||
|
||||
if not message.guild.voice_client.source:
|
||||
await utils.reply(message, "nothing is playing!")
|
||||
return
|
||||
@ -378,9 +378,6 @@ async def pause(message):
|
||||
|
||||
|
||||
async def volume(message):
|
||||
if not command_allowed(message, immutable=True):
|
||||
return
|
||||
|
||||
tokens = commands.tokenize(message.content)
|
||||
parser = arguments.ArgumentParser(tokens[0], "get or set the current volume level")
|
||||
parser.add_argument(
|
||||
@ -392,6 +389,9 @@ async def volume(message):
|
||||
if not (args := await parser.parse_args(message, tokens)):
|
||||
return
|
||||
|
||||
if not command_allowed(message, immutable=True):
|
||||
return
|
||||
|
||||
if not message.guild.voice_client.source:
|
||||
await utils.reply(message, "nothing is playing!")
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user