Changing config folder name to Config

This commit is contained in:
Rafael Vargas
2022-03-26 22:10:34 -04:00
parent 985d87a470
commit cc0cd6424f
7 changed files with 0 additions and 1 deletions

34
Config/Colors.py Normal file
View File

@@ -0,0 +1,34 @@
from Config.Singleton import Singleton
class Colors(Singleton):
def __init__(self) -> None:
self.__red = 0xDC143C
self.__green = 0x1F8B4C
self.__grey = 0x708090
self.__blue = 0x206694
self.__black = 0x23272A
@property
def RED(self) -> str:
return self.__red
@property
def GREEN(self) -> str:
return self.__green
@property
def GREY(self) -> str:
return self.__grey
@property
def BLUE(self) -> str:
return self.__blue
@property
def BLACK(self) -> str:
return self.__black
@property
def RED(self) -> str:
return self.__red

51
Config/Helper.py Normal file
View File

@@ -0,0 +1,51 @@
from Config.Singleton import Singleton
from Config.Config import Configs
class Helper(Singleton):
def __init__(self) -> None:
if not super().created:
config = Configs()
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.'

80
Config/Messages.py Normal file
View File

@@ -0,0 +1,80 @@
from Config.Singleton import Singleton
from Config.Config import Configs
class Messages(Singleton):
def __init__(self) -> None:
if not super().created:
configs = Configs()
self.STARTUP_MESSAGE = 'Starting Vulkan...'
self.STARTUP_COMPLETE_MESSAGE = 'Vulkan is now operating.'
self.SONGINFO_UPLOADER = "Uploader: "
self.SONGINFO_DURATION = "Duration: "
self.SONGINFO_REQUESTER = 'Requester: '
self.SONGINFO_POSITION = 'Position: '
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 {configs.BOT_PREFIX}play to add new songs'
self.SONG_DOWNLOADING = '📥 Downloading...'
self.HISTORY_TITLE = '🎧 Played Songs'
self.HISTORY_EMPTY = '📜 There is no musics in history'
self.SONG_MOVED_SUCCESSFULLY = 'Song `{}` in position `{}` moved to the position `{}` successfully'
self.SONG_REMOVED_SUCCESSFULLY = 'Song `{}` removed successfully'
self.LOOP_ALL_ON = f'❌ Vulkan is looping all songs, use {configs.BOT_PREFIX}loop off to disable this loop first'
self.LOOP_ONE_ON = f'❌ Vulkan is looping one song, use {configs.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 {configs.BOT_PREFIX}loop off to disable loop'
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 {configs.BOT_PREFIX}help to see all commands'
self.UNKNOWN_ERROR = f'❌ Unknown Error, if needed, use {configs.BOT_PREFIX}reset to reset the player of your server'
self.ERROR_MISSING_ARGUMENTS = f'❌ Missing arguments in this command. Type {configs.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 {configs.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 {configs.BOT_PREFIX}reset'
self.INVALID_INPUT = f'This type of input was too strange, try something better or type {configs.BOT_PREFIX}help play'
self.DOWNLOADING_ERROR = '❌ An error occurred while downloading'
self.EXTRACTING_ERROR = '❌ An error ocurred while searching for the songs'
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 {configs.BOT_PREFIX}help "command" to understand the command better'
self.VIDEO_UNAVAILABLE = '❌ Sorry. This video is unavailable for download.'
self.ERROR_DUE_LOOP_ONE_ON = f'❌ This command cannot be executed with loop one activated. Use {configs.BOT_PREFIX}loop off to disable loop.'
class SearchMessages(Singleton):
def __init__(self) -> None:
if not super().created:
config = Configs()
self.UNKNOWN_INPUT = f'This type of input was too strange, try something else or type {config.BOT_PREFIX}help play'
self.UNKNOWN_INPUT_TITLE = 'Nothing Found'
self.SPOTIFY_ERROR = 'Spotify could not process any songs with this input, verify your link or try again later.'
self.GENERIC_TITLE = 'Input could not be processed'
self.YOUTUBE_ERROR = 'Youtube could not process any songs with this input, verify your link or try again later.'

16
Config/Singleton.py Normal file
View File

@@ -0,0 +1,16 @@
class Singleton(object):
__instance = None
__created = False
def __new__(cls, *args, **kwargs):
if cls.__instance is None:
cls.__instance = object.__new__(cls)
return cls.__instance
@property
def created(cls):
if cls.__created == False:
cls.__created = True
return False
else:
return True

0
Config/__init__.py Normal file
View File

26
Config/config.py Normal file
View File

@@ -0,0 +1,26 @@
from decouple import config
from Config.Singleton import Singleton
class Configs(Singleton):
def __init__(self) -> None:
if not super().created:
self.COMMANDS_PATH = 'Commands'
self.BOT_TOKEN = config('BOT_TOKEN')
self.SPOTIFY_ID = config('SPOTIFY_ID')
self.SPOTIFY_SECRET = config('SPOTIFY_SECRET')
self.CLEANER_MESSAGES_QUANT = 5
self.BOT_PREFIX = '!'
self.VC_TIMEOUT = 600
self.MAX_PLAYLIST_LENGTH = 50
self.MAX_PLAYLIST_FORCED_LENGTH = 5
self.MAX_PRELOAD_SONGS = 10
self.MAX_SONGS_HISTORY = 15
self.INVITE_MESSAGE = """To invite Vulkan to your own server, click [here]({}).
Or use this direct URL: {}"""
self.MY_ERROR_BAD_COMMAND = 'This string serves to verify if some error was raised by myself on purpose'
self.INVITE_URL = 'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot'