mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Now using hyperlinks in Queue and adding support message as random string
This commit is contained in:
parent
5f60c12179
commit
ba57a3e18d
@ -24,6 +24,10 @@ class VConfigs(Singleton):
|
|||||||
self.COMMANDS_PATH = f'{Folder().rootFolder}{self.COMMANDS_FOLDER_NAME}'
|
self.COMMANDS_PATH = f'{Folder().rootFolder}{self.COMMANDS_FOLDER_NAME}'
|
||||||
self.VC_TIMEOUT = 300
|
self.VC_TIMEOUT = 300
|
||||||
|
|
||||||
|
self.CHANCE_SHOW_PROJECT = 15
|
||||||
|
self.PROJECT_URL = 'https://github.com/RafaelSolVargas/Vulkan'
|
||||||
|
self.SUPPORTING_ICON = 'https://i.pinimg.com/originals/d6/05/b4/d605b4f8c5d1c6ae20dc353ef9f091bd.png'
|
||||||
|
|
||||||
self.MAX_PLAYLIST_LENGTH = 50
|
self.MAX_PLAYLIST_LENGTH = 50
|
||||||
self.MAX_PLAYLIST_FORCED_LENGTH = 5
|
self.MAX_PLAYLIST_FORCED_LENGTH = 5
|
||||||
self.MAX_SONGS_IN_PAGE = 10
|
self.MAX_SONGS_IN_PAGE = 10
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from random import random
|
||||||
from Config.Messages import Messages
|
from Config.Messages import Messages
|
||||||
from Config.Exceptions import VulkanError
|
from Config.Exceptions import VulkanError
|
||||||
from discord import Embed
|
from discord import Embed
|
||||||
@ -12,6 +13,13 @@ class VEmbeds:
|
|||||||
self.__messages = Messages()
|
self.__messages = Messages()
|
||||||
self.__colors = VColors()
|
self.__colors = VColors()
|
||||||
|
|
||||||
|
def __willShowProject(self) -> bool:
|
||||||
|
return (random() * 100 < self.__config.CHANCE_SHOW_PROJECT)
|
||||||
|
|
||||||
|
def __addFooterContent(self, embed: Embed) -> Embed:
|
||||||
|
footerText = f'\u200b Please support this project by leaving a star: {self.__config.PROJECT_URL}'
|
||||||
|
return embed.set_footer(text=footerText, icon_url=self.__config.SUPPORTING_ICON)
|
||||||
|
|
||||||
def ONE_SONG_LOOPING(self, info: dict) -> Embed:
|
def ONE_SONG_LOOPING(self, info: dict) -> Embed:
|
||||||
title = self.__messages.ONE_SONG_LOOPING
|
title = self.__messages.ONE_SONG_LOOPING
|
||||||
return self.SONG_INFO(info, title)
|
return self.SONG_INFO(info, title)
|
||||||
@ -113,6 +121,8 @@ class VEmbeds:
|
|||||||
value=position,
|
value=position,
|
||||||
inline=True)
|
inline=True)
|
||||||
|
|
||||||
|
if self.__willShowProject():
|
||||||
|
embedvc = self.__addFooterContent(embedvc)
|
||||||
return embedvc
|
return embedvc
|
||||||
|
|
||||||
def SONG_MOVED(self, song_name: str, pos1: int, pos2: int) -> Embed:
|
def SONG_MOVED(self, song_name: str, pos1: int, pos2: int) -> Embed:
|
||||||
@ -340,6 +350,9 @@ class VEmbeds:
|
|||||||
description=description,
|
description=description,
|
||||||
colour=self.__colors.BLUE
|
colour=self.__colors.BLUE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.__willShowProject():
|
||||||
|
embed = self.__addFooterContent(embed)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
def INVITE(self, bot_id: str) -> Embed:
|
def INVITE(self, bot_id: str) -> Embed:
|
||||||
|
|||||||
@ -74,8 +74,8 @@ class QueueHandler(AbstractHandler):
|
|||||||
# To work get the correct index of all songs
|
# To work get the correct index of all songs
|
||||||
startIndex = (pageNumber * self.config.MAX_SONGS_IN_PAGE) + 1
|
startIndex = (pageNumber * self.config.MAX_SONGS_IN_PAGE) + 1
|
||||||
for pos, song in enumerate(songs, start=startIndex):
|
for pos, song in enumerate(songs, start=startIndex):
|
||||||
song_name = song.title if song.title else self.messages.SONG_DOWNLOADING
|
song_name = song.title[:50] if song.title else self.messages.SONG_DOWNLOADING
|
||||||
text += f"**`{pos}` - ** {song_name} - `{Utils.format_time(song.duration)}`\n"
|
text += f"**`{pos}` - ** [{song_name}]({song.identifier}) - `{Utils.format_time(song.duration)}`\n"
|
||||||
|
|
||||||
embed = self.embeds.QUEUE(title, text)
|
embed = self.embeds.QUEUE(title, text)
|
||||||
# Release the acquired Lock
|
# Release the acquired Lock
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
class Song:
|
class Song:
|
||||||
|
|
||||||
def __init__(self, identifier: str, playlist, requester: str) -> None:
|
def __init__(self, identifier: str, playlist, requester: str) -> None:
|
||||||
self.__identifier = identifier
|
self.__identifier = identifier
|
||||||
self.__info = {'requester': requester}
|
self.__info = {'requester': requester}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
from random import choices
|
from random import choices
|
||||||
import string
|
import string
|
||||||
from discord.bot import Bot
|
from discord.bot import Bot
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user