This repository was archived by the owner on Apr 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
60 lines (53 loc) · 1.95 KB
/
Copy pathindex.js
File metadata and controls
60 lines (53 loc) · 1.95 KB
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 {Collection, Client, Discord} = require("discord.js");
const fs = require("fs")
const bot = new Client({
disableEveryone: true
});
const config = require('./config.json');
const token = config.token;
const prefix = config.prefix;
bot.prefix = "c!"
bot.commands = new Collection();
bot.aliases = new Collection();
bot.catergories = fs.readdirSync("./commands/");
["command"].forEach(handler =>{
require(`./handlers/${handler}`)(bot);
})
const activities_list = [
"BETA | c!help",
"Version 0.7 | c!help",
`stop looking at this status NOW`,
"use c!help already"
];
bot.on('guildMemberAdd', (member) => {
let chx = db.get(`wChannel_${member.guild.id}`)
if(!chx === null) {
return;
}
let embed = new Discord.MessageEmbed()
.setAuthor(member.user.username + "has joined the server!")
.setColor(1752220)
.setThumbnail(member.user.displayAvatarURL())
.setDescription(`Welcome to the server, **${member.user.username}**! Be sure to check the rules and have fun!`)
bot.channels.cache.get(chx).send(embed)
})
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
bot.user.setActivity(activities_list[index],{ type: "WATCHING" });
}, 10000);
console.log(`${bot.user.username} is now online!`)
});
bot.on('message', async message=>{
if(message.author.bot) return;
if(!message.content.startsWith(prefix)) return;
if(!message.guild) return;
if(!message.member) message.member = await message.guild.fetchMember(message);
const args = message.content.slice(prefix.length).split(/ +/);
const cmd = args.shift().toLowerCase();
if(cmd.length == 0 ) return;
const command = bot.commands.get(cmd)
if(!command) command = bot.commands.get(bot.aliases.get(cmd));
if(command) command.run(bot,message,args);
})
bot.login(process.env.token)