@@ -51,7 +51,7 @@ async def connect_to(self, guild_id: int, channel_id: str):
51
51
@commands .command (aliases = ['p' ])
52
52
async def play (self , ctx , * , query : str ):
53
53
""" Searches and plays a song from a given query. """
54
- player = self .bot .lavalink .players .get (ctx .guild .id )
54
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
55
55
56
56
query = query .strip ('<>' )
57
57
@@ -87,7 +87,7 @@ async def play(self, ctx, *, query: str):
87
87
@commands .command ()
88
88
async def seek (self , ctx , * , seconds : int ):
89
89
""" Seeks to a given position in a track. """
90
- player = self .bot .lavalink .players .get (ctx .guild .id )
90
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
91
91
92
92
track_time = player .position + (seconds * 1000 )
93
93
await player .seek (track_time )
@@ -97,7 +97,7 @@ async def seek(self, ctx, *, seconds: int):
97
97
@commands .command (aliases = ['forceskip' ])
98
98
async def skip (self , ctx ):
99
99
""" Skips the current track. """
100
- player = self .bot .lavalink .players .get (ctx .guild .id )
100
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
101
101
102
102
if not player .is_playing :
103
103
return await ctx .send ('Not playing.' )
@@ -108,7 +108,7 @@ async def skip(self, ctx):
108
108
@commands .command ()
109
109
async def stop (self , ctx ):
110
110
""" Stops the player and clears its queue. """
111
- player = self .bot .lavalink .players .get (ctx .guild .id )
111
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
112
112
113
113
if not player .is_playing :
114
114
return await ctx .send ('Not playing.' )
@@ -120,7 +120,7 @@ async def stop(self, ctx):
120
120
@commands .command (aliases = ['np' , 'n' , 'playing' ])
121
121
async def now (self , ctx ):
122
122
""" Shows some stats about the currently playing song. """
123
- player = self .bot .lavalink .players .get (ctx .guild .id )
123
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
124
124
125
125
if not player .current :
126
126
return await ctx .send ('Nothing playing.' )
@@ -139,7 +139,7 @@ async def now(self, ctx):
139
139
@commands .command (aliases = ['q' ])
140
140
async def queue (self , ctx , page : int = 1 ):
141
141
""" Shows the player's queue. """
142
- player = self .bot .lavalink .players .get (ctx .guild .id )
142
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
143
143
144
144
if not player .queue :
145
145
return await ctx .send ('Nothing queued.' )
@@ -162,7 +162,7 @@ async def queue(self, ctx, page: int = 1):
162
162
@commands .command (aliases = ['resume' ])
163
163
async def pause (self , ctx ):
164
164
""" Pauses/Resumes the current track. """
165
- player = self .bot .lavalink .players .get (ctx .guild .id )
165
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
166
166
167
167
if not player .is_playing :
168
168
return await ctx .send ('Not playing.' )
@@ -177,7 +177,7 @@ async def pause(self, ctx):
177
177
@commands .command (aliases = ['vol' ])
178
178
async def volume (self , ctx , volume ):
179
179
""" Changes the player's volume (0-1000). """
180
- player = self .bot .lavalink .players .get (ctx .guild .id )
180
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
181
181
182
182
try :
183
183
volume = int (volume )
@@ -193,7 +193,7 @@ async def volume(self, ctx, volume):
193
193
@commands .command ()
194
194
async def shuffle (self , ctx ):
195
195
""" Shuffles the player's queue. """
196
- player = self .bot .lavalink .players .get (ctx .guild .id )
196
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
197
197
if not player .is_playing :
198
198
return await ctx .send ('Nothing playing.' )
199
199
@@ -203,7 +203,7 @@ async def shuffle(self, ctx):
203
203
@commands .command (aliases = ['loop' , 'l' ])
204
204
async def repeat (self , ctx ):
205
205
""" Repeats the current song until the command is invoked again. """
206
- player = self .bot .lavalink .players .get (ctx .guild .id )
206
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
207
207
208
208
if not player .is_playing :
209
209
return await ctx .send ('Nothing playing.' )
@@ -214,7 +214,7 @@ async def repeat(self, ctx):
214
214
@commands .command ()
215
215
async def remove (self , ctx , index : int ):
216
216
""" Removes an item from the player's queue with the given index. """
217
- player = self .bot .lavalink .players .get (ctx .guild .id )
217
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
218
218
219
219
if not player .queue :
220
220
return await ctx .send ('Nothing queued.' )
@@ -229,7 +229,7 @@ async def remove(self, ctx, index: int):
229
229
@commands .command ()
230
230
async def find (self , ctx , * , query ):
231
231
""" Lists the first 10 search results from a given query. """
232
- player = self .bot .lavalink .players .get (ctx .guild .id )
232
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
233
233
234
234
if not query .startswith ('ytsearch:' ) and not query .startswith ('scsearch:' ):
235
235
query = 'ytsearch:' + query
@@ -253,7 +253,7 @@ async def find(self, ctx, *, query):
253
253
@commands .command (aliases = ['dc' ])
254
254
async def disconnect (self , ctx ):
255
255
""" Disconnects the player from the voice channel and clears its queue. """
256
- player = self .bot .lavalink .players .get (ctx .guild .id )
256
+ player = self .bot .lavalink .player_manager .get (ctx .guild .id )
257
257
258
258
if not player .is_connected :
259
259
return await ctx .send ('Not connected.' )
@@ -268,9 +268,7 @@ async def disconnect(self, ctx):
268
268
269
269
async def ensure_voice (self , ctx ):
270
270
""" This check ensures that the bot and command author are in the same voice channel. """
271
- player = self .bot .lavalink .players .create (ctx .guild .id , endpoint = str (ctx .guild .region ))
272
- # Create returns a player if one exists, otherwise creates.
273
-
271
+ player = self .bot .lavalink .player_manager .create (ctx .guild .id , endpoint = str (ctx .guild .region ))
274
272
should_connect = ctx .command .name in ('play' ) # Add commands that require joining voice to work.
275
273
276
274
if not ctx .author .voice or not ctx .author .voice .channel :
0 commit comments