use ChatInputCommandInteraction

This commit is contained in:
Mylloon 2022-07-28 00:18:16 +02:00
parent 86286a196d
commit af5fc917e5
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 10 additions and 10 deletions

View file

@ -96,7 +96,7 @@ nouvelle catégorie si votre commande n'entre dans aucune qui existe déjà.
Le contenu du fichier doit commencer comme suit : Le contenu du fichier doit commencer comme suit :
```typescript ```typescript
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from '@discordjs/builders';
import { Client, CommandInteraction } from 'discord.js'; import { Client, ChatInputCommandInteraction } from 'discord.js';
import { getLocale, getLocalizations } from '../../utils/locales'; import { getLocale, getLocalizations } from '../../utils/locales';
import { getFilename } from '../../utils/misc'; import { getFilename } from '../../utils/misc';
@ -115,7 +115,7 @@ export default {
); );
}, },
interaction: async (interaction: CommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
/* Votre code ici */ /* Votre code ici */

View file

@ -1,6 +1,6 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from '@discordjs/builders';
import { Locale } from 'discord-api-types/v9'; import { Locale } from 'discord-api-types/v9';
import { Client, CommandInteraction, EmbedBuilder } from 'discord.js'; import { Client, ChatInputCommandInteraction, EmbedBuilder } from 'discord.js';
import { getLocale, getLocalizations } from '../../utils/locales'; import { getLocale, getLocalizations } from '../../utils/locales';
import { getFilename } from '../../utils/misc'; import { getFilename } from '../../utils/misc';
import '../../modules/string'; import '../../modules/string';
@ -31,12 +31,12 @@ export default {
); );
}, },
interaction: async (interaction: CommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const desired_command = interaction.options.get(client const desired_command = interaction.options.getString(client
.locales .locales
.get(client.config.default_lang) .get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? '')?.value as string; ?.get(`c_${getFilename(__filename)}_opt1_name`) ?? '');
// If a command isn't specified // If a command isn't specified
if (!desired_command) { if (!desired_command) {

View file

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from '@discordjs/builders';
import { Client, CommandInteraction, Message } from 'discord.js'; import { ChatInputCommandInteraction, Client, Message } from 'discord.js';
import { getLocale, getLocalizations } from '../../utils/locales'; import { getLocale, getLocalizations } from '../../utils/locales';
import { getFilename } from '../../utils/misc'; import { getFilename } from '../../utils/misc';
@ -18,7 +18,7 @@ export default {
); );
}, },
interaction: async (interaction: CommandInteraction, client: Client) => { interaction: async (interaction: ChatInputCommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale); const loc = getLocale(client, interaction.locale);
const sent = await interaction.reply({ const sent = await interaction.reply({