-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.js
60 lines (52 loc) · 2.12 KB
/
commands.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
module.exports = [
{
name: "update",
description: "Update the bot!",
admin: true,
options: [],
execute: async function (bot, interaction)
{
await interaction.reply({ content: 'Updating!', ephemeral: true });
pleaseCrashTheBotNowSoTheAutoRebootUpdatesIt();
}
},
{
name: "startvote",
description: "Start a new vote!",
admin: true,
options: [{ type: 3, name: "title", description: "What's it about?", required: true }, { type: 3, name: "description", description: "When a title is just not enough.", required: false }],
execute: async function (bot, interaction)
{
bot.data.votes = bot.data.votes || {};
let voteId = "vote" + Date.now();
bot.data.votes[voteId] = {};
let text = `# ${interaction.options.getString('title')}\n${(interaction.options.getString('description') ?? "")}`;
const yesButton = new ButtonBuilder()
.setCustomId(`voteyes:${voteId}`)
.setLabel("Yes")
.setStyle(ButtonStyle.Primary);
const noButton = new ButtonBuilder()
.setCustomId(`voteno:${voteId}`)
.setLabel("No")
.setStyle(ButtonStyle.Danger);
const seeButton = new ButtonBuilder()
.setCustomId(`seevotes:${voteId}`)
.setLabel("See Votes")
.setStyle(ButtonStyle.Secondary);
const endButton = new ButtonBuilder()
.setCustomId(`endvotes:${voteId}`)
.setLabel("End Voting")
.setStyle(ButtonStyle.Danger);
const voteRow = new ActionRowBuilder()
.addComponents(yesButton, noButton);
const adminRow = new ActionRowBuilder()
.addComponents(seeButton, endButton);
interaction.reply(
{
content: text,
components: [voteRow, adminRow]
});
}
}
];