@@ -67,7 +67,7 @@ async def nowplay(ctx: commands.Context, player: voicelink.Player):
6767 icon = ":red_circle:" if track .is_stream else (":pause_button:" if player .is_paused else ":arrow_forward:" )
6868 embed .add_field (name = "\u2800 " , value = f"{ icon } { pbar } **[{ ctime (player .position )} /{ track .formatted_length } ]**" , inline = False )
6969
70- return await ctx . send (embed = embed , view = LinkView (texts [2 ].format (track .source ), track .emoji , track .uri ))
70+ return await send (ctx , embed , view = LinkView (texts [2 ].format (track .source ), track .emoji , track .uri ))
7171
7272class Basic (commands .Cog ):
7373 def __init__ (self , bot : commands .Bot ) -> None :
@@ -148,9 +148,16 @@ async def play(self, ctx: commands.Context, *, query: str, start: str = "0", end
148148 else :
149149 position = await player .add_track (tracks [0 ], start_time = format_time (start ), end_time = format_time (end ))
150150 texts = await get_lang (ctx .guild .id , "live" , "trackLoad_pos" , "trackLoad" )
151- await ctx .send ((f"`{ texts [0 ]} `" if tracks [0 ].is_stream else "" ) + (texts [1 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length , position ) if position >= 1 and player .is_playing else texts [2 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length )), allowed_mentions = False )
152- except voicelink .QueueFull as e :
153- await ctx .send (e )
151+
152+ stream_content = f"`{ texts [0 ]} `" if tracks [0 ].is_stream else ""
153+ additional_content = texts [1 ] if position >= 1 and player .is_playing else texts [2 ]
154+
155+ await send (
156+ ctx ,
157+ stream_content + additional_content ,
158+ tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length ,
159+ position if position >= 1 and player .is_playing else None
160+ )
154161 finally :
155162 if not player .is_playing :
156163 await player .do_next ()
@@ -189,10 +196,16 @@ async def _play(self, interaction: discord.Interaction, message: discord.Message
189196 else :
190197 position = await player .add_track (tracks [0 ])
191198 texts = await get_lang (interaction .guild .id , "live" , "trackLoad_pos" , "trackLoad" )
192- await interaction .followup .send ((f"`{ texts [0 ]} `" if tracks [0 ].is_stream else "" ) + (texts [1 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length , position ) if position >= 1 and player .is_playing else texts [2 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length )), allowed_mentions = False )
193- except voicelink .QueueFull as e :
194- await interaction .followup .send (e )
195199
200+ stream_content = f"`{ texts [0 ]} `" if tracks [0 ].is_stream else ""
201+ additional_content = texts [1 ] if position >= 1 and player .is_playing else texts [2 ]
202+
203+ await send (
204+ interaction ,
205+ stream_content + additional_content ,
206+ tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length ,
207+ position if position >= 1 and player .is_playing else None
208+ )
196209 finally :
197210 if not player .is_playing :
198211 await player .do_next ()
@@ -227,7 +240,7 @@ async def search(self, ctx: commands.Context, *, query: str, platform: str = Sea
227240 query_track = "\n " .join (f"`{ index } .` `[{ track .formatted_length } ]` **{ track .title [:35 ]} **" for index , track in enumerate (tracks [0 :10 ], start = 1 ))
228241 embed = discord .Embed (title = texts [0 ].format (query ), description = texts [1 ].format (get_source (platform , "emoji" ), platform , len (tracks [0 :10 ]), query_track ), color = settings .embed_color )
229242 view = SearchView (tracks = tracks [0 :10 ], texts = [texts [5 ], texts [6 ]])
230- view .response = await ctx . send (embed = embed , view = view , ephemeral = True )
243+ view .response = await send (ctx , embed , view = view , ephemeral = True )
231244
232245 await view .wait ()
233246 if view .values is not None :
@@ -236,7 +249,7 @@ async def search(self, ctx: commands.Context, *, query: str, platform: str = Sea
236249 track = tracks [int (value .split (". " )[0 ]) - 1 ]
237250 position = await player .add_track (track )
238251 msg += (f"`{ texts [2 ]} `" if track .is_stream else "" ) + (texts [3 ].format (track .title , track .uri , track .author , track .formatted_length , position ) if position >= 1 else texts [4 ].format (track .title , track .uri , track .author , track .formatted_length ))
239- await ctx . send (msg , allowed_mentions = False )
252+ await send (ctx , msg )
240253
241254 if not player .is_playing :
242255 await player .do_next ()
@@ -272,11 +285,16 @@ async def playtop(self, ctx: commands.Context, *, query: str, start: str = "0",
272285 else :
273286 position = await player .add_track (tracks [0 ], start_time = format_time (start ), end_time = format_time (end ), at_front = True )
274287 texts = await get_lang (ctx .guild .id , "live" , "trackLoad_pos" , "trackLoad" )
275- await ctx .send ((f"`{ texts [0 ]} `" if tracks [0 ].is_stream else "" ) + (texts [1 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length , position ) if position >= 1 and player .is_playing else texts [2 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length )), allowed_mentions = False )
276-
277- except voicelink .QueueFull as e :
278- await ctx .send (e )
279288
289+ stream_content = f"`{ texts [0 ]} `" if tracks [0 ].is_stream else ""
290+ additional_content = texts [1 ] if position >= 1 and player .is_playing else texts [2 ]
291+
292+ await send (
293+ ctx ,
294+ stream_content + additional_content ,
295+ tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length ,
296+ position if position >= 1 and player .is_playing else None
297+ )
280298 finally :
281299 if not player .is_playing :
282300 await player .do_next ()
@@ -311,11 +329,14 @@ async def forceplay(self, ctx: commands.Context, *, query: str, start: str = "0"
311329 else :
312330 texts = await get_lang (ctx .guild .id , "live" , "trackLoad" )
313331 await player .add_track (tracks [0 ], start_time = format_time (start ), end_time = format_time (end ), at_front = True )
314- await ctx .send ((f"`{ texts [0 ]} `" if tracks [0 ].is_stream else "" ) + texts [1 ].format (tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length ), allowed_mentions = False )
315332
316- except voicelink .QueueFull as e :
317- await ctx .send (e )
333+ stream_content = f"`{ texts [0 ]} `" if tracks [0 ].is_stream else ""
318334
335+ await send (
336+ ctx ,
337+ stream_content + texts [1 ],
338+ tracks [0 ].title , tracks [0 ].uri , tracks [0 ].author , tracks [0 ].formatted_length ,
339+ )
319340 finally :
320341 if player .queue ._repeat .mode == voicelink .LoopType .TRACK :
321342 await player .set_repeat (voicelink .LoopType .OFF )
@@ -471,7 +492,7 @@ async def queue(self, ctx: commands.Context):
471492 if player .queue .is_empty :
472493 return await nowplay (ctx , player )
473494 view = ListView (player = player , author = ctx .author )
474- view .response = await ctx . send (embed = await view .build_embed (), view = view )
495+ view .response = await send (ctx , await view .build_embed (), view = view )
475496
476497 @queue .command (name = "export" , aliases = get_aliases ("export" ))
477498 @commands .dynamic_cooldown (cooldown_check , commands .BucketType .guild )
@@ -532,10 +553,6 @@ async def _import(self, ctx: commands.Context, attachment: discord.Attachment):
532553
533554 index = await player .add_track (tracks )
534555 await send (ctx , "playlistLoad" , attachment .filename , index )
535-
536- except voicelink .QueueFull as e :
537- return await ctx .send (e , ephemeral = True )
538-
539556 except Exception as e :
540557 logger .error ("error" , exc_info = e )
541558 raise e
@@ -559,7 +576,7 @@ async def history(self, ctx: commands.Context):
559576 return await nowplay (ctx , player )
560577
561578 view = ListView (player = player , author = ctx .author , is_queue = False )
562- view .response = await ctx . send (embed = await view .build_embed (), view = view )
579+ view .response = await send (ctx , await view .build_embed (), view = view )
563580
564581 @commands .hybrid_command (name = "leave" , aliases = get_aliases ("leave" ))
565582 @commands .dynamic_cooldown (cooldown_check , commands .BucketType .guild )
@@ -653,7 +670,7 @@ async def remove(self, ctx: commands.Context, position1: int, position2: int = N
653670 await send (ctx , "removed" , len (removed_tracks .keys ()))
654671
655672 @commands .hybrid_command (name = "forward" , aliases = get_aliases ("forward" ))
656- @app_commands .describe (position = "Input a amount that you to forward to. Exmaple: 1:20" )
673+ @app_commands .describe (position = "Input an amount that you to forward to. Exmaple: 1:20" )
657674 @commands .dynamic_cooldown (cooldown_check , commands .BucketType .guild )
658675 async def forward (self , ctx : commands .Context , position : str = "10" ):
659676 "Forwards by a certain amount of time in the current track. The default is 10 seconds."
@@ -674,7 +691,7 @@ async def forward(self, ctx: commands.Context, position: str = "10"):
674691 await send (ctx , "forward" , ctime (player .position + num ))
675692
676693 @commands .hybrid_command (name = "rewind" , aliases = get_aliases ("rewind" ))
677- @app_commands .describe (position = "Input a amount that you to rewind to. Exmaple: 1:20" )
694+ @app_commands .describe (position = "Input an amount that you to rewind to. Exmaple: 1:20" )
678695 @commands .dynamic_cooldown (cooldown_check , commands .BucketType .guild )
679696 async def rewind (self , ctx : commands .Context , position : str = "10" ):
680697 "Rewind by a certain amount of time in the current track. The default is 10 seconds."
@@ -785,7 +802,7 @@ async def lyrics(self, ctx: commands.Context, title: str = "", artist: str = "")
785802 return await send (ctx , "lyricsNotFound" , ephemeral = True )
786803
787804 view = LyricsView (name = title , source = {_ : re .findall (r'.*\n(?:.*\n){,22}' , v ) for _ , v in song .items ()}, author = ctx .author )
788- view .response = await ctx . send (embed = view .build_embed (), view = view )
805+ view .response = await send (ctx , view .build_embed (), view = view )
789806
790807 @commands .hybrid_command (name = "swapdj" , aliases = get_aliases ("swapdj" ))
791808 @app_commands .describe (member = "Choose a member to transfer the dj role." )
@@ -841,7 +858,7 @@ async def help(self, ctx: commands.Context, category: str = "News") -> None:
841858 category = "News"
842859 view = HelpView (self .bot , ctx .author )
843860 embed = view .build_embed (category )
844- view .response = await ctx . send (embed = embed , view = view )
861+ view .response = await send (ctx , embed , view = view )
845862
846863 @commands .hybrid_command (name = "ping" , aliases = get_aliases ("ping" ))
847864 @commands .dynamic_cooldown (cooldown_check , commands .BucketType .guild )
@@ -866,7 +883,7 @@ async def ping(self, ctx: commands.Context):
866883 inline = False
867884 )
868885
869- await ctx . send (embed = embed )
886+ await send (ctx , embed )
870887
871888async def setup (bot : commands .Bot ) -> None :
872889 await bot .add_cog (Basic (bot ))
0 commit comments