mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Adding requester field to song embed
This commit is contained in:
parent
8b8e9e603b
commit
27c2ce38b4
@ -24,6 +24,7 @@ MAX_PRELOAD_SONGS = 10
|
||||
|
||||
SONGINFO_UPLOADER = "Uploader: "
|
||||
SONGINFO_DURATION = "Duration: "
|
||||
SONGINFO_REQUESTER = 'Requester: '
|
||||
|
||||
HELP_SKIP = 'Skip the current playing song'
|
||||
HELP_RESUME = 'Resumes the song player'
|
||||
|
||||
@ -19,6 +19,7 @@ class Music(commands.Cog):
|
||||
@commands.command(name="play", help=config.HELP_PLAY, aliases=['p', 'tocar'])
|
||||
async def play(self, ctx, *args):
|
||||
user_input = " ".join(args)
|
||||
requester = ctx.author.name
|
||||
|
||||
player = self.__get_player(ctx)
|
||||
if player == None:
|
||||
@ -31,7 +32,7 @@ class Music(commands.Cog):
|
||||
await self.__send_embed(ctx, description=result['reason'], colour_name='red')
|
||||
return
|
||||
|
||||
await player.play(ctx, user_input)
|
||||
await player.play(ctx, user_input, requester)
|
||||
|
||||
@commands.command(name="queue", help=config.HELP_QUEUE, aliases=['q', 'fila'])
|
||||
async def queue(self, ctx):
|
||||
|
||||
@ -280,7 +280,11 @@ class Player(commands.Cog):
|
||||
|
||||
embedvc.add_field(name=config.SONGINFO_UPLOADER,
|
||||
value=info['uploader'],
|
||||
inline=False)
|
||||
inline=True)
|
||||
|
||||
embedvc.add_field(name=config.SONGINFO_REQUESTER,
|
||||
value=info['requester'],
|
||||
inline=True)
|
||||
|
||||
if 'thumbnail' in info.keys():
|
||||
embedvc.set_thumbnail(url=info['thumbnail'])
|
||||
|
||||
@ -77,9 +77,9 @@ class Playlist(IPlaylist):
|
||||
else:
|
||||
return self.__songs_history[0].source
|
||||
|
||||
def add_song(self, identifier: str) -> Song:
|
||||
def add_song(self, identifier: str, requester: str) -> Song:
|
||||
"""Create a song object, add to queue and return it"""
|
||||
song = Song(identifier, self) # Cria a musica com o identificador
|
||||
song = Song(identifier=identifier, playlist=self, requester=requester)
|
||||
self.__queue.append(song)
|
||||
return song
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@ from vulkan.music.Interfaces import ISong, IPlaylist
|
||||
class Song(ISong):
|
||||
"""Store the usefull information about a Song"""
|
||||
|
||||
def __init__(self, identifier: str, playlist: IPlaylist) -> None:
|
||||
def __init__(self, identifier: str, playlist: IPlaylist, requester: str) -> None:
|
||||
"""Create a song with only the URL to the youtube song"""
|
||||
self.__identifier = identifier
|
||||
self.__info = {}
|
||||
self.__info = {'requester': requester}
|
||||
self.__problematic = False
|
||||
self.__playlist: IPlaylist = playlist
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user