-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
60 lines (46 loc) · 1.5 KB
/
bot.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
// const { Client, Intents } = require('discord.js');
import {Client, Intents} from "discord.js"
import keepAlive from "./server.js"
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
import fetch from "node-fetch"
const token = process.env['token']
import API from "anime-images-api"
const images_api = new API() ;
function getQuote(){
return fetch("https://zenquotes.io/api/random")
.then(res => {
return res.json()
})
.then(data => {
return data[0]["q"] + " -" + data[0]["a"]
})
}
function getPunch(){
return "test quote"
}
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'github') {
await interaction.reply('https://github.com/jrojas10');
}
if (interaction.commandName === 'hello') {
await interaction.reply('Hello, my name is Mecha Senku');
}
if (interaction.commandName === 'inspire') {
await getQuote().then (quote => interaction.reply(quote));
}
if (interaction.commandName === 'commands') {
await interaction.reply('https://github.com/jrojas10/MechaSenkuNodeJS/blob/main/README.md');
}
if (interaction.commandName === 'punch') {
await images_api.sfw.punch().then (response => interaction.reply(response.image));
}
if (interaction.commandName === 'kill') {
await images_api.sfw.kill().then (response => interaction.reply(response.image));
}
});
keepAlive()
client.login(token);