-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
378 lines (296 loc) · 13 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
const PF6Config = require("./PF6Config.json");
const Discord = require("discord.js");
const fs = require("fs");
const db = require("quick.db");
const {
token,
prefix
} = require("./Config.json")
const bot = new Discord.Client({disableEveryone: true});
bot.commands = new Discord.Collection();
bot.aliases = new Discord.Collection();
fs.readdir("./commands/Bot/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Bot/${f}`);
console.log(`| --------Bot-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Buy/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Buy/${f}`);
console.log(`| --------Buy-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Developer/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Developer/${f}`);
console.log(`| --------Dev-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Economy/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Economy/${f}`);
console.log(`| --------Eco-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Sell/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Sell/${f}`);
console.log(`| --------Sell-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Help/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Help/${f}`);
console.log(`| --------Hel-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Info/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Info/${f}`);
console.log(`| --------Inf-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
fs.readdir("./commands/Set/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/Set/${f}`);
console.log(`| --------Set-------- `);
console.log(`| ✅ ${f} loaded! `);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
});
});
})
bot.on('ready', () => {
console.log(`Logged in as ${bot.user.tag}!`);
setInterval(function() {
let fackeping = Math.floor(Math.random() * 150) + 1;
bot.user.setActivity(`The Paraffin | The First & Best Iranian Economy Bot`, { type: 'PLAYING' });
bot.user.setActivity(`The Paraffin | Ping : ${fackeping}`, { type: 'WATCHING' });
bot.user.setActivity(`The Paraffin | ${bot.guilds.cache.size} Servers`, { type: 'WATCHING' });
bot.user.setActivity('The Paraffin | p?help', { type: 'LISTENING' });
}, 5000)
});
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let Paraffinprefix = db.fetch(`${message.guild.id}prefix`) || "lljjjiygkj215";
let msgcoin = db.fetch(`${message.guild.id}msgcoin`) || "1";
let prefix = Paraffinprefix;
let messageArray = message.content.split(" ");
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let cmd = args.shift().toLowerCase();
let commandfile;
db.add(`messages_${message.guild.id}_${message.author.id}`, 1)
db.add(`pcoin_${message.guild.id}_${message.author.id}`, msgcoin)
let messagefetch = db.fetch(`messages_${message.guild.id}_${message.author.id}`)
let messages;
if (messagefetch == 1) messages = 1; //Level 1
else if (messagefetch == 2) messages = 2; // Level 2
else if (messagefetch == 3) messages = 3; // Level 3
else if (messagefetch == 4) messages = 4; // Level 4
else if (messagefetch == 5) messages = 5; // Level 5
else if (messagefetch == 6000) messages = 6000; // Level 6
else if (messagefetch == 7000) messages = 7000; // Level 7
else if (messagefetch == 8000) messages = 8000; // Level 8
else if (messagefetch == 9000) messages = 9000; // Level 9
else if (messagefetch == 10000) messages = 10000; // Level 10
else if (messagefetch == 11000) messages = 11000; // Level 11
else if (messagefetch == 12000) messages = 12000; // Level 12
else if (messagefetch == 13000) messages = 13000; // Level 13
else if (messagefetch == 14000) messages = 14000; // Level 14
else if (messagefetch == 15000) messages = 15000; // Level 15
else if (messagefetch == 16000) messages = 16000; // Level 16
else if (messagefetch == 17000) messages = 17000; // Level 17
else if (messagefetch == 18000) messages = 18000; // Level 18
else if (messagefetch == 19000) messages = 19000; // Level 19
else if (messagefetch == 20000) messages = 20000; // Level 20
else if (messagefetch == 21000) messages = 21000; // Level 21
else if (messagefetch == 22000) messages = 22000; // Level 22
else if (messagefetch == 23000) messages = 23000; // Level 23
else if (messagefetch == 24000) messages = 24000; // Level 24
else if (messagefetch == 25000) messages = 25000; // Level 25
else if (messagefetch == 26000) messages = 26000; // Level 26
else if (messagefetch == 27000) messages = 27000; // Level 27
else if (messagefetch == 28000) messages = 28000; // Level 27
else if (messagefetch == 29000) messages = 29000; // Level 27
else if (messagefetch == 30000) messages = 30000; // Level 27
let replies = [
'https://media.tenor.com/images/c8106eb745691718c2c6c38bb37aba29/tenor.gif',
'https://mir-s3-cdn-cf.behance.net/project_modules/disp/cba46377293863.5c8bfb5cbd55b.gif',
'https://media3.giphy.com/media/kv4BJO6ejblmgML29X/giphy.gif',
'https://thumbs.gfycat.com/WeeMagnificentAlligatorgar-size_restricted.gif',
'https://thumbs.gfycat.com/PepperyInfiniteArmedcrab-small.gif',
'https://mir-s3-cdn-cf.behance.net/project_modules/disp/8e670377155929.5c8f6372ec827.gif',
'https://media2.giphy.com/media/lp6ZTYkgesS5fP0xRT/giphy.gif',
'https://media.tenor.com/images/4ab61cccc28dc774c4f718c3080f8ccb/tenor.gif',
'https://media1.tenor.com/images/b2134e9b42bac5fc705e45be2a552a20/tenor.gif?itemid=16478581',
'https://cdn.discordapp.com/attachments/747798345145122816/749253392940925020/LastingIdealCatfish-size_restricted.gif'
,'https://cdn.discordapp.com/attachments/747798345145122816/749253601725251623/2ddfce77419693.5cab8d4f80b90.gif'
,'https://cdn.discordapp.com/attachments/747798345145122816/749254275116433434/source_1.gif'
,'https://cdn.discordapp.com/attachments/747798345145122816/749254347921162360/ObedientAcidicAmericangoldfinch-size_restricted.gif'
,'https://cdn.discordapp.com/attachments/747798345145122816/749254391047127060/1530361668_qgpcufH.gif'
]
let result = Math.floor((Math.random() * replies.length));
if (!isNaN(messages)) {
db.add(`level_${message.guild.id}_${message.author.id}`, 1)
db.add(`pcoin_${message.guild.id}_${message.author.id}`, 500)
let levelfetch = db.fetch(`level_${message.guild.id}_${message.author.id}`)
const LChan = db.fetch(`${message.guild.id}lvl`)
const levelembed = new Discord.MessageEmbed()
.setDescription(`<:level:778138052987715594> ${message.author},لول شما ارتقا پیدا کرد ، به **.${levelfetch}.**`)
.setImage(`${replies[result]}`)
.setColor("#f2ecec")
message.guild.channels.cache.get(LChan).send(`${message.author}`)
message.guild.channels.cache.get(LChan).send(levelembed)
if(levelfetch == '5'){
const member2 = message.author;
const role1fetch = db.fetch(`lvl5_${message.guild.id}`)
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member2.roles.add(role1).catch(console.error);
} else if(levelfetch == '10'){
const role1fetch = db.fetch(`lvl10_${message.guild.id}`)
const member = message.author;
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member.roles.add(role1).catch(console.error);
} else if(levelfetch == '15'){
const role1fetch = db.fetch(`lvl15_${message.guild.id}`)
const member = message.author;
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member.roles.add(role1).catch(console.error);
} else if(levelfetch == '20'){
const role1fetch = db.fetch(`lvl20_${message.guild.id}`)
const member = message.author;
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member.roles.add(role1).catch(console.error);
} else if(levelfetch == '25'){
const role1fetch = db.fetch(`lvl25_${message.guild.id}`)
const member = message.author;
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member.roles.add(role1).catch(console.error);
} else if(levelfetch == '30'){
const role1fetch = db.fetch(`lvl30_${message.guild.id}`)
const member = message.author;
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member.roles.add(role1).catch(console.error);
} else if(levelfetch == '35'){
const role1fetch = db.fetch(`lvl35_${message.guild.id}`)
const member = message.author;
const role1 = this.getRoleFromMention(message.guild.roles.cache.get(role1fetch));
member.roles.add(role1).catch(console.error);
}
}
if (bot.commands.has(cmd)) {
commandfile = bot.commands.get(cmd);
} else if (bot.aliases.has(cmd)) {
commandfile = bot.commands.get(bot.aliases.get(cmd));
}
if (!message.content.startsWith(prefix)) return;
try {
commandfile.run(bot, message, args);
} catch (e) {
}}
)
bot.on("message", async message => {
let Paraffinprefix = PF6Config.prefix;
let prefix = Paraffinprefix;
let messageArray = message.content.split(" ");
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let cmd = args.shift().toLowerCase();
let commandfile;
if (bot.commands.has(cmd)) {
commandfile = bot.commands.get(cmd);
} else if (bot.aliases.has(cmd)) {
commandfile = bot.commands.get(bot.aliases.get(cmd));
}
if (!message.content.startsWith(prefix)) return;
try {
commandfile.run(bot, message, args);
} catch (e) {
}}
)
bot.login(token);