-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
69 lines (54 loc) · 2.06 KB
/
index.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
61
62
63
64
65
66
67
68
69
import "dotenv/config.js";
import { Client, Intents } from "discord.js";
import { bold, italic, memberNicknameMention } from "@discordjs/builders";
import { randomCategory, randomCar } from "./randomiser.js";
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_VOICE_STATES] });
client.once("ready", () => {
console.log(`Ready! Logged in as ${client.user.tag}.`);
});
client.on("interactionCreate", async interaction => {
if (!interaction.isCommand())
return;
const { commandName } = interaction;
if (commandName === "sumo") {
const channel = await interaction.guild.channels.fetch(interaction.member.voice.channelId);
if (!channel.members) {
await interaction.reply({content: "No one is ready to sumo :(."});
return;
}
let msg = "Picking your cars from any category...\n\n";
channel.members.forEach(async member => {
const category = randomCategory();
const car = randomCar(category);
msg += `${memberNicknameMention(member.id)} your car is: ${bold(category)} - ${bold(car)}\n`
});
await interaction.reply({content: msg});
} else if (commandName === "info") {
await interaction.reply({content: `Hello ${interaction.member}, my name is Yu Phat`, ephemeral: true})
}
});
client.login(process.env.TOKEN);
// const row = new MessageActionRow()
// .addComponents(
// new MessageSelectMenu()
// .setCustomId('select')
// .setPlaceholder('Select a class')
// .addOptions([
// {
// label: "Super",
// description: "They're super",
// value: "super"
// },
// {
// label: "Off Road",
// description: "The chonkiest of stonkers",
// value: "off_road"
// },
// {
// label: "Muscle",
// description: "It's Alex, but as a car",
// value: "muscle"
// }
// ])
// )
// await interaction.reply({ content: 'Pick which class you want to play:', components: [row] });