use ChatInputCommandInteraction
This commit is contained in:
parent
86286a196d
commit
af5fc917e5
3 changed files with 10 additions and 10 deletions
|
@ -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 */
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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({
|
||||||
|
|
Loading…
Reference in a new issue