-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (37 loc) · 1.43 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
const fs = require('fs');
const Database = require("@replit/database");
const Discord = require('discord.js');
const client = new Discord.Client();
const db = new Database();
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('js'));
for(const file of commandFiles){
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
const prefix = '$';
const token = process.env.TOKENDS;
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const [cmd, ...args] = message.content
.trim()
.substring(prefix.lenght)
.split(/\s+/);
if(cmd === prefix + 'haidee'){
message.channel.send('https://www.youtube.com/watch?v=hGcwsfVU0jI');
}
else if(cmd === prefix + 'sv-info'){
client.commands.get('sv-info').execute(args, db, message);
}
else if(cmd === prefix + 'db' &&
(message.author.id === process.env.ADMIN1 ||
message.author.id === process.env.ADMIN2 ||
message.author.id === process.env.ADMIN3)){
client.commands.get('editdb').execute(args, db, message);
}
else if(cmd === prefix + 'amongus'){
client.commands.get('amongus').execute(args, db, message);
}
console.log(message.author.tag,":",cmd,' ',args);
});
client.login(token);