Skip to content

Commit bec1564

Browse files
committed
boo
1 parent 718d31f commit bec1564

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const minecraftCommand = require("../../contracts/minecraftCommand.js");
2+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3+
const helperFunctions = require("../../contracts/helperFunctions.js");
4+
5+
class BooCommand extends minecraftCommand {
6+
constructor(minecraft) {
7+
super(minecraft);
8+
9+
this.name = "boo";
10+
this.aliases = [];
11+
this.description = "Boo someone!";
12+
this.options = [
13+
{
14+
name: "username",
15+
description: "User you want to boo!",
16+
required: true,
17+
},
18+
];
19+
this.isOnCooldown = false;
20+
}
21+
22+
async onCommand(username, message) {
23+
try {
24+
if (this.getArgs(message).length === 0) {
25+
// eslint-disable-next-line no-throw-literal
26+
throw "You must provide a user to boo!";
27+
}
28+
29+
if (9 !== new Date().getMonth()) {
30+
// eslint-disable-next-line no-throw-literal
31+
throw "It's not October!";
32+
}
33+
34+
if (this.isOnCooldown) {
35+
return this.send(`/gc ${this.name} Command is on cooldown`);
36+
}
37+
38+
this.send(`/boo ${this.getArgs(message)[0]}`);
39+
await delay(690);
40+
this.send(`/msg ${this.getArgs(message)[0]} ${username} Booed You!`);
41+
await delay(690);
42+
this.send(`/gc Booed ${this.getArgs(message)[0]}!`);
43+
this.isOnCooldown = true;
44+
// CREDITS: @jaxieflaxie for finding this cooldown reset
45+
setTimeout(() => {
46+
bot.chat(
47+
`/w ${
48+
bot.username
49+
} jaxieflaxie is the best wristspasm member! your cool if u see this - ${helperFunctions.generateID(24)}`,
50+
);
51+
setTimeout(() => {
52+
bot.chat(`/w ${bot.username} ${helperFunctions.generateID(48)}`);
53+
this.isOnCooldown = false;
54+
}, 30000);
55+
}, 30000);
56+
this.isOnCooldown = false;
57+
} catch (error) {
58+
this.send(`/gc [ERROR] ${error}`);
59+
}
60+
}
61+
}
62+
63+
module.exports = BooCommand;

0 commit comments

Comments
 (0)