feat: support of buttons
This commit is contained in:
parent
0299770ec1
commit
eb741f409a
2 changed files with 17 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { Client, Interaction, InteractionType } from 'discord.js';
|
import { Client, ComponentType, Interaction, InteractionType } from 'discord.js';
|
||||||
import { getLocale } from '../../utils/locales';
|
import { getLocale } from '../../utils/locales';
|
||||||
|
|
||||||
/** https://discord.js.org/#/docs/discord.js/main/class/Client?scrollTo=e-interactionCreate */
|
/** https://discord.js.org/#/docs/discord.js/main/class/Client?scrollTo=e-interactionCreate */
|
||||||
|
@ -29,6 +29,21 @@ export default (interaction: Interaction, client: Client) => {
|
||||||
return modal.interaction(interaction, client);
|
return modal.interaction(interaction, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case InteractionType.MessageComponent:
|
||||||
|
if (interaction.componentType == ComponentType.Button) {
|
||||||
|
const button = client.buttons.list.get(interaction.customId);
|
||||||
|
if (!button) {
|
||||||
|
return interaction.reply({
|
||||||
|
content: loc.get('e_interacreate_no_button'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return interaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle only buttons for now
|
||||||
|
throw RangeError;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"e_interacreate_no_command": "Désolé, la commande n'existe plus...",
|
"e_interacreate_no_command": "Désolé, la commande n'existe plus...",
|
||||||
"e_interacreate_no_modal": "Désolé, le modèle n'existe plus...",
|
"e_interacreate_no_modal": "Désolé, le modèle n'existe plus...",
|
||||||
|
"e_interacreate_no_button": "Désolé, le bouton n'existe plus...",
|
||||||
|
|
||||||
"c_ping_name": "Ping",
|
"c_ping_name": "Ping",
|
||||||
"c_ping_desc": "Pong!",
|
"c_ping_desc": "Pong!",
|
||||||
|
|
Loading…
Reference in a new issue