Fixed attribute semantics
This commit is contained in:
parent
11e4a34a96
commit
360889e048
|
|
@ -21,6 +21,7 @@ class Player(pomice.Player):
|
||||||
|
|
||||||
self.queue = asyncio.Queue()
|
self.queue = asyncio.Queue()
|
||||||
self.controller: discord.Message = None
|
self.controller: discord.Message = None
|
||||||
|
# Set context here so we can send a now playing embed
|
||||||
self.context: commands.Context = None
|
self.context: commands.Context = None
|
||||||
self.dj: discord.Member = None
|
self.dj: discord.Member = None
|
||||||
|
|
||||||
|
|
@ -56,11 +57,9 @@ class Player(pomice.Player):
|
||||||
|
|
||||||
if track.is_stream:
|
if track.is_stream:
|
||||||
embed = discord.Embed(title="Now playing", description=f":red_circle: **LIVE** [{track.title}]({track.uri}) [{track.requester.mention}]")
|
embed = discord.Embed(title="Now playing", description=f":red_circle: **LIVE** [{track.title}]({track.uri}) [{track.requester.mention}]")
|
||||||
embed.set_footer(text=f"Use {track.ctx.prefix}help for more commands!", icon_url=f"{self.client.user.avatar.url}")
|
|
||||||
self.controller = await self.context.send(embed=embed)
|
self.controller = await self.context.send(embed=embed)
|
||||||
else:
|
else:
|
||||||
embed = discord.Embed(title=f"Now playing", description=f"[{track.title}]({track.uri}) [{track.requester.mention}]")
|
embed = discord.Embed(title=f"Now playing", description=f"[{track.title}]({track.uri}) [{track.requester.mention}]")
|
||||||
embed.set_footer(text=f"Use {track.ctx.prefix}help for more commands!", icon_url=f"{self.client.user.avatar.url}")
|
|
||||||
self.controller = await self.context.send(embed=embed)
|
self.controller = await self.context.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,6 +98,13 @@ class Music(commands.Cog):
|
||||||
)
|
)
|
||||||
print(f"Node is ready!")
|
print(f"Node is ready!")
|
||||||
|
|
||||||
|
|
||||||
|
# The following are events from pomice.events
|
||||||
|
# We are using these so that if the track either stops or errors,
|
||||||
|
# we can just skip to the next track
|
||||||
|
|
||||||
|
# Of course, you can modify this to do whatever you like
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_pomice_track_end(self, player: Player, track, _):
|
async def on_pomice_track_end(self, player: Player, track, _):
|
||||||
await player.do_next()
|
await player.do_next()
|
||||||
|
|
@ -149,7 +155,9 @@ class Music(commands.Cog):
|
||||||
# You can pass in "search_type=" as an argument to change the search type
|
# You can pass in "search_type=" as an argument to change the search type
|
||||||
# i.e: player.get_tracks("query", search_type=SearchType.ytmsearch)
|
# i.e: player.get_tracks("query", search_type=SearchType.ytmsearch)
|
||||||
# will search up any keyword results on YouTube Music
|
# will search up any keyword results on YouTube Music
|
||||||
results = await player.get_tracks(search)
|
|
||||||
|
# We will also set the context here to get special features, like a track.requester object
|
||||||
|
results = await player.get_tracks(search, ctx=ctx)
|
||||||
|
|
||||||
if not results:
|
if not results:
|
||||||
raise commands.CommandError("No results were found for that search term.")
|
raise commands.CommandError("No results were found for that search term.")
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class Track:
|
||||||
self.info = info
|
self.info = info
|
||||||
self.spotify = spotify
|
self.spotify = spotify
|
||||||
|
|
||||||
if self.spotify:
|
|
||||||
self.original: Optional[Track] = None
|
self.original: Optional[Track] = None
|
||||||
self._search_type = search_type
|
self._search_type = search_type
|
||||||
self.spotify_track = spotify_track
|
self.spotify_track = spotify_track
|
||||||
|
|
@ -77,10 +77,13 @@ class Playlist:
|
||||||
self.tracks_raw = tracks
|
self.tracks_raw = tracks
|
||||||
self.spotify = spotify
|
self.spotify = spotify
|
||||||
self.name = playlist_info.get("name")
|
self.name = playlist_info.get("name")
|
||||||
|
self.spotify_playlist = spotify_playlist
|
||||||
|
|
||||||
|
self._thumbnail = None
|
||||||
|
self._uri = None
|
||||||
|
|
||||||
if self.spotify:
|
if self.spotify:
|
||||||
self.tracks = tracks
|
self.tracks = tracks
|
||||||
self.spotify_playlist = spotify_playlist
|
|
||||||
self._thumbnail = self.spotify_playlist.image
|
self._thumbnail = self.spotify_playlist.image
|
||||||
self._uri = self.spotify_playlist.uri
|
self._uri = self.spotify_playlist.uri
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue