forked from Hiviexd/AxerBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyesno.ts
42 lines (36 loc) · 981 Bytes
/
yesno.ts
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
import { Client, Message, CommandInteraction, GuildMember } from "discord.js";
import { parseTextFile } from "../../helpers/text/processText";
export default {
name: "yesno",
help: {
description: "Yes or no? I can help you decide!",
syntax: "/yesno `option`",
example: "/yesno `axer cringe?`",
},
config: {
type: 1,
options: [
{
name: "question",
description: "Type your question here!",
type: 3,
required: true,
},
],
},
interaction: true,
category: "fun",
run: async (bot: Client, command: CommandInteraction, args: string[]) => {
await command.deferReply();
//get question from options
const question = command.options.getString("question");
const phrases = await parseTextFile(
__dirname.concat("/../../responses/text/yesno.txt")
);
if (!(command.member instanceof GuildMember)) return;
const res = `> ${question}\n${
phrases[Math.floor(Math.random() * phrases.length)]
}`;
command.editReply(res);
},
};