Ꮢ
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by on 9/20/2024 in #djs-questions
Cannot access localizations
I implemented the help command as follows, but I am having trouble getting Japanese from localizations Does anyone know the correct way to do this?
async execute(interaction) {
const { client } = interaction;
let commands = await client.application.commands.fetch();

if (interaction.guild) {
const guildCommands = await interaction.guild.commands.fetch();
commands = new Map([...commands, ...guildCommands]);
}

const userLocale = interaction.locale;
const isJapanese = userLocale === 'ja'; // Confirmed to be "true"

const embed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(isJapanese ? '利用可能なコマンド' : 'Available Commands')
.setDescription(isJapanese ? '以下は現在利用可能なコマンドのリストです' : 'Here is a list of currently available commands');

commands.forEach(command => {
if (command.name !== 'help') {
let description = command.description || (isJapanese ? '説明なし' : 'No description');
if (isJapanese && command?.descriptionLocalizations?.['ja']) { // Can't get through.
description = command.descriptionLocalizations['ja'];
}
embed.addFields({
name: `</${command.name}:${command.id}>`,
value: description,
inline: true
});
}
});
embed.setFooter({
text: isJapanese
? '注意: 一部のコマンドは特定のサーバーまたはユーザーインストールでのみ使用できます。'
: 'Note: Some commands may only be available in specific servers or user installations.'
});
await interaction.reply({ embeds: [embed], ephemeral: true });
},
};
async execute(interaction) {
const { client } = interaction;
let commands = await client.application.commands.fetch();

if (interaction.guild) {
const guildCommands = await interaction.guild.commands.fetch();
commands = new Map([...commands, ...guildCommands]);
}

const userLocale = interaction.locale;
const isJapanese = userLocale === 'ja'; // Confirmed to be "true"

const embed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle(isJapanese ? '利用可能なコマンド' : 'Available Commands')
.setDescription(isJapanese ? '以下は現在利用可能なコマンドのリストです' : 'Here is a list of currently available commands');

commands.forEach(command => {
if (command.name !== 'help') {
let description = command.description || (isJapanese ? '説明なし' : 'No description');
if (isJapanese && command?.descriptionLocalizations?.['ja']) { // Can't get through.
description = command.descriptionLocalizations['ja'];
}
embed.addFields({
name: `</${command.name}:${command.id}>`,
value: description,
inline: true
});
}
});
embed.setFooter({
text: isJapanese
? '注意: 一部のコマンドは特定のサーバーまたはユーザーインストールでのみ使用できます。'
: 'Note: Some commands may only be available in specific servers or user installations.'
});
await interaction.reply({ embeds: [embed], ephemeral: true });
},
};
[example command]
module.exports = {
global: true,
data: new SlashCommandBuilder()
.setName('search')
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall)
.setContexts(InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel)
.setDescription('Searches for elements by the specified search character')
.setDescriptionLocalizations({
'ja': '指定した検索文字で要素を検索します'
})
...
module.exports = {
global: true,
data: new SlashCommandBuilder()
.setName('search')
.setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall)
.setContexts(InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel)
.setDescription('Searches for elements by the specified search character')
.setDescriptionLocalizations({
'ja': '指定した検索文字で要素を検索します'
})
...
Thanks for your help.
8 replies
RRailway
Created by on 9/12/2024 in #✋|help
Usage page issue and clearly broken Estimated Bill
No description
12 replies
RRailway
Created by on 7/31/2023 in #✋|help
Please answer some questions
1. I am currently using the "Developer Plan". When is the appropriate time to switch to the "Hobby Plan"? Also, will the "Hobby Plan" price be applied in addition to the existing fee at the moment of the switch? 2. I saw an article that some people will continue to receive the $5/month free slot, is there any way to check to see if they are eligible for that? 3. If I continue with the "Developer Plan" without changing it, when will it stop? (If possible, please provide the time in Japan.) Also, is it possible to switch to the Hobby Plan after that? 4. Finally, what is the difference, if any, between a "Developer Plan" and a "Hobby Plan"? Also, please let us know if there are any points to keep in mind when making the switch. Thank you for your cooperation.
19 replies
RRailway
Created by on 6/22/2023 in #✋|help
Can't delete old deployment
32 replies