Skip to content
This repository was archived by the owner on Oct 16, 2022. It is now read-only.

Commit a1820d2

Browse files
committed
Added the bonk command.
1 parent 6821f07 commit a1820d2

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

CHANGELOGS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Uyn BOT Changelogs
44

5+
### May 20, 2021
6+
* Fixed bugs in the `setquote` and `deletequote` commands
7+
* Added the `bonk` command (Requested by Lan Anh#1218)
8+
59
### February 22, 2021
610
* Updated `setquote`, `showquote` and `deletequote` commands
711

commands/bonk.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
const Discord = require("discord.js");
2+
const fs = require('fs');
3+
const {
4+
inspect
5+
} = require('util');
6+
const request = require("request");
7+
8+
function random(min, max) {
9+
return Math.floor(Math.random() * (max - min)) + min;
10+
}
11+
12+
module.exports.run = async (client, message, args) => {
13+
message.delete({
14+
timeout: 10000
15+
});
16+
if (message.mentions.users.size) {
17+
var gif = "";
18+
var text = "";
19+
for (var i = 0; i < args.length; i++) {
20+
text += args[i] + " ";
21+
}
22+
text = text.substr(22, text.length - 1);
23+
request(
24+
"https://api.tenor.com/v1/search?q=bonk&key=" + process.env.tenor_api_key + "&limit=40",
25+
function(error, response, body) {
26+
console.error("error:", error); // Print the error if one occurred
27+
console.log(response.statusCode);
28+
if (response && response.statusCode == 200) {
29+
var gifs = JSON.parse(body);
30+
var rand = parseInt(random(0, 39));
31+
gif = gifs.results[rand].media[0].gif.url;
32+
console.log(gif);
33+
const image = {
34+
color: Math.floor(Math.random() * 16777214) + 1,
35+
author: {
36+
name: message.author.username + ' "bonk"s ' + message.mentions.users.first().username + "! Ouch!\n" + text,
37+
icon_url: message.author.avatarURL({
38+
format: "png",
39+
dynamic: true,
40+
size: 2048
41+
})
42+
},
43+
image: {
44+
url: gif,
45+
},
46+
};
47+
message.channel.send({
48+
embed: image
49+
});
50+
}
51+
});
52+
} else {
53+
message.reply("You must mention an user!");
54+
}
55+
}
56+
57+
module.exports.config = {
58+
name: "bonk",
59+
description: "\"Bonk\" someone",
60+
usage: "u!bonk @mention",
61+
accessableby: "Members",
62+
aliases: [],
63+
category: "👋 Interactions",
64+
dmAvailable: false
65+
}

commands/reverse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ module.exports.config = {
4545
accessableby: "Members",
4646
aliases: [],
4747
category: "😊 Just for fun",
48-
dmAvailable: false
48+
dmAvailable: true
4949
}

0 commit comments

Comments
 (0)