RTByte/rtbyte

Footer for command embeds doesn't update depending on configured guild language

rasmusgerdin opened this issue · 0 comments

Describe the bug
The string for "Requested by X" footer field doesn't update depending on the configured guild language, instead only displaying in the default one (en-US).

To Reproduce
Steps to reproduce the behavior:

  1. Run any command that generates an embed.

Expected behavior
The footer field should be localized to the guild's configured language.

Screenshots
Guild language set to en-US:
image

Guild language set to sv-SE:
image

Additional context
The relevant line of code.

this.setFooter(i18next.t(LanguageKeys.System.RequestedBy, { requester: message.author.tag }), message.author.displayAvatarURL())

This should likely be done in a similar fashion to how we fetch language strings in listeners instead, example shown below. The async modifier is however not valid for a constructor declaration, meaning we can't await anything, so we need to pass the string to the embed in another way.

const guildSettings = await this.container.client.prisma.guildSettings.findFirst({ where: { guildID: channel.guild.id } })
const T = this.container.i18n.getT(guildSettings?.language as string)