From c23d4c13cbc492d25738a2047e41449c936c0388 Mon Sep 17 00:00:00 2001 From: Rafael Vargas Date: Thu, 13 Jan 2022 20:10:28 -0400 Subject: [PATCH] [Fix] - Error msg in loop command error, colours update --- config/config.py | 10 +++++++--- config/help.py | 6 ++++-- vulkan/commands/Control.py | 16 ++++++++++++---- vulkan/music/Player.py | 2 +- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/config/config.py b/config/config.py index 1efbb78..dfc39cd 100644 --- a/config/config.py +++ b/config/config.py @@ -57,7 +57,7 @@ ERROR_NUMBER = '❌ This command require a number' ERROR_PLAYING = '❌ Error while playing songs' COMMAND_NOT_FOUND = f'❌ Command not found, type {BOT_PREFIX}help to see all commands' UNKNOWN_ERROR = f'❌ Unknown Error, if needed, use {BOT_PREFIX}reset to reset the player of your server' -ERROR_MISSING_ARGUMENTS = f'❌ Missing arguments in this function. Type {BOT_PREFIX}help to see all commands' +ERROR_MISSING_ARGUMENTS = f'❌ Missing arguments in this command. Type {BOT_PREFIX}help "command" to see more info about this command' NOT_PREVIOUS = '❌ There is none previous song to play' PLAYER_NOT_PLAYING = f'❌ No song playing. Use {BOT_PREFIX}play to start the player' IMPOSSIBLE_MOVE = 'That is impossible :(' @@ -68,9 +68,13 @@ INVALID_INPUT = f'This type of input was too strange, try something better or ty DOWNLOADING_ERROR = '❌ An error occurred while downloading' EXTRACTING_ERROR = '❌ An error ocurred while searching for the songs' +BAD_COMMAND_TITLE = 'Misuse of command' +BAD_COMMAND = f'❌ Bad usage of this command, type {BOT_PREFIX}help "command" to understand the command better' + COLOURS = { 'red': 0xDC143C, - 'green': 0x58D68D, + 'green': 0x1F8B4C, 'grey': 0x708090, - 'blue': 0x3498DB + 'blue': 0x206694, + 'black': 0x23272A } diff --git a/config/help.py b/config/help.py index f58fa4e..0a9cb35 100644 --- a/config/help.py +++ b/config/help.py @@ -9,8 +9,10 @@ HELP_CLEAR_LONG = 'Clear the songs queue and songs history. \n\nArguments: None. HELP_STOP = 'Stop the song player.' HELP_STOP_LONG = 'Stop the song player, clear queue and history and remove Vulkan from voice channel.\n\nArguments: None.' HELP_LOOP = 'Control the loop of songs.' -HELP_LOOP_LONG = 'Controll the loop of songs.\n\n Require: A song being played.\nArguments:\nOne - Start looping the current song. \ - \nAll - Start looping all songs in queue.\nOff - Disable loop.' +HELP_LOOP_LONG = """Control the loop of songs.\n\n Require: A song being played.\nArguments: + One - Start looping the current song. + All - Start looping all songs in queue. + Off - Disable loop.""" HELP_NP = 'Show the info of the current song.' HELP_NP_LONG = 'Show the information of the song being played.\n\nRequire: A song being played.\nArguments: None.' HELP_QUEUE = f'Show the first {MAX_PRELOAD_SONGS} songs in queue.' diff --git a/vulkan/commands/Control.py b/vulkan/commands/Control.py index 3c96450..4f57781 100644 --- a/vulkan/commands/Control.py +++ b/vulkan/commands/Control.py @@ -1,6 +1,6 @@ import discord from discord import Client -from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument +from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument, CommandInvokeError from discord.ext import commands from config import config from config import help @@ -32,7 +32,7 @@ class Control(commands.Cog): embed = discord.Embed( title=config.ERROR_TITLE, description=config.ERROR_MISSING_ARGUMENTS, - colour=config.COLOURS['red'] + colour=config.COLOURS['black'] ) await ctx.send(embed=embed) @@ -40,9 +40,17 @@ class Control(commands.Cog): embed = discord.Embed( title=config.ERROR_TITLE, description=config.COMMAND_NOT_FOUND, - colour=config.COLOURS['red'] + colour=config.COLOURS['black'] ) await ctx.send(embed=embed) + elif isinstance(error, CommandInvokeError): + embed = discord.Embed( + title=config.BAD_COMMAND_TITLE, + description=config.BAD_COMMAND, + colour=config.COLOURS['black'] + ) + await ctx.send(embed=embed) + else: print(error) embed = discord.Embed( @@ -93,7 +101,7 @@ class Control(commands.Cog): help_help += f'**{command}** - {command.help}\n' helptxt = f'\n{help_music}\n{help_help}\n{help_random}' - + helptxt += f'\n\nType {config.BOT_PREFIX}help "command" for more information about the command chosen' embedhelp = discord.Embed( title=f'**Available Commands of {self.__bot.user.name}**', description=helptxt, diff --git a/vulkan/music/Player.py b/vulkan/music/Player.py index 93bd89d..ddb7d10 100644 --- a/vulkan/music/Player.py +++ b/vulkan/music/Player.py @@ -271,7 +271,7 @@ class Player(commands.Cog): elif args == 'off': description = self.__playlist.loop_off() else: - description = help.HELP_LONG_LOOP + raise commands.CommandInvokeError('Invalid Arguments in Command') return description