mirror of
https://github.com/UiO-Gaming/ShiteMusicBot.git
synced 2026-11-05 13:56:51 +01:00
(correctly) add localization support to lyrics command
This commit is contained in:
1 file changed
+5
-4
@@ -637,7 +637,7 @@ class Music(commands.Cog):
|
||||
""" Search for lyrics of a song """
|
||||
# Check for API key
|
||||
if not (genius_access_token := self.bot.APIkeys.get('genius')):
|
||||
return await ctx.send('{errors.missing_api_key}')
|
||||
return await ctx.send(ctx.localizer.format_str('{history.title}'))
|
||||
|
||||
# Extract all arguments into a single string
|
||||
query = ' '.join(query)
|
||||
@@ -646,7 +646,7 @@ class Music(commands.Cog):
|
||||
if not query:
|
||||
player = self.get_player(ctx.guild)
|
||||
if not player.is_playing:
|
||||
return await ctx.send('{nothing_playing}')
|
||||
return await ctx.send(ctx.localizer.format_str('{nothing_playing}'))
|
||||
query = player.current.title
|
||||
|
||||
# Filter out unwanted words to improve chances of finding the correct song
|
||||
@@ -665,7 +665,8 @@ class Music(commands.Cog):
|
||||
header = {} if scrape else {'Authorization': f'Bearer {genius_access_token}'}
|
||||
async with self.bot.session.get(url, headers=header) as r:
|
||||
if r.status != 200:
|
||||
embed = discord.Embed(description="{errors.error_occurred}", color=0xFF0000)
|
||||
embed = discord.Embed(description=ctx.localizer.format_str('{errors.error_occurred}'),
|
||||
color=0xFF0000)
|
||||
await status_msg.edit(embed=embed)
|
||||
return
|
||||
if scrape:
|
||||
@@ -687,7 +688,7 @@ class Music(commands.Cog):
|
||||
break
|
||||
song_url = song['url']
|
||||
except KeyError:
|
||||
embed = discord.Embed(description='{nothing_found}', color=0xFF0000)
|
||||
embed = discord.Embed(description=ctx.localizer.format_str('{nothing_found}'), color=0xFF0000)
|
||||
return await status_msg.edit(embed=embed)
|
||||
|
||||
# Scrape the lyrics from the song page
|
||||
|
||||
Reference in new issue
Block a user