Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b79be2df41 | |||
| 12cd8cae7a | |||
| 61a97fcb7f |
14
package-lock.json
generated
14
package-lock.json
generated
@@ -9,7 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.24.1",
|
"discord.js": "^14.24.2",
|
||||||
"dotenv": "^17.2.2"
|
"dotenv": "^17.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -177,9 +177,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.9.1",
|
"version": "24.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.2.tgz",
|
||||||
"integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==",
|
"integrity": "sha512-uWN8YqxXxqFMX2RqGOrumsKeti4LlmIMIyV0lgut4jx7KQBcBiW6vkDtIBvHnHIquwNfJhk8v2OtmO8zXWHfPA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
@@ -214,9 +214,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/discord.js": {
|
"node_modules/discord.js": {
|
||||||
"version": "14.24.1",
|
"version": "14.24.2",
|
||||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.24.1.tgz",
|
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.24.2.tgz",
|
||||||
"integrity": "sha512-LzL+MTGxB9mBwD8FjvkMwcIL4UtgG04e713U3+euqPCvOphhoVEoPpUNTvBPw4iJOas2uiuuh3JcveYSxIn8Tg==",
|
"integrity": "sha512-VMEDbmguRdX/EeMaTsf9Mb0IQA90WdYF2cn4QDfslQFXgQ6LFtmlPn0FSotnS0kcFbFp+JBSIxtnF+bnAHG/hQ==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^1.13.0",
|
"@discordjs/builders": "^1.13.0",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"typescript": "^5.9.2"
|
"typescript": "^5.9.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.24.1",
|
"discord.js": "^14.24.2",
|
||||||
"dotenv": "^17.2.2"
|
"dotenv": "^17.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/commands/utility/button.ts
Normal file
30
src/commands/utility/button.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, MessageFlags, SlashCommandBuilder } from "discord.js";
|
||||||
|
import { CommandDefinition } from "../../type";
|
||||||
|
|
||||||
|
const cmd : CommandDefinition = {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('button')
|
||||||
|
.setDescription('Demo button'),
|
||||||
|
async execute(interaction) {
|
||||||
|
|
||||||
|
const button = new ButtonBuilder()
|
||||||
|
.setCustomId('test-button')
|
||||||
|
.setLabel('Click me !')
|
||||||
|
.setStyle(ButtonStyle.Success);
|
||||||
|
|
||||||
|
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||||
|
.addComponents(button);
|
||||||
|
|
||||||
|
await interaction.reply({content: 'Oh one button !', components: [row]})
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: 'test-button',
|
||||||
|
async handle(interaction) {
|
||||||
|
await interaction.reply({content: 'Clicked !', flags: [MessageFlags.Ephemeral]});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default cmd;
|
||||||
@@ -5,7 +5,7 @@ const cmd : CommandDefinition = {
|
|||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('ping')
|
.setName('ping')
|
||||||
.setDescription('Pong again!'),
|
.setDescription('Pong again!'),
|
||||||
async execute(interaction : ChatInputCommandInteraction) {
|
async execute(interaction) {
|
||||||
await interaction.reply('Pong !');
|
await interaction.reply('Pong !');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
src/type.d.ts
vendored
4
src/type.d.ts
vendored
@@ -1 +1,3 @@
|
|||||||
export type CommandDefinition = { data: SlashCommandBuilder, execute: (interaction: ChatInputCommandInteraction) => void, buttons?: { id: string, handle: (interaction: ButtonInteraction) => void}[]};
|
import { ButtonInteraction, ChatInputCommandInteraction, SlashCommandOptionsOnlyBuilder } from "discord.js";
|
||||||
|
|
||||||
|
export type CommandDefinition = { data: SlashCommandBuilder | SlashCommandOptionsOnlyBuilder, execute: (interaction: ChatInputCommandInteraction) => void, buttons?: { id: string, handle: (interaction: ButtonInteraction) => void}[]};
|
||||||
Reference in New Issue
Block a user