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

@ -11,8 +11,8 @@ une [Pull Request](https://git.kennel.ml/ConfrerieDuKassoulait/Botanique/pulls).
## Sommaire <!-- omit in toc -->
- [Recevoir de l'aide](#recevoir-de-laide)
- [Langues](#langues)
- [Ajouter une langue](#ajouter-une-langue)
- [Mettre à jour une langue](#mettre-à-jour-une-langue)
- [Ajouter une langue](#ajouter-une-langue)
- [Mettre à jour une langue](#mettre-à-jour-une-langue)
- [Projet](#projet)
- [Ajouter une commande](#ajouter-une-commande)
- [Ajouter un évènement](#ajouter-un-évènement)
@ -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 :
```typescript
import { SlashCommandBuilder } from '@discordjs/builders';
import { Client, CommandInteraction } from 'discord.js';
import { Client, ChatInputCommandInteraction } from 'discord.js';
import { getLocale, getLocalizations } from '../../utils/locales';
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);
/* Votre code ici */

View file

@ -1,6 +1,6 @@
import { SlashCommandBuilder } from '@discordjs/builders';
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 { getFilename } from '../../utils/misc';
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 desired_command = interaction.options.get(client
const desired_command = interaction.options.getString(client
.locales
.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 (!desired_command) {

View file

@ -1,5 +1,5 @@
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 { 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 sent = await interaction.reply({