8ball.ts

1import { ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js'
2import { Command } from '@/types/bot'
3
4export default {
5	data: new SlashCommandBuilder()
6		.setName('8ball')
7		.setDescription('Ask the magic 8ball a question')
8		.addStringOption((option) =>
9			option
10				.setName('question')
11				.setDescription('Your question for the 8ball')
12				.setRequired(true),
13		),
14
15	async execute(interaction: ChatInputCommandInteraction) {
16		const responses = [
17			'It is certain.',
18			'It is decidedly so.',
19			'Without a doubt.',
20			'Yes, definitely.',
21			'You may rely on it.',
22			'As I see it, yes.',
23			'Most likely.',
24			'Outlook good.',
25			'Yes.',
26			'Signs point to yes.',
27			'Reply hazy, try again.',
28			'Ask again later.',
29			'Better not tell you now.',
30			'Cannot predict now.',
31			'Concentrate and ask again.',
32			"Don't count on it.",
33			'My reply is no.',
34			'My sources say no.',
35			'Outlook not so good.',
36			'Very doubtful.',
37		]
38
39		const question = interaction.options.getString('question', true)
40		const response = responses[Math.floor(Math.random() * responses.length)]
41
42		await interaction.reply(
43			`🎱 **Question:** ${question}\n**Answer:** ${response}`,
44		)
45	},
46} as Command
47