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