forked from Slin/SimpleEADiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
125 lines (109 loc) · 3.4 KB
/
main.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
var Discord = require('discord.js');
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, {
colorize: true
});
logger.level = 'debug';
logger.info('Started');
// Initialize Discord Bot
const bot = new Discord.Client();
bot.on('disconnect', () => {
logger.info('Disconnected');
});
bot.on('ready', () => {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.user.tag);
});
function handleMoveMessage(message)
{
var args = message.content.substring(1).split(' ');
args = args.splice(1);
const fromChannel = message.channel;
const count = args[0];
const toChannel = message.guild.channels.find('id', args[2]);
//logger.info(message.member.roles);
if(message.member.permissions.has('ADMINISTRATOR'))
{
message.channel.fetchMessages({limit: count}).then(messages => {
for(var msg of messages.array().reverse())
{
if(!msg.author.bot)
toChannel.send(msg.member.displayName + ":\n" + msg.content);
}
for(var msg of messages.array().reverse())
{
if(!msg.author.bot)
msg.delete();
}
});
}
else
{
message.channel.send("ERROR 403: FORBIDDEN").then(msg => {
setTimeout(() => { msg.delete() }, 3000);
});
}
}
const maxRandom = 50;
var randomCounter = Math.floor((Math.random() * maxRandom) + 1);
bot.on('message', message => {
if(message.content.substring(0, 1) == '!')
{
var args = message.content.substring(1).split(' ');
var cmd = args[0];
message.delete().then(() => {
if(!message.author.bot)
{
switch(cmd)
{
//!move COUNT to CHANNELID
case 'move':
handleMoveMessage(message);
break;
case 'channelid':
message.channel.send("Channel ID: " + message.channel.id).then(msg => {
setTimeout(() => { msg.delete() }, 5000);
});
}
}
});
}
else
{
if(message.author.id == '361581192635613184') //Viatrex
{
randomCounter -= 1;
if(randomCounter <= 0)
{
logger.info(message.author.tag);
message.channel.send("Fuck you Viatrex!");
randomCounter = Math.floor((Math.random() * maxRandom) + 1);
}
}
else if(message.author.id == '176810272512671744') //Booty
{
randomCounter -= 1;
if(randomCounter <= 0)
{
logger.info(message.author.tag);
message.channel.send("At Five Guys!");
randomCounter = Math.floor((Math.random() * maxRandom) + 1);
}
}
else if(message.author.id == '305228776814673925') //Gecko
{
randomCounter -= 1;
if(randomCounter <= 0)
{
logger.info(message.author.tag);
message.channel.send("So tired...");
randomCounter = Math.floor((Math.random() * maxRandom) + 1);
}
}
}
});
bot.login(auth.token);