Added bunny and poll commands
This commit is contained in:
parent
edb307d6af
commit
58cf283777
4 changed files with 260 additions and 0 deletions
25
commands/bunny.js
Normal file
25
commands/bunny.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { command } = require('vylbot-core');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const randomPuppy = require('random-puppy');
|
||||
|
||||
const embedColor = "0x3050ba";
|
||||
|
||||
class bunny extends command {
|
||||
constructor() {
|
||||
super("bunny");
|
||||
super.description = "Gives you a random bunny";
|
||||
super.category = "Fun";
|
||||
}
|
||||
|
||||
bunny(context) {
|
||||
randomPuppy('Rabbits').then(image => {
|
||||
let embed = new MessageEmbed()
|
||||
.setColor(embedColor)
|
||||
.setImage(image);
|
||||
|
||||
context.message.channel.send(embed);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = bunny;
|
117
commands/poll.js
Normal file
117
commands/poll.js
Normal file
|
@ -0,0 +1,117 @@
|
|||
const { command } = require('vylbot-core');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
const embedColor = "0x3050ba";
|
||||
|
||||
class poll extends command {
|
||||
constructor() {
|
||||
super("poll");
|
||||
super.description = "Generates a poll with reaction numbers";
|
||||
super.category = "General";
|
||||
super.usage = "<title>;<option 1>;<option 2>...";
|
||||
}
|
||||
|
||||
poll(context) {
|
||||
let args = context.arguments;
|
||||
let argsJoined = args.join(' ');
|
||||
args = argsJoined.split(';');
|
||||
|
||||
if (args.length >= 3 && args.length < 11) {
|
||||
let title = args[0];
|
||||
let optionString = "";
|
||||
|
||||
let arrayOfNumbers = [
|
||||
'zero',
|
||||
'one',
|
||||
'two',
|
||||
'three',
|
||||
'four',
|
||||
'five',
|
||||
'six',
|
||||
'seven',
|
||||
'eight',
|
||||
'nine'
|
||||
];
|
||||
|
||||
for (let i = 1; i < args.length; i++) {
|
||||
optionString += `:${arrayOfNumbers[i]}: ${args[i]}\n`;
|
||||
}
|
||||
|
||||
let embed = new MessageEmbed()
|
||||
.setColor(embedColor)
|
||||
.setDescription(`**${title}**\n\n${optionString}`);
|
||||
|
||||
context.message.channel.send(embed).then(message => {
|
||||
if (args.length == 2) {
|
||||
message.react("1️⃣");
|
||||
} else if (args.length == 3) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"));
|
||||
} else if (args.length == 4) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"));
|
||||
} else if (args.length == 5) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"))
|
||||
.then(() => message.react("4️⃣"));
|
||||
} else if (args.length == 6) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"))
|
||||
.then(() => message.react("4️⃣"))
|
||||
.then(() => message.react("5️⃣"));
|
||||
} else if (args.length == 7) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"))
|
||||
.then(() => message.react("4️⃣"))
|
||||
.then(() => message.react("5️⃣"))
|
||||
.then(() => message.react("6️⃣"));
|
||||
} else if (args.length == 8) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"))
|
||||
.then(() => message.react("4️⃣"))
|
||||
.then(() => message.react("5️⃣"))
|
||||
.then(() => message.react("6️⃣"))
|
||||
.then(() => message.react("7️⃣"));
|
||||
} else if (args.length == 9) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"))
|
||||
.then(() => message.react("4️⃣"))
|
||||
.then(() => message.react("5️⃣"))
|
||||
.then(() => message.react("6️⃣"))
|
||||
.then(() => message.react("7️⃣"))
|
||||
.then(() => message.react("8️⃣"));
|
||||
} else if (args.length == 10) {
|
||||
message.react("1️⃣")
|
||||
.then(() => message.react("2️⃣"))
|
||||
.then(() => message.react("3️⃣"))
|
||||
.then(() => message.react("4️⃣"))
|
||||
.then(() => message.react("5️⃣"))
|
||||
.then(() => message.react("6️⃣"))
|
||||
.then(() => message.react("7️⃣"))
|
||||
.then(() => message.react("8️⃣"))
|
||||
.then(() => message.react("9️⃣"));
|
||||
}
|
||||
}).catch(console.error);
|
||||
|
||||
context.message.delete();
|
||||
} else if (args.length >= 11) {
|
||||
let errorEmbed = new MessageEmbed()
|
||||
.setDescription("The poll command can only accept up to 9 options");
|
||||
|
||||
context.message.channel.send(errorEmbed);
|
||||
} else {
|
||||
let errorEmbed = new MessageEmbed()
|
||||
.setDescription("Please use the correct usage: <title>;<option 1>;<option 2>... (separate options with semicolons)");
|
||||
|
||||
context.message.channel.send(errorEmbed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = poll;
|
117
package-lock.json
generated
117
package-lock.json
generated
|
@ -32,6 +32,11 @@
|
|||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"capture-stack-trace": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz",
|
||||
"integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw=="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
|
@ -40,6 +45,14 @@
|
|||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"create-error-class": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz",
|
||||
"integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=",
|
||||
"requires": {
|
||||
"capture-stack-trace": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
|
@ -60,11 +73,64 @@
|
|||
"ws": "^7.3.1"
|
||||
}
|
||||
},
|
||||
"duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI="
|
||||
},
|
||||
"event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||
},
|
||||
"eventemitter3": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz",
|
||||
"integrity": "sha1-HIaZHYFq0eUEdQ5zh0Ik7PO+xQg="
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
||||
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
|
||||
},
|
||||
"got": {
|
||||
"version": "6.7.1",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz",
|
||||
"integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=",
|
||||
"requires": {
|
||||
"create-error-class": "^3.0.0",
|
||||
"duplexer3": "^0.1.4",
|
||||
"get-stream": "^3.0.0",
|
||||
"is-redirect": "^1.0.0",
|
||||
"is-retry-allowed": "^1.0.0",
|
||||
"is-stream": "^1.0.0",
|
||||
"lowercase-keys": "^1.0.0",
|
||||
"safe-buffer": "^5.0.1",
|
||||
"timed-out": "^4.0.0",
|
||||
"unzip-response": "^2.0.1",
|
||||
"url-parse-lax": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-redirect": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz",
|
||||
"integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ="
|
||||
},
|
||||
"is-retry-allowed": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz",
|
||||
"integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg=="
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
||||
},
|
||||
"lowercase-keys": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
|
||||
"integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.44.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
|
||||
|
@ -83,21 +149,72 @@
|
|||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"prepend-http": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
|
||||
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
|
||||
},
|
||||
"prism-media": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.2.tgz",
|
||||
"integrity": "sha512-I+nkWY212lJ500jLe4tN9tWO7nRiBAVdMv76P9kffZjYhw20raMlW1HSSvS+MLXC9MmbNZCazMrAr+5jEEgTuw=="
|
||||
},
|
||||
"random-puppy": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/random-puppy/-/random-puppy-1.1.0.tgz",
|
||||
"integrity": "sha1-GtqjTA83bVArWdb9gifqYaRUmTs=",
|
||||
"requires": {
|
||||
"eventemitter3": "^1.2.0",
|
||||
"got": "^6.3.0",
|
||||
"unique-random-array": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
||||
},
|
||||
"timed-out": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
|
||||
"integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
|
||||
},
|
||||
"unique-random": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unique-random/-/unique-random-1.0.0.tgz",
|
||||
"integrity": "sha1-zj4iTIJCzTOg53sNcYDXfmti0MQ="
|
||||
},
|
||||
"unique-random-array": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/unique-random-array/-/unique-random-array-1.0.1.tgz",
|
||||
"integrity": "sha512-z9J/SV8CUIhIRROcHe9YUoAT6XthUJt0oUyLGgobiXJprDP9O9dsErNevvSaAv5BkhwFEVPn6nIEOKeNE6Ck1Q==",
|
||||
"requires": {
|
||||
"unique-random": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"unzip-response": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz",
|
||||
"integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c="
|
||||
},
|
||||
"url-parse-lax": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz",
|
||||
"integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=",
|
||||
"requires": {
|
||||
"prepend-http": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"vylbot-core": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vylbot-core/-/vylbot-core-1.0.4.tgz",
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/Vylpes/vylbot-app#readme",
|
||||
"dependencies": {
|
||||
"random-puppy": "^1.1.0",
|
||||
"vylbot-core": "^1.0.4"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue