-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
245 lines (205 loc) · 7.25 KB
/
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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
require("dotenv").config();
const serviceAccount = require("./discord-bot-auth.json");
const mapConfig = require("./maps/map1.js");
const {
initializeApp,
applicationDefault,
cert,
} = require("firebase-admin/app");
const {
getFirestore,
Timestamp,
FieldValue,
Filter,
} = require("firebase-admin/firestore");
const firebaseConfig = {
credential: cert(serviceAccount),
};
initializeApp(firebaseConfig);
const db = getFirestore();
//Constants
const {
Client,
Intents,
MessageEmbed,
GatewayIntentBits,
} = require("discord.js");
require("dotenv").config();
const ytdl = require("ytdl-core");
const fs = require("fs");
const voice = require("@discordjs/voice");
const { join } = require("path");
const bot = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
],
});
//Start up
bot.on("ready", async () => {
console.log("This bot is online!");
let handler = require("./command-handler.js");
let logger = require("./logs.js");
if (handler.default) {
handler = handler.default;
}
handler(bot, db);
logger(bot, db);
});
/*
//Commands
bot.on('messageCreate', async message => {
//Playlist
if(message.content.toLowerCase() === ".play free roam"){
const songList = [19];
let count = 0;
for(let i = 0; i < 19; i++){
count = 0;
let songDir = "Media/song" + Math.round((Math.random() * 20) + 1) + ".mp3";
for(let j = 0; j < 19; j++){
if(songList[j] === songDir){
count++;
}
}
if(count === 0){
songList[i] = songDir;
}else{
i--;
}
}
const audioplayer = voice.createAudioPlayer();
let path = 0;
voice.joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator
}).subscribe(audioplayer);
let resource = voice.createAudioResource(songList[path]);
audioplayer.play(resource);
audioplayer.on(voice.AudioPlayerStatus.Idle, () => {
if(path < 19){
path++;
resource = voice.createAudioResource(songList[path]);
audioplayer.play(resource);
}else{
console.log("Playlist finished");
audioplayer.stop();
}
})
if(message.content === '.pause'){
audioplayer.pause();
}
if(message.content === '.resume'){
audioplayer.unpause();
}
if(message.content === '.skip'){
path++;
resource = voice.createAudioResource(songList[path]);
audioplayer.play(resource);
}
}
//Interactions with humans
function sendMessageRandomly(userMessage, botMessage, chance){
if(message.content === userMessage){
var number = Math.round(Math.random() * (chance - 1) + 1);
console.log(userMessage + " roll: " + number);
if(number === 1){
message.channel.send(botMessage);
}
}
};
sendMessageRandomly("^", "^^", 3);
//General
if (message.channel.id === ('545860292093935618') || message.channel.id === ('722063668543750170') || message.channel.id === ('744121567356780565') && message.author.id !== ('714413389627260939')){
var hateNum = Math.floor(Math.random() * ((150 - 1) + 1) + 1);
console.log("Random Hate Message Roll: " + hateNum);
if(hateNum === 1){
console.log('sent hate');
message.channel.send("I fucking hate this kid");
}else if(hateNum === 150){
console.log('sent nice one');
message.channel.send("nice one");
}else if(hateNum === 75){
console.log('sent retard');
message.channel.send("retard");
}else if(hateNum === 25){
console.log('sent beaner');
message.channel.send("beaner");
}else if(hateNum === 105){
console.log('sent Black');
message.channel.send("blackie");
}
}
//Lekohan Reacts
//Dexter's Domain
if(message.channel.id == '744121567356780565') {
if (message.attachments.size > 0){
console.log('attachment found');
if (Math.round(Math.random() * 5) === 1){
console.log('number rolled 1');
message.react('759082919640825868');
}
}
}
//Collection
else if(message.channel.id == '678891330016903169') {
if(message.attachments.size > 0){
console.log('attachment found');
if (Math.round(Math.random() * 10) === 1){
console.log('number rolled 1');
message.react('759082919640825868');
}
}
}
//Unworthy
else if(message.channel.id == '705681603522723840'){
if(message.attachments.size > 0){
console.log('attachment found');
if (Math.round(Math.random() * 25) === 1){
console.log('number rolled 1');
message.react('759082919640825868');
}
}
}
//Lekohan Commands for Overseer and Yertle
if(message.member.roles.cache.some(role => role.name === 'YERTLE' || role.name === 'OVERSEER')){
//Discord Profile Picture Stealer
if(message.content.startsWith(".steal") === true){
var target = message.mentions.users.first();
console.log(target);
console.log(message.member);
let embed = new MessageEmbed()
.setTitle(target.username)
.setImage(message.mentions.users.first().avatarURL())
message.channel.send({embeds: [embed]});
}
if(message.content === '.commands'){
let embed = new MessageEmbed()
.setTitle('Commands')
.setDescription('.invade\n.bye\n.die\ncringe\n.zombie\n.mom\n.laugh\n.jacob\n.leave')
.setImage('https://i.imgur.com/RO9gl4g.png')
.setFooter('Do not let these fall into the wrong hands')
message.channel.send({embeds: [embed]});
}
//Lekohan's Voice
if (message.author.id === ('259847819353915392') || message.author.id === ('600380478125768724') || message.author.id === ('290634129060528138') || message.author.id === ('447237271998169092')){
function playAudio(path){
const audioplayer = voice.createAudioPlayer();
voice.joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator
}).subscribe(audioplayer);
let resource = voice.createAudioResource(path);
audioplayer.play(resource);
}
}
}
})
*/
bot.login(process.env.TOKEN);