#locales in interactions?

1 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