aboutsummaryrefslogtreecommitdiff
path: root/src/commons/confusion.js
diff options
context:
space:
mode:
authorIndrajith K L2021-03-27 21:57:16 +0530
committerIndrajith K L2021-03-27 21:57:16 +0530
commite3dba82cf3cdbdf5c0aad3d308013695a2074ecf (patch)
tree83b1b0f5f968ca3f4c260a068fe364821e68176a /src/commons/confusion.js
parent6048206733b3d6bb9ffbacb3e54f4bef88777585 (diff)
downloadlul-bot-e3dba82cf3cdbdf5c0aad3d308013695a2074ecf.tar.gz
lul-bot-e3dba82cf3cdbdf5c0aad3d308013695a2074ecf.tar.bz2
lul-bot-e3dba82cf3cdbdf5c0aad3d308013695a2074ecf.zip
Code Refactoring
* Adds Config for commands * Moved Casual Messages to language.json
Diffstat (limited to 'src/commons/confusion.js')
-rw-r--r--src/commons/confusion.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/commons/confusion.js b/src/commons/confusion.js
new file mode 100644
index 0000000..7a5d9b8
--- /dev/null
+++ b/src/commons/confusion.js
@@ -0,0 +1,22 @@
+const {MessageEmbed} = require('discord.js');
+const fetch = require('node-fetch');
+function generateConfusionGif(message) {
+ message.channel.startTyping();
+ const embed = new MessageEmbed()
+ .setDescription(`I dont understand what you are saying <@${process.env.KLIAS_TAG}> do you know what this guy is asking?`)
+ .setColor("RANDOM");
+ const randomIndex = Math.floor(Math.random() * 49);
+ fetch(`https://api.tenor.com/v1/random?key=${process.env.TENOR_TOKEN}&q=I%20dont%20understand&limit=50`)
+ .then(res => res.json())
+ .then(response => {
+ embed.setImage(response.results[randomIndex].media[0].gif.url);
+ message.channel.stopTyping();
+ message.channel.send(embed);
+ });
+}
+
+module.exports = {
+ execute(message) {
+ generateConfusionGif(message);
+ }
+} \ No newline at end of file