Chaging config and help to class

This commit is contained in:
Rafael Vargas
2022-03-21 21:51:40 -04:00
parent 5c4d09bf9d
commit 14705569c1
12 changed files with 287 additions and 264 deletions

51
config/Helper.py Normal file
View File

@@ -0,0 +1,51 @@
from config.Singleton import Singleton
from config.Config import Config
class Helper(Singleton):
def __init__(self) -> None:
if not super().created:
config = Config()
self.HELP_SKIP = 'Skip the current playing song.'
self.HELP_SKIP_LONG = 'Skip the playing of the current song, does not work if loop one is activated. \n\nArguments: None.'
self.HELP_RESUME = 'Resumes the song player.'
self.HELP_RESUME_LONG = 'If the player if paused, return the playing. \n\nArguments: None.'
self.HELP_CLEAR = 'Clear the queue and songs history.'
self.HELP_CLEAR_LONG = 'Clear the songs queue and songs history. \n\nArguments: None.'
self.HELP_STOP = 'Stop the song player.'
self.HELP_STOP_LONG = 'Stop the song player, clear queue and history and remove Vulkan from voice channel.\n\nArguments: None.'
self.HELP_LOOP = 'Control the loop of songs.'
self.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."""
self.HELP_NP = 'Show the info of the current song.'
self.HELP_NP_LONG = 'Show the information of the song being played.\n\nRequire: A song being played.\nArguments: None.'
self.HELP_QUEUE = f'Show the first {config.MAX_PRELOAD_SONGS} songs in queue.'
self.HELP_QUEUE_LONG = f'Show the first {config.MAX_PRELOAD_SONGS} song in the queue.\n\nArguments: None.'
self.HELP_PAUSE = 'Pauses the song player.'
self.HELP_PAUSE_LONG = 'If playing, pauses the song player.\n\nArguments: None'
self.HELP_PREV = 'Play the previous song.'
self.HELP_PREV_LONG = 'Play the previous song. If playing, the current song will return to queue.\n\nRequire: Loop to be disable.\nArguments: None.'
self.HELP_SHUFFLE = 'Shuffle the songs playing.'
self.HELP_SHUFFLE_LONG = 'Randomly shuffle the songs in the queue.\n\nArguments: None.'
self.HELP_PLAY = 'Plays a song.'
self.HELP_PLAY_LONG = 'Play a song in discord. \n\nRequire: You to be connected to a voice channel.\nArguments: Youtube or Spotify song/playlist link or the title of the song to be searched in Youtube.'
self.HELP_HISTORY = f'Show the history of played songs.'
self.HELP_HISTORY_LONG = f'Show the last {config.MAX_SONGS_HISTORY} played songs'
self.HELP_MOVE = 'Moves a song from position x to y in queue.'
self.HELP_MOVE_LONG = 'Moves a song from position x to position y in queue.\n\nRequire: Positions to be both valid numbers.\nArguments: 1º Number => Initial position, 2º Number => Destination position. Both numbers could be -1 to refer to the last song in queue.\nDefault: By default, if the second number is not passed, it will be 1, moving the selected song to 1º position.'
self.HELP_REMOVE = 'Remove a song in position x.'
self.HELP_REMOVE_LONG = 'Remove a song from queue in the position passed.\n\nRequire: Position to be a valid number.\nArguments: 1º self.Number => Position in queue of the song.'
self.HELP_RESET = 'Reset the Player of the server.'
self.HELP_RESET_LONG = 'Reset the Player of the server. Recommended if you find any type of error.\n\nArguments: None'
self.HELP_HELP = f'Use {config.BOT_PREFIX}help "command" for more info.'
self.HELP_HELP_LONG = f'Use {config.BOT_PREFIX}help command for more info about the command selected.'
self.HELP_INVITE = 'Send the invite URL to call Vulkan to your server.'
self.HELP_INVITE_LONG = 'Send an message in text channel with a URL to be used to invite Vulkan to your own server.\n\nArguments: None.'
self.HELP_RANDOM = 'Return a random number between 1 and x.'
self.HELP_RANDOM_LONG = 'Send a randomly selected number between 1 and the number you pass.\n\nRequired: Number to be a valid number.\nArguments: 1º Any number to be used as range.'
self.HELP_CHOOSE = 'Choose randomly one item passed.'
self.HELP_CHOOSE_LONG = 'Choose randomly one item passed in this command.\n\nRequire: Itens to be separated by comma.\nArguments: As much as you want.'
self.HELP_CARA = 'Return cara or coroa.'
self.HELP_CARA_LONG = 'Return cara or coroa.'

View File

@@ -1,82 +1,87 @@
from decouple import config
from config.Singleton import Singleton
BOT_TOKEN = config('BOT_TOKEN')
SPOTIFY_ID = config('SPOTIFY_ID')
SPOTIFY_SECRET = config('SPOTIFY_SECRET')
BOT_PREFIX = '$'
VC_TIMEOUT = 600
class Config(Singleton):
def __init__(self) -> None:
if not super().created:
self.BOT_TOKEN = config('BOT_TOKEN')
self.SPOTIFY_ID = config('SPOTIFY_ID')
self.SPOTIFY_SECRET = config('SPOTIFY_SECRET')
STARTUP_MESSAGE = 'Starting Vulkan...'
STARTUP_COMPLETE_MESSAGE = 'Vulkan is now operating.'
self.BOT_PREFIX = '$'
self.VC_TIMEOUT = 600
MAX_PLAYLIST_LENGTH = 50
MAX_PRELOAD_SONGS = 10
MAX_SONGS_HISTORY = 15
self.STARTUP_MESSAGE = 'Starting Vulkan...'
self.STARTUP_COMPLETE_MESSAGE = 'Vulkan is now operating.'
INVITE_MESSAGE = 'To invite Vulkan to your own server, click [here]({})'
self.MAX_PLAYLIST_LENGTH = 50
self.MAX_PRELOAD_SONGS = 10
self.MAX_SONGS_HISTORY = 15
SONGINFO_UPLOADER = "Uploader: "
SONGINFO_DURATION = "Duration: "
SONGINFO_REQUESTER = 'Requester: '
SONGINFO_POSITION = 'Position: '
self.INVITE_MESSAGE = 'To invite Vulkan to your own server, click [here]({})'
SONGS_ADDED = 'You added {} songs to the queue'
SONG_ADDED = 'You added the song `{}` to the queue'
SONG_ADDED_TWO = '🎧 Song added to the queue'
SONG_PLAYING = '🎧 Song playing now'
SONG_PLAYER = '🎧 Song Player'
QUEUE_TITLE = '🎧 Songs in Queue'
ONE_SONG_LOOPING = '🎧 Looping One Song'
ALL_SONGS_LOOPING = '🎧 Looping All Songs'
SONG_PAUSED = '⏸️ Song paused'
SONG_RESUMED = '▶️ Song playing'
EMPTY_QUEUE = f'📜 Song queue is empty, use {BOT_PREFIX}play to add new songs'
SONG_DOWNLOADING = '📥 Downloading...'
self.SONGINFO_UPLOADER = "Uploader: "
self.SONGINFO_DURATION = "Duration: "
self.SONGINFO_REQUESTER = 'Requester: '
self.SONGINFO_POSITION = 'Position: '
HISTORY_TITLE = '🎧 Played Songs'
HISTORY_EMPTY = '📜 There is no musics in history'
self.SONGS_ADDED = 'You added {} songs to the queue'
self.SONG_ADDED = 'You added the song `{}` to the queue'
self.SONG_ADDED_TWO = '🎧 Song added to the queue'
self.SONG_PLAYING = '🎧 Song playing now'
self.SONG_PLAYER = '🎧 Song Player'
self.QUEUE_TITLE = '🎧 Songs in Queue'
self.ONE_SONG_LOOPING = '🎧 Looping One Song'
self.ALL_SONGS_LOOPING = '🎧 Looping All Songs'
self.SONG_PAUSED = '⏸️ Song paused'
self.SONG_RESUMED = '▶️ Song playing'
self.EMPTY_QUEUE = f'📜 Song queue is empty, use {self.BOT_PREFIX}play to add new songs'
self.SONG_DOWNLOADING = '📥 Downloading...'
SONG_MOVED_SUCCESSFULLY = 'Song `{}` in position `{}` moved to the position `{}` successfully'
SONG_REMOVED_SUCCESSFULLY = 'Song `{}` removed successfully'
self.HISTORY_TITLE = '🎧 Played Songs'
self.HISTORY_EMPTY = '📜 There is no musics in history'
LOOP_ALL_ON = f'❌ Vulkan is looping all songs, use {BOT_PREFIX}loop off to disable this loop first'
LOOP_ONE_ON = f'❌ Vulkan is looping one song, use {BOT_PREFIX}loop off to disable this loop first'
LOOP_ALL_ALREADY_ON = '🔁 Vulkan is already looping all songs'
LOOP_ONE_ALREADY_ON = '🔂 Vulkan is already looping the current song'
LOOP_ALL_ACTIVATE = '🔁 Looping all songs'
LOOP_ONE_ACTIVATE = '🔂 Looping the current song'
LOOP_DISABLE = '➡️ Loop disabled'
LOOP_ALREADY_DISABLE = '❌ Loop is already disabled'
LOOP_ON = f'❌ This command cannot be invoked with any loop activated. Use {BOT_PREFIX}loop off to disable loop'
self.SONG_MOVED_SUCCESSFULLY = 'Song `{}` in position `{}` moved to the position `{}` successfully'
self.SONG_REMOVED_SUCCESSFULLY = 'Song `{}` removed successfully'
SONGS_SHUFFLED = '🔀 Songs shuffled successfully'
ERROR_SHUFFLING = 'Error while shuffling the songs'
ERROR_MOVING = '❌ Error while moving the songs'
LENGTH_ERROR = '❌ Numbers must be between 1 and queue length, use -1 for the last song'
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 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 :('
ERROR_TITLE = 'Error :-('
NO_CHANNEL = 'To play some music, connect to any voice channel first.'
NO_GUILD = f'This server does not has a Player, try {BOT_PREFIX}reset'
INVALID_INPUT = f'This type of input was too strange, try something better or type {BOT_PREFIX}help play'
DOWNLOADING_ERROR = '❌ An error occurred while downloading'
EXTRACTING_ERROR = '❌ An error ocurred while searching for the songs'
self.LOOP_ALL_ON = f'❌ Vulkan is looping all songs, use {self.BOT_PREFIX}loop off to disable this loop first'
self.LOOP_ONE_ON = f'Vulkan is looping one song, use {self.BOT_PREFIX}loop off to disable this loop first'
self.LOOP_ALL_ALREADY_ON = '🔁 Vulkan is already looping all songs'
self.LOOP_ONE_ALREADY_ON = '🔂 Vulkan is already looping the current song'
self.LOOP_ALL_ACTIVATE = '🔁 Looping all songs'
self.LOOP_ONE_ACTIVATE = '🔂 Looping the current song'
self.LOOP_DISABLE = '➡️ Loop disabled'
self.LOOP_ALREADY_DISABLE = 'Loop is already disabled'
self.LOOP_ON = f'❌ This command cannot be invoked with any loop activated. Use {self.BOT_PREFIX}loop off to disable loop'
MY_ERROR_BAD_COMMAND = 'This string serves to verify if some error was raised by myself on purpose'
BAD_COMMAND_TITLE = 'Misuse of command'
BAD_COMMAND = f'❌ Bad usage of this command, type {BOT_PREFIX}help "command" to understand the command better'
self.SONGS_SHUFFLED = '🔀 Songs shuffled successfully'
self.ERROR_SHUFFLING = '❌ Error while shuffling the songs'
self.ERROR_MOVING = '❌ Error while moving the songs'
self.LENGTH_ERROR = '❌ Numbers must be between 1 and queue length, use -1 for the last song'
self.ERROR_NUMBER = '❌ This command require a number'
self.ERROR_PLAYING = '❌ Error while playing songs'
self.COMMAND_NOT_FOUND = f'❌ Command not found, type {self.BOT_PREFIX}help to see all commands'
self.UNKNOWN_ERROR = f'❌ Unknown Error, if needed, use {self.BOT_PREFIX}reset to reset the player of your server'
self.ERROR_MISSING_ARGUMENTS = f'❌ Missing arguments in this command. Type {self.BOT_PREFIX}help "command" to see more info about this command'
self.NOT_PREVIOUS = '❌ There is none previous song to play'
self.PLAYER_NOT_PLAYING = f'❌ No song playing. Use {self.BOT_PREFIX}play to start the player'
self.IMPOSSIBLE_MOVE = 'That is impossible :('
self.ERROR_TITLE = 'Error :-('
self.NO_CHANNEL = 'To play some music, connect to any voice channel first.'
self.NO_GUILD = f'This server does not has a Player, try {self.BOT_PREFIX}reset'
self.INVALID_INPUT = f'This type of input was too strange, try something better or type {self.BOT_PREFIX}help play'
self.DOWNLOADING_ERROR = '❌ An error occurred while downloading'
self.EXTRACTING_ERROR = '❌ An error ocurred while searching for the songs'
COLOURS = {
'red': 0xDC143C,
'green': 0x1F8B4C,
'grey': 0x708090,
'blue': 0x206694,
'black': 0x23272A
}
self.MY_ERROR_BAD_COMMAND = 'This string serves to verify if some error was raised by myself on purpose'
self.BAD_COMMAND_TITLE = 'Misuse of command'
self.BAD_COMMAND = f'❌ Bad usage of this command, type {self.BOT_PREFIX}help "command" to understand the command better'
self.COLOURS = {
'red': 0xDC143C,
'green': 0x1F8B4C,
'grey': 0x708090,
'blue': 0x206694,
'black': 0x23272A
}

View File

@@ -1,45 +0,0 @@
from config.config import *
HELP_SKIP = 'Skip the current playing song.'
HELP_SKIP_LONG = 'Skip the playing of the current song, does not work if loop one is activated. \n\nArguments: None.'
HELP_RESUME = 'Resumes the song player.'
HELP_RESUME_LONG = 'If the player if paused, return the playing. \n\nArguments: None.'
HELP_CLEAR = 'Clear the queue and songs history.'
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 = """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.'
HELP_QUEUE_LONG = f'Show the first {MAX_PRELOAD_SONGS} song in the queue.\n\nArguments: None.'
HELP_PAUSE = 'Pauses the song player.'
HELP_PAUSE_LONG = 'If playing, pauses the song player.\n\nArguments: None'
HELP_PREV = 'Play the previous song.'
HELP_PREV_LONG = 'Play the previous song. If playing, the current song will return to queue.\n\nRequire: Loop to be disable.\nArguments: None.'
HELP_SHUFFLE = 'Shuffle the songs playing.'
HELP_SHUFFLE_LONG = 'Randomly shuffle the songs in the queue.\n\nArguments: None.'
HELP_PLAY = 'Plays a song.'
HELP_PLAY_LONG = 'Play a song in discord. \n\nRequire: You to be connected to a voice channel.\nArguments: Youtube or Spotify song/playlist link or the title of the song to be searched in Youtube.'
HELP_HISTORY = f'Show the history of played songs.'
HELP_HISTORY_LONG = f'Show the last {MAX_SONGS_HISTORY} played songs'
HELP_MOVE = 'Moves a song from position x to y in queue.'
HELP_MOVE_LONG = 'Moves a song from position x to position y in queue.\n\nRequire: Positions to be both valid numbers.\nArguments: 1º Number => Initial position, 2º Number => Destination position. Both numbers could be -1 to refer to the last song in queue.\nDefault: By default, if the second number is not passed, it will be 1, moving the selected song to 1º position.'
HELP_REMOVE = 'Remove a song in position x.'
HELP_REMOVE_LONG = 'Remove a song from queue in the position passed.\n\nRequire: Position to be a valid number.\nArguments: 1º Number => Position in queue of the song.'
HELP_RESET = 'Reset the Player of the server.'
HELP_RESET_LONG = 'Reset the Player of the server. Recommended if you find any type of error.\n\nArguments: None'
HELP_HELP = f'Use {BOT_PREFIX}help "command" for more info.'
HELP_HELP_LONG = f'Use {BOT_PREFIX}help command for more info about the command selected.'
HELP_INVITE = 'Send the invite URL to call Vulkan to your server.'
HELP_INVITE_LONG = 'Send an message in text channel with a URL to be used to invite Vulkan to your own server.\n\nArguments: None.'
HELP_RANDOM = 'Return a random number between 1 and x.'
HELP_RANDOM_LONG = 'Send a randomly selected number between 1 and the number you pass.\n\nRequired: Number to be a valid number.\nArguments: 1º Any number to be used as range.'
HELP_CHOOSE = 'Choose randomly one item passed.'
HELP_CHOOSE_LONG = 'Choose randomly one item passed in this command.\n\nRequire: Itens to be separated by comma.\nArguments: As much as you want.'
HELP_CARA = 'Return cara or coroa.'
HELP_CARA_LONG = 'Return cara or coroa.'