-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBumper.js
More file actions
160 lines (135 loc) · 5 KB
/
Bumper.js
File metadata and controls
160 lines (135 loc) · 5 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
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
const RC = require('reaction-core');
const RM = require('./Menu/index.js');
const Discord = require('discord.js');
const Settings = require('./Settings/Settings.json');
const client = new RC.Client({
autoreconnect: true
});
const chalk = require('chalk');
const CH = require('chalk');
const fs = require('fs');
const moment = require('moment');
const sql = require('./lib/sql.js');
const sqlite = require('sqlite');
const messaging = require('./lib/messaging.js');
const error = require('./strings/error.js');
require('./Events/EventLoader')(client);
require('./Settings/Switches.js')
if (Settings.DevMode === true) {
client.login(Settings.DevToken);
} else {
client.login(Settings.Token);
}
// Generates time to display in console.
function log(message) {
console.log(`[${moment().format('YYYY-MM-DD HH:MM:SS')}] ${message}`);
}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Module Exports /////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// logs console message when user joins server.
client.on('guildMemberAdd', (member) => {
log(chalk.bgCyan.white.bold(`${member.user.username} joined our server`));
});
// Logs console message when user leave server.
client.on('guildMemberRemove', (member) => {
log(chalk.bgMagenta.white.bold(`${member.user.username} left our server`));
});
// Loads up all files in the commands folder.
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
fs.readdir('./commands/', (err, files) => {
if (err) console.error(err);
log(`Loading a total of ${files.length} commands.`);
files.forEach(f => {
let props = require(`./commands/${f}`);
log(`Loading Command: ${props.info.name}. 👌`);
client.commands.set(props.info.name, props);
props.info.aliases.forEach(alias => {
client.aliases.set(alias, props.info.name);
});
});
});
// reloads the files when reload is executed.
client.reload = command => {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(`./commands/${command}`)];
let cmd = require(`./commands/${command}`);
client.commands.delete(command);
client.aliases.forEach((cmd, alias) => {
if (cmd === command) client.aliases.delete(alias);
});
client.commands.set(command, cmd);
cmd.info.aliases.forEach(alias => {
client.aliases.set(alias, cmd.info.name);
});
resolve();
} catch (e) {
reject(e);
}
});
};
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Permission Lvls /////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// this will check the level of permissions on every commands file.
client.elevation = message => {
// Stops the "Can not read role" error when user joins server.
if (message.author.bot) return;
let lvl = 0;
let Mod = message.guild.roles.find('name', Settings.Staff.Mod);
if (Mod && message.member.roles.has(Mod.id)) lvl = 2;
let Admin = message.guild.roles.find('name', Settings.Staff.Admin);
if (Admin && message.member.roles.has(Admin.id)) lvl = 3;
if (message.author.id === "189975082070704128") lvl = 4;
return lvl;
};
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Client Messages /////////////////////////////
////////////////////////////////////////////////////////////////////////////////
client.on('message', async msg => {
const send = messaging.getSend(msg);
const input = msg.content.toLowerCase();
if (msg.author.bot) return;
if (input.startsWith(`https://steemit`) ||
input.startsWith(`https://busy`) ||
input.startsWith(`https://dtube`) ||
input.startsWith(`https://d.tube`) ||
input.startsWith(`http://steemit`) ||
input.startsWith(`http://busy`) ||
input.startsWith(`http://dtube`) ||
input.startsWith(`http://d.tube`)) {
if (msg.channel.id === '401463657084485633' ||
msg.channel.id === '407274820024270858' ||
msg.channel.id === '409423056725999634') {
if (msg.author.id === "189975082070704128") {
return;
}
} else {
msg.delete();
send(`<@${msg.author.id}>`, true, false);
return send(error.selfish(), true, true, 'css');
}
};
if (input === Settings.Prefix + "settings") {
const Q = Settings;
function DEV() {
if (Settings.DevMode === true) {
return 'Activated'
} else {
return 'Disabled'
}
}
send(`
Version = [ ${Q.Version} ]
Prefix = [ ${Q.Prefix} ]
Debug = [ ${Q.Debug} ]
Refund = [ ${Q.Refund} ]
CMDLOCK = [ ${Q.CMDlock} ]
DEV MODE = [ ${DEV()} ]
Min Price = [ ${Q.Price.Min} ]
Max Price = [ ${Q.Price.Max} ]`)
}
});