#locales in interactions?

3 messages · Page 1 of 1 (latest)

rustic raven
#

so i have a command that handles locales, it has buttons and those are handled in a different event handling file. but I cannot figure out how to extract locale from interactions.

client.on(Events.InteractionCreate, async interaction => {
    let userLocale = interaction.member ? interaction.member.locale : (interaction.user.locale || 'en');

    console.log('User's Discord Locale: ${userLocale}');

    // code
    
    // Set the locale for i18n
    i18n.setLocale(userLocale);
    console.log('bot.js Current i18n locale: ${i18n.getLocale()}');
}); ```

Prior to that initial let, i had:

`    let userLocale = interaction.user.locale || 'en';` 

which also didn't achieve the results either
solar quailBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
ripe blazeBOT