-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
98 lines (94 loc) · 4.91 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
/**
***********************
* Created by KINGMAN
***********************
* KINGMANDEV Owner :)
───────█████████████████████
────████▀─────────────────▀████
──███▀───────────────────────▀███
─██▀───────────────────────────▀██
█▀───────────────────────────────▀█
█─────────────────────────────────█
█─────────────────────────────────█
█─────────────────────────────────█
█───█████─────────────────█████───█
█──██▓▓▓███─────────────███▓▓▓██──█
█──██▓▓▓▓▓██───────────██▓▓▓▓▓██──█
█──██▓▓▓▓▓▓██─────────██▓▓▓▓▓▓██──█
█▄──████▓▓▓▓██───────██▓▓▓▓████──▄█
▀█▄───▀███▓▓▓██─────██▓▓▓███▀───▄█▀
──█▄────▀█████▀─────▀█████▀────▄█
─▄██───────────▄█─█▄───────────██▄
─███───────────██─██───────────███
─███───────────────────────────███
──▀██──██▀██──█──█──█──██▀██──██▀
───▀████▀─██──█──█──█──██─▀████▀
────▀██▀──██──█──█──█──██──▀██▀
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
──────────██──█──█──█──██
───────────█▄▄█▄▄█▄▄█▄▄█
*/
const Discord = require("discord.js");
const discord = require("discord.js");
const kingman = require('./Alive/kingman');
kingman();
const { MessageEmbed , Collection , Client } = require("discord.js");
const client = new Client()
client.commands = new discord.Collection();
client.eventss = new discord.Collection();
client.aliases = new discord.Collection();
const fs = require('fs');
const invites = {};
const colors = require("colors");
/**
* TOKEN/PREFIX/CONFIG-FILE
*/
const TOKEN_BOT = process.env['ME_TOKEN']
const MONGO_DDB = process.env['ME_MONGO']
const config = require('./mecodes-congig.json');
const PREFIX = config.prefix
/* ON ERROR */
client.on("error", console.error);
/**
* COMMANDS HANDLER SETUP
* EVENTS HANDLER SETUP
*/
["command", "events"].forEach(p => {
require(`./mehandlerconfig/${p}`)(client);
});
/*
COMMAND HANDLER SETUP CODES
*/
client.on('message', kmsg => {
const pmention = new RegExp(`^<@!?${client.user.id}>( |)$`);
if (kmsg.content.match(pmention)) {
return kmsg.reply(`**MY PREFIX IS: ${PREFIX}**`)
}
if (kmsg.author.bot) return;
if (!kmsg.guild) {
return kmsg.reply("**ONLY WORK ON SERVERS NOT DM**")
}
let prefix = PREFIX;
const args1 = kmsg.content.slice(prefix.length).split(/ +/);
if (!kmsg.content.startsWith(PREFIX)) return;
const args = kmsg.content
.slice(PREFIX.length)
.trim()
.split(/ +/g);
const kmcommand = args.shift().toLowerCase();
if (kmcommand.length === 0) return;
let kmcode = client.commands.get(kmcommand);
if (!kmcode) kmcode = client.commands.get(client.aliases.get(kmcommand));
if (kmcode) kmcode.run(client, kmsg, args, PREFIX , prefix);
});
client.login(TOKEN_BOT)