-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (25 loc) · 964 Bytes
/
index.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
const discord = require('discord.js')
const config = require('./config.json')
const bot = new discord.Client({ disableEveryone: true })
const apiFile = require('./helper/APIProvider');
const API = new apiFile;
bot.on("message", async message => {
if (message.author.bot || message.channel.type === "dm") return;
if (message.mentions.users.first() && message.mentions.users.first().id === bot.user.id) {
await API.getQuote().then((response) => {
message.channel.send("```" + response.data.QUOTE + "```" + "\n" + "~ " + response.data.AUTHOR);
}).catch((e) => {
message.channel.send('Whoops! Looks like the API is returning something else.');
});
}
})
bot.on("ready", () => {
bot.user.setActivity("AI Sifu's Quotes", { type: "LISTENING" });
console.log('I am active!')
})
if (config.bot.token === "") {
console.log("Token is invalid!")
return;
} else {
bot.login(config.bot.token)
}