-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
87 lines (68 loc) · 3.23 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
const Discord = require('discord.js')
const fs = require('fs')
const client = new Discord.Client();
const config = require("./config.json");
const cool = require('cool-ascii-faces')
const express = require('express')
const path = require('path')
const PORT = process.env.PORT || 5000
express()
.use(express.static(path.join(__dirname, 'public')))
.set('views', path.join(__dirname, 'views'))
.set('view engine', 'ejs')
.get('/', (req, res) => res.render('pages/index'))
.get('/cool', (req, res) => res.send(cool()))
.listen(PORT, () => console.log(`Listening on ${ PORT }`))
client.on("ready", () =>
{
console.log(`Bot foi iniciado, com ${client.users.size} usuários, em ${client.channels.size} canais, em ${client.guilds.size} servidores. Total de membros:[ ${client.users.size} ] `);
});
client.on("guildCreate", guild =>
{
console.log(`O bot entrou nos servidor: ${guild.name} (id: ${guild.id}). População: ${guild.memberCount} membros!`);
});
client.on("guildDelete", guild =>
{
console.log(`O bot foi removido do servidor: ${guild.name} (id: ${guild.id})`);
});
fs.readdir("./events/", (err, files) =>
{
if (err) return console.error(err);
files.forEach(file =>
{
let eventFunction = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, (...args) => eventFunction.run(client, ...args));
});
client.on("message", message =>
{
if (message.author.bot) return;
if (!message.content.startsWith(config.prefix)) return;
let command = message.content.split(" ")[0];
command = command.slice(config.prefix.length);
let args = message.content.split(" ").slice(1);
try
{
let commandFile = require(`./commands/${command}.js`);
commandFile.run(client, message, args);
}
catch (err)
{
console.error(err);
return message.reply("Comando incorreto, confira o d!ajuda");
}
let status = [
{ name: `Meu prefixo é d!`, type: 'STREAMING', url: 'https://discordapp.com/api/oauth2/authorize?client_id=624273681266376724&permissions=59392&scope=bot'},
{ name: `Me adicione no seu servidor s2`, type: 'STREAMING', url: 'https://discordapp.com/api/oauth2/authorize?client_id=624273681266376724&permissions=59392&scope=bot'},
{ name: `Para divulgar use d!anunciar`, type: 'STREAMING', url: 'https://discordapp.com/api/oauth2/authorize?client_id=624273681266376724&permissions=59392&scope=bot'},
{ name: `Me adicione no seu servidor s2`, type: 'STREAMING', url: 'https://discordapp.com/api/oauth2/authorize?client_id=624273681266376724&permissions=59392&scope=bot'},
{ name: `Sendo submissa ao meu dono`, type: 'STREAMING', url: 'https://discordapp.com/api/oauth2/authorize?client_id=624273681266376724&permissions=59392&scope=bot'},
{ name: `Meu prefixo é d!`, type: 'STREAMING', url: 'https://discordapp.com/api/oauth2/authorize?client_id=624273681266376724&permissions=59392&scope=bot'},
]
setInterval(function() {
let randomStatus = status[Math.floor(Math.random() * status.length)];
client.user.setPresence({ game: randomStatus });
}, 7000)
})
})
client.login(config.token);