Put all strings of Last.fm on another JSON object

This commit is contained in:
Lucas Gabriel 2025-01-10 11:28:27 -03:00
parent 629401dee8
commit b5e220b284
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985
3 changed files with 30 additions and 26 deletions

View File

@ -66,7 +66,7 @@ module.exports = (bot) => {
const lastUser = ctx.message.text.split(' ')[1];
if (!lastUser) {
return ctx.reply(Strings.lastFmNoUser, {
return ctx.reply(Strings.lastFm.noUser, {
parse_mode: "Markdown",
disable_web_page_preview: true,
reply_to_message_id: ctx.message.message_id
@ -76,7 +76,7 @@ module.exports = (bot) => {
users[userId] = lastUser;
saveUsers();
const message = Strings.lastFmUserSet.replace('{lastUser}', lastUser);
const message = Strings.lastFm.userHasBeenSet.replace('{lastUser}', lastUser);
ctx.reply(message, {
parse_mode: "Markdown",
@ -93,7 +93,7 @@ module.exports = (bot) => {
const botInfo = await ctx.telegram.getMe();
if (!lastfmUser) {
return ctx.reply(Strings.lastFmNoSet, {
return ctx.reply(Strings.lastFm.noUserSet, {
parse_mode: "Markdown",
disable_web_page_preview: true,
reply_to_message_id: ctx.message.message_id
@ -117,7 +117,7 @@ module.exports = (bot) => {
const track = response.data.recenttracks.track[0];
if (!track) {
const noRecent = Strings.lastFmNoRecent.replace('{lastfmUser}', lastfmUser);
const noRecent = Strings.lastFm.noRecentTracks.replace('{lastfmUser}', lastfmUser);
return ctx.reply(noRecent, {
parse_mode: "Markdown",
disable_web_page_preview: true,
@ -170,7 +170,7 @@ module.exports = (bot) => {
};
} catch (err) {
console.log(err)
const message = Strings.lastFmErr
const message = Strings.lastFm.apiErr
.replace("{lastfmUser}", `[${lastfmUser}](${userUrl})`)
.replace("{err}", err);
ctx.reply(message, {
@ -180,7 +180,7 @@ module.exports = (bot) => {
});
};
let message = Strings.lastFmStatusFor
let message = Strings.lastFm.listeningTo
.replace("{lastfmUser}", `[${lastfmUser}](${userUrl})`)
.replace("{nowPlaying}", nowPlaying)
.replace("{trackName}", `[${trackName}](${trackUrl})`)
@ -188,7 +188,7 @@ module.exports = (bot) => {
if (`${num_plays}` !== "0" && `${num_plays}` !== "1" && `${num_plays}` !== "2" && `${num_plays}` !== "3") {
message = message
.replace("{playCount}", Strings.lastFmPlayCount)
.replace("{playCount}", Strings.lastFm.playCount)
.replace("{plays}", `${num_plays}`);
} else {
message = message
@ -211,7 +211,7 @@ module.exports = (bot) => {
};
} catch (err) {
const userUrl = `https://www.last.fm/user/${encodeURIComponent(lastfmUser)}`;
const message = Strings.lastFmErr
const message = Strings.lastFm.apiErr
.replace("{lastfmUser}", `[${lastfmUser}](${userUrl})`)
.replace("{err}", err);
ctx.reply(message, {

View File

@ -38,13 +38,17 @@
"chatInfo": "*Chat info*\n\n*Name:* `{chatName}`\n*Chat ID:* `{chatId}`\n*Handle:* `{chatHandle}`\n*Type:* `{chatType}`\n*Members:* `{chatMembersCount}`\n*Is a forum:* `{isForum}`",
"funEmojiResult": "*You rolled {emoji} and got* `{value}`*!*\nYou don't know what that means? Me neither!",
"gifErr": "*Something went wrong while sending the GIF. Please try again later.*\n\n{err}",
"lastFmNoUser": "*Please provide a Last.fm username.*\nExample: `/setuser <username>`",
"lastFmNoSet": "*You haven't set your Last.fm username yet.*\nUse the command /setuser to set.\n\nExample: `/setuser <username>`",
"lastFmNoRecent": "*No recent tracks found for Last.fm user* `{lastfmUser}`*.*",
"lastFmUserSet": "*Your Last.fm username has been set to:* `{lastUser}`.",
"lastFmStatusFor": "{lastfmUser} *{nowPlaying} listening {playCount}*:\n\n{trackName} by {artistName}",
"lastFmPlayCount": "by the {plays}th time",
"lastFmErr": "*Error retrieving data for Last.fm user* {lastfmUser}.\n\n`{err}`",
"lastFm": {
"helpEntry": "Last.fm",
"helpDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Shows the last song from your Last.fm profile + the number of plays.\n- /setuser `<user>`: Sets the user for the command above.",
"noUser": "*Please provide a Last.fm username.*\nExample: `/setuser <username>`",
"noUserSet": "*You haven't set your Last.fm username yet.*\nUse the command /setuser to set.\n\nExample: `/setuser <username>`",
"noRecentTracks": "*No recent tracks found for Last.fm user* `{lastfmUser}`*.*",
"userHasBeenSet": "*Your Last.fm username has been set to:* `{lastUser}`.",
"listeningTo": "{lastfmUser} *{nowPlaying} listening {playCount}*:\n\n{trackName} by {artistName}",
"playCount": "by the {plays}th time",
"apiErr": "*Error retrieving data for Last.fm user* {lastfmUser}.\n\n`{err}`"
},
"gitCurrentCommit": "*Current commit:* `{commitHash}`",
"gitErrRetrievingCommit": "*Error retrieving commit:* {error}",
"weatherStatus": {
@ -63,8 +67,6 @@
"interactiveEmojisDesc": "*Interactive emojis*\n\n- /dice: Roll a dice\n- /idice: Infinitely roll a colored dice\n- /slot: Try to combine the figures!\n- /ball: Try to kick the ball into the goal!\n- /bowling: Try to hit the pins!\n- /dart: Try to hit the target!",
"ytDlp": "Video download",
"ytDlpDesc": "*Video download*\n\n- /yt | /ytdl | /sdl | /dl | /video `<video link>`: Download a video from some platforms (e.g. YouTube, Instagram, Facebook, etc.).\n\n See [this link](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) for more information and which services are supported.\n\n*Note: Telegram is currently limiting bot uploads to 50MB, which means that if the video you want to download is larger than 50MB, the quality will be reduced to try to upload it anyway. We're trying our best to work around or fix this problem.*",
"lastFm": "Last.fm",
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Shows the last song from your Last.fm profile + the number of plays.\n- /setuser `<user>`: Sets the user for the command above.",
"animalCommands": "Animals",
"animalCommandsDesc": "*Animals*\n\n- /soggy | /soggycat `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Sends the [Soggy cat meme](https://knowyourmeme.com/memes/soggy-cat)\n - /cat `<tags>`: Sends a random picture of a cat. You can specify some tags, separating each by a comma. Example: `/cat orange, cute`\n- /dog: Sends a random picture of a dog.\n- /httpcat `<http code>`: Send cat memes from http.cat with your specified HTTP code. Example: `/httpcat 404`",
"myLittlePony": "My Little Pony",

View File

@ -38,13 +38,17 @@
"chatInfo": "*Informações do chat*\n\n*Nome:* `{chatName}`\n*ID do chat:* `{chatId}`\n*Identificador:* `{chatHandle}`\n*Tipo:* `{chatType}`\n*Membros:* `{chatMembersCount}`\n*É um fórum:* `{isForum}`",
"funEmojiResult": "*Você lançou {emoji} e obteve *`{value}`*!*\nVocê não sabe o que isso significa? Nem eu!",
"gifErr": "*Algo deu errado ao enviar o GIF. Tente novamente mais tarde.*\n\n{err}",
"lastFmNoUser": "*Por favor, forneça um nome de usuário do Last.fm.*\nExemplo: `/setuser <username>`",
"lastFmNoSet": "*Você ainda não definiu seu nome de usuário do Last.fm.*\nUse o comando /setuser para definir.\n\nExemplo: `/setuser <username>`",
"lastFmNoRecent": "*Nenhuma faixa recente encontrada para o usuário do Last.fm* `{lastfmUser}`*.*",
"lastFmUserSet": "*Seu nome de usuário do Last.fm foi definido como:* `{lastUser}`.",
"lastFmStatusFor": "{lastfmUser} *{nowPlaying} ouvindo{playCount}*:\n\n{trackName} por {artistName}",
"lastFmPlayCount": " pela {plays}ª vez",
"lastFmErr": "*Erro ao recuperar dados para o usuário do Last.fm* {lastfmUser}.\n\n`{err}`",
"lastFm": {
"helpEntry": "Last.fm",
"helpDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Mostra a última música do seu perfil no Last.fm + o número de reproduções.\n- /setuser `<usuário>`: Define o usuário para o comando acima.",
"noUser": "*Por favor, forneça um nome de usuário do Last.fm.*\nExemplo: `/setuser <username>`",
"noUserSet": "*Você ainda não definiu seu nome de usuário do Last.fm.*\nUse o comando /setuser para definir.\n\nExemplo: `/setuser <username>`",
"noRecentTracks": "*Nenhuma faixa recente encontrada para o usuário do Last.fm* `{lastfmUser}`*.*",
"userHasBeenSet": "*Seu nome de usuário do Last.fm foi definido como:* `{lastUser}`.",
"listeningTo": "{lastfmUser} *{nowPlaying} ouvindo{playCount}*:\n\n{trackName} por {artistName}",
"playCount": " pela {plays}ª vez",
"apiErr": "*Erro ao recuperar dados para o usuário do Last.fm* {lastfmUser}.\n\n`{err}`"
},
"gitCurrentCommit": "*Commit atual:* `{commitHash}`",
"gitErrRetrievingCommit": "*Erro ao obter o commit:*\n\n`{error}`",
"weatherStatus": {
@ -63,8 +67,6 @@
"interactiveEmojisDesc": "*Emojis interativos*\n\n- /dice: Jogue um dado\n- /idice: Role infinitamente um dado colorido\n- /slot: Tente combinar as figuras!\n- /ball: Tente chutar a bola no gol!\n- /bowling: Tente derrubar os pinos!\n- /dart: Tente acertar o alvo!",
"ytDlp": "Download de vídeos",
"ytDlpDesc": "*Download de vídeos*\n\n- /yt | /ytdl | /sdl | /dl | /video `<link do vídeo>`: Baixa um vídeo de algumas plataformas (ex: YouTube, Instagram, Facebook, etc.).\n\nConsulte [este link](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) para obter mais informações e saber quais serviços são compatíveis.\n\n*Nota: O Telegram está atualmente limitando os uploads de bots a 50MB, o que significa que se o vídeo que você deseja baixar for maior que 50MB, a qualidade será reduzida para tentar carregá-lo de qualquer maneira. Estamos fazendo o possível para contornar ou corrigir esse problema.*",
"lastFm": "Last.fm",
"lastFmDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Mostra a última música do seu perfil no Last.fm + o número de reproduções.\n- /setuser `<usuário>`: Define o usuário para o comando acima.",
"animalCommands": "Animais",
"animalCommandsDesc": "*Animais*\n\n- /soggy | /soggycat `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envia o [meme do gato encharcado](https://knowyourmeme.com/memes/soggy-cat)\n- /cat `<tags>` - Envia uma foto aleatória de um gato. Você pode especificar algumas tags em inglês, separando cada uma por uma vírgula. Exemplo: `/cat orange, cute`\n- /dog - Envia uma imagem aleatória de um cachorro.\n- /httpcat `<código http>`: Envia memes de gato do http.cat com o código HTTP especificado. Exemplo: `/httpcat 404`",
"myLittlePony": "My Little Pony",