-
Notifications
You must be signed in to change notification settings - Fork 38
/
index.js
115 lines (112 loc) · 4.57 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
const { Client, Collection } = require("discord.js");
// Import Discord.Js.
const client = new Client({ intents: 32767 });
// Make New Discord Client.
module.exports = client;
// Export Client To Give Other Files Access.
const chalk = require("chalk");
// Import Chalk
// ———————————————[Global Variables]———————————————
client.commands = new Collection();
client.aliases = new Collection();
client.cooldowns = new Collection();
client.slashCommands = new Collection();
client.config = require("./botconfig/main.json");
require("./handler")(client);
// Initializing the project.
// ———————————————[Logging Into Client]———————————————
const token = process.env["clienttoken"] || client.config.clienttoken;
if(token === ""){
console.log(chalk.gray("—————————————————————————————————"));
console.log(
chalk.white("["),
chalk.red.bold("AntiCrash"),
chalk.white("]"),
chalk.gray(" : "),
chalk.white.bold("Invalid Token")
);
console.log(chalk.gray("—————————————————————————————————"));
console.log(chalk.magenta("There Are 3 Ways To Fix This"));
console.log(
chalk.blue("Put Your ") + chalk.red("Bot Token ") + chalk.blue("in:")
);
console.log(
chalk.yellow.bold("1.) ") +
chalk.cyan("index.js") +
chalk.gray(
" On the client.login line remove client.login(token) and write client.login('Your token')"
)
);
console.log(
chalk.yellow.bold("2.) ") +
chalk.cyan("ENV/Secrets") +
chalk.gray(
" If using replit, make new secret named 'clienttoken' and put your token in it else, if your using VsCode, Then Follow Some ENV tutorials (I don't suggest using it in VSC)"
)
);
console.log(
chalk.yellow.bold("3.) ") +
chalk.cyan("main.json ") +
chalk.gray(
'Go To botconfig/main.json, Find The Line with client.token and put "client.token":"Your Bot Token"'
)
);
console.log(
chalk.green.bold("Still Need Help? Contact Me:\n") +
chalk.yellow.italic("Discord: DrakeZee#5223\n") +
chalk.yellow.italic("Discord Server: dsc.gg/botsway")
);
} else {
client.login(token);
}
// Login The Bot.
// ———————————————[Error Handling]———————————————
process.on("unhandledRejection", (reason, p) => {
console.log(chalk.gray("—————————————————————————————————"));
console.log(
chalk.white("["),
chalk.red.bold("AntiCrash"),
chalk.white("]"),
chalk.gray(" : "),
chalk.white.bold("Unhandled Rejection/Catch")
);
console.log(chalk.gray("—————————————————————————————————"));
console.log(reason, p);
});
process.on("uncaughtException", (err, origin) => {
console.log(chalk.gray("—————————————————————————————————"));
console.log(
chalk.white("["),
chalk.red.bold("AntiCrash"),
chalk.white("]"),
chalk.gray(" : "),
chalk.white.bold("Uncaught Exception/Catch")
);
console.log(chalk.gray("—————————————————————————————————"));
console.log(err, origin);
});
process.on("multipleResolves", (type, promise, reason) => {
console.log(chalk.gray("—————————————————————————————————"));
console.log(
chalk.white("["),
chalk.red.bold("AntiCrash"),
chalk.white("]"),
chalk.gray(" : "),
chalk.white.bold("Multiple Resolves")
);
console.log(chalk.gray("—————————————————————————————————"));
console.log(type, promise, reason);
});
/*
* ———————————————[Credits]———————————————
* Made by : DrakeZee#5223
* Support Server : dsc.gg/BotsWay
* Youtube : youtube.com/DrakeZee
* Please Help Me Reach 1k Subs DJs Codes And More Amazing * Stuff!
* Also Add Me Friend When Using This, I Have No Friends :(
*
* This Was Only Possible By Following People :
*
* recon#8448 | youtube.com/reconlxx | discord.gg/recon
* Tomato#6966 | milrato.dev | discord.gg/milrato
*/