-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
105 lines (80 loc) · 3.12 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
(async()=>{
const Discord = require("discord.js");
const Database = require("easy-json-database");
const devMode = typeof __E_IS_DEV !== "undefined" && __E_IS_DEV;
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const s4d = {
Discord,
database: new Database(`${devMode ? S4D_NATIVE_GET_PATH : "."}/db.json`),
joiningMember:null,
reply:null,
tokenInvalid:false,
tokenError: null,
checkMessageExists() {
if (!s4d.client) throw new Error('You cannot perform message operations without a Discord.js client')
if (!s4d.client.readyTimestamp) throw new Error('You cannot perform message operations while the bot is not connected to the Discord API')
}
};
s4d.client = new s4d.Discord.Client({
intents: [Object.values(s4d.Discord.Intents.FLAGS).reduce((acc, p) => acc | p, 0)],
partials: ["REACTION"]
});
await s4d.client.login('NjUyMjg2MTEzMTQ2NDcwNDEw.XemOyA.VxBdIoUxfk__FuZ8MmccOUQMhbc').catch((e) => { s4d.tokenInvalid = true; s4d.tokenError = e; });
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == '!ping') {
s4dmessage.channel.send(String('pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == '!ping') {
s4dmessage.channel.send(String('pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == 'h!ping') {
s4dmessage.channel.send(String('Pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == '!ping') {
s4dmessage.channel.send(String('pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == '!ping') {
s4dmessage.channel.send(String('pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == 'h!help') {
s4dmessage.channel.send(String('Commands List - Coming Soon'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == '!ping') {
s4dmessage.channel.send(String('pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == '!ping') {
s4dmessage.channel.send(String('pong!'));
}
});
s4d.client.on('messageCreate', async (s4dmessage) => {
if ((s4dmessage.content) == 'h!embed') {
s4dmessage.channel.send(
{
embed: {
title: 'Embeds',
color: '#ff0000',
image: { url: null },
description: 'I love embeds, but they\'re hard to code.',
footer: { text: null },
thumbnail: { url: null }
}
}
);
}
});
return s4d;
})();