mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Merge pull request #20 from RafaelSolVargas/addingDezzer
Updating requirements and Helper messages closing AddDeezer task
This commit is contained in:
commit
97d49a5709
@ -5,13 +5,18 @@ from Config.Singleton import Singleton
|
|||||||
class Configs(Singleton):
|
class Configs(Singleton):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
if not super().created:
|
if not super().created:
|
||||||
self.COMMANDS_PATH = 'Commands'
|
self.BOT_PREFIX = '!'
|
||||||
|
try:
|
||||||
self.BOT_TOKEN = config('BOT_TOKEN')
|
self.BOT_TOKEN = config('BOT_TOKEN')
|
||||||
self.SPOTIFY_ID = config('SPOTIFY_ID')
|
self.SPOTIFY_ID = config('SPOTIFY_ID')
|
||||||
self.SPOTIFY_SECRET = config('SPOTIFY_SECRET')
|
self.SPOTIFY_SECRET = config('SPOTIFY_SECRET')
|
||||||
self.CLEANER_MESSAGES_QUANT = 5
|
self.BOT_PREFIX = config('BOT_PREFIX')
|
||||||
|
except:
|
||||||
|
print(
|
||||||
|
'[ERROR] -> You must create and .env file with all required fields, see documentation for help')
|
||||||
|
|
||||||
self.BOT_PREFIX = '!'
|
self.CLEANER_MESSAGES_QUANT = 5
|
||||||
|
self.COMMANDS_PATH = 'Commands'
|
||||||
self.VC_TIMEOUT = 600
|
self.VC_TIMEOUT = 600
|
||||||
|
|
||||||
self.MAX_PLAYLIST_LENGTH = 50
|
self.MAX_PLAYLIST_LENGTH = 50
|
||||||
|
|||||||
@ -29,8 +29,8 @@ class Helper(Singleton):
|
|||||||
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_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 = 'Shuffle the songs playing.'
|
||||||
self.HELP_SHUFFLE_LONG = 'Randomly shuffle the songs in the queue.\n\nArguments: None.'
|
self.HELP_SHUFFLE_LONG = 'Randomly shuffle the songs in the queue.\n\nArguments: None.'
|
||||||
self.HELP_PLAY = 'Plays a song.'
|
self.HELP_PLAY = 'Plays a song from URL'
|
||||||
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_PLAY_LONG = 'Play a song in discord. \n\nRequire: You to be connected to a voice channel.\nArguments: Youtube, Spotify or Deezer 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 = f'Show the history of played songs.'
|
||||||
self.HELP_HISTORY_LONG = f'Show the last {config.MAX_SONGS_HISTORY} 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 = 'Moves a song from position x to y in queue.'
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class Messages(Singleton):
|
|||||||
self.ERROR_TITLE = 'Error :-('
|
self.ERROR_TITLE = 'Error :-('
|
||||||
self.NO_CHANNEL = 'To play some music, connect to any voice channel first.'
|
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.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.INVALID_INPUT = f'This URL was too strange, try something better or type {configs.BOT_PREFIX}help play'
|
||||||
self.DOWNLOADING_ERROR = '❌ An error occurred while downloading'
|
self.DOWNLOADING_ERROR = '❌ An error occurred while downloading'
|
||||||
self.EXTRACTING_ERROR = '❌ An error ocurred while searching for the songs'
|
self.EXTRACTING_ERROR = '❌ An error ocurred while searching for the songs'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from Exceptions.Exceptions import DownloadingError, VulkanError
|
from Exceptions.Exceptions import DownloadingError, InvalidInput, VulkanError
|
||||||
from discord.ext.commands import Context
|
from discord.ext.commands import Context
|
||||||
from discord import Client
|
from discord import Client
|
||||||
from Controllers.AbstractController import AbstractController
|
from Controllers.AbstractController import AbstractController
|
||||||
@ -20,6 +20,9 @@ class PlayController(AbstractController):
|
|||||||
track = " ".join(args)
|
track = " ".join(args)
|
||||||
requester = self.ctx.author.name
|
requester = self.ctx.author.name
|
||||||
|
|
||||||
|
if track == " ":
|
||||||
|
print('Aoba')
|
||||||
|
|
||||||
if not self.__user_connected():
|
if not self.__user_connected():
|
||||||
error = ImpossibleMove()
|
error = ImpossibleMove()
|
||||||
embed = self.embeds.NO_CHANNEL()
|
embed = self.embeds.NO_CHANNEL()
|
||||||
@ -34,6 +37,9 @@ class PlayController(AbstractController):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
musics = await self.__searcher.search(track)
|
musics = await self.__searcher.search(track)
|
||||||
|
if musics is None or len(musics) == 0:
|
||||||
|
raise InvalidInput(self.messages.INVALID_INPUT, self.messages.ERROR_TITLE)
|
||||||
|
|
||||||
for music in musics:
|
for music in musics:
|
||||||
song = Song(music, self.player.playlist, requester)
|
song = Song(music, self.player.playlist, requester)
|
||||||
self.player.playlist.add_song(song)
|
self.player.playlist.add_song(song)
|
||||||
|
|||||||
@ -70,6 +70,9 @@ class Searcher():
|
|||||||
return trackAnalyzer.getCleanedUrl()
|
return trackAnalyzer.getCleanedUrl()
|
||||||
|
|
||||||
def __identify_source(self, track: str) -> Provider:
|
def __identify_source(self, track: str) -> Provider:
|
||||||
|
if track == '':
|
||||||
|
return Provider.Unknown
|
||||||
|
|
||||||
if not Utils.is_url(track):
|
if not Utils.is_url(track):
|
||||||
return Provider.Name
|
return Provider.Name
|
||||||
|
|
||||||
|
|||||||
@ -62,9 +62,11 @@ pip install -r requirements.txt
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
- Installation of FFMPEG
|
- **Installation of FFMPEG**<br>
|
||||||
|
FFMPEG is a module that will be used to play music, you must have this configured in your machine
|
||||||
|
*FFMPEG must be configured in the PATH for Windows users. Check this [YoutubeVideo](https://www.youtube.com/watch?v=r1AtmY-RMyQ&t=114s&ab_channel=TroubleChute).* <br><br>
|
||||||
|
You can download the executables in this link `https://www.ffmpeg.org/download.html` and then put the .exe files inside a ffmpeg\bin folder in your C:\ folder. Do not forget to add 'ffmpeg\bin' to your PATH.
|
||||||
|
|
||||||
*FFMPEG must be configured in the PATH for Windows users. Check this [YoutubeVideo](https://www.youtube.com/watch?v=r1AtmY-RMyQ&t=114s&ab_channel=TroubleChute).*
|
|
||||||
|
|
||||||
### **.Env File Example**
|
### **.Env File Example**
|
||||||
This is an example of how your .env file (located in root) should look like.
|
This is an example of how your .env file (located in root) should look like.
|
||||||
@ -72,6 +74,7 @@ This is an example of how your .env file (located in root) should look like.
|
|||||||
BOT_TOKEN=Your_Own_Bot_Token
|
BOT_TOKEN=Your_Own_Bot_Token
|
||||||
SPOTIFY_ID=Your_Own_Spotify_ID
|
SPOTIFY_ID=Your_Own_Spotify_ID
|
||||||
SPOTIFY_SECRET=Your_Own_Spotify_Secret
|
SPOTIFY_SECRET=Your_Own_Spotify_Secret
|
||||||
|
BOT_PREFIX=Your_Wanted_Prefix_For_Vulkan
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user