This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstare.js
65 lines (62 loc) · 2.21 KB
/
stare.js
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const Discord = require("discord.js");
const fs = require('fs');
const {
inspect
} = require('util');
const request = require("request");
function random(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
module.exports.run = async (client, message, args, language) => {
message.delete({
timeout: 10000
});
if (message.mentions.users.size) {
var text = "";
for (var i = 0; i < args.length; i++) {
text += args[i] + " ";
}
text = text.substr(22, text.length - 1);
var gif = "";
request(
"https://api.tenor.com/v1/search?q=anime stare&key=" + process.env.tenor_api_key + "&limit=40",
function(error, response, body) {
console.error("error:", error); // Print the error if one occurred
console.log(response.statusCode);
if (response && response.statusCode == 200) {
var gifs = JSON.parse(body);
var rand = parseInt(random(0, 39));
gif = gifs.results[rand].media[0].gif.url;
console.log(gif);
const image = {
color: Math.floor(Math.random() * 16777214) + 1,
author: {
name: message.author.username + language.stare + message.mentions.users.first().username + "!\n" + text,
icon_url: message.author.avatarURL({
format: "png",
dynamic: true,
size: 2048
})
},
image: {
url: gif,
},
};
message.channel.send({
embed: image
});
}
});
} else {
message.reply(language.pleaseMentionUser);
}
}
module.exports.config = {
name: "stare",
description: "Stare someone",
usage: require("../config.json").prefix + "stare @mention",
accessableby: "Members",
aliases: [],
category: "👋 Interactions",
dmAvailable: false
}