-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
186 lines (182 loc) · 6.94 KB
/
index.js
File metadata and controls
186 lines (182 loc) · 6.94 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
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
console.clear();
const {
Discord,
Client,
Collection,
WebhookClient,
MessageEmbed,
Message
} = 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
const xfinity = require("xfinity");
//Import xfinity
const config = require("./botconfig/main.json");
const moment = require("moment");
//
const canvas = require("discord-canvas"),
db = require("old-wio.db");
//
const {
Support,
Color,
Welcome_Images,
GoodBye_Images,
} = require("./config.js");
require("dotenv").config();
// ———————————————[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.
//Ticket Interaction
const simplydjs = require("simply-djs")
client.on("interactionCreate", interaction => {
// interactionCreate Event
simplydjs.clickBtn(interaction, {
embedDesc: `Hello There!\n\n The HOLY Team will be right with you.\n Meanwhile, why dont you tell us a little bit more about your issue?\n\n
**If you opened this Ticket by accident, please let us know inside of it and press the Blue "Close" Button.**\n\n *Please refrain from pinging us, we will be with you soon!*`,
embedColor: "#075FFF", // default: #075FFF
closeColor: "PRIMARY",
closeEmoji: "🔒",
delColor: "DANGER",
delEmoji: "🗑️", // default: ❌
openColor: "PRIMARY",
openEmoji: "🔓",
timeout: false,
cooldownMsg: "Slow It Down Fam...",
categoryID: "900451654560784434",
role: "900458627398242325",
logChannel: "900451914121093140",
ticketname: "ticket-{tag}", // Custom Ticket name. {tag} | {id} | {username}
credit: false
});
})
// ———————————————[TikTok]———————————————
// ———————————————[Instagram]———————————————
// ———————————————[Facebook]———————————————
// ———————————————[RESTART]———————————————
// Initialise discord giveaways
const {
GiveawaysManager
} = require("discord-giveaways");
client.giveawaysManager = new GiveawaysManager(client, {
storage: "./storage/giveaways.json",
default: {
botsCanWin: false,
embedColor: "#2F3136",
reaction: "🎉",
lastChance: {
enabled: true,
content: `🛑 **Last chance to enter** 🛑`,
threshold: 5000,
embedColor: '#FF0000'
}
}
});
// ———————————————[Invite Logs]———————————————
client.on("invitelog", (member, invite, inviter) => {
console.log();
console.log(
chalk.white("["),
chalk.red.bold("InviteLogger"),
chalk.white("]"),
chalk.gray(" : "),
chalk.gray.bold(`${member} has joined by using ${invite.code}. Invited by ${inviter}`)
);
});
// ———————————————[XP]———————————————
// ———————————————[MODLOGS]———————————————
const logs = require('discord-logs');
logs(client, {
debug: false
});
// ———————————————[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('token')"
)
);
console.log(
chalk.yellow.bold("2.) ") +
chalk.cyan("ENV/Secrets") +
chalk.gray(
" ENV NEEDED"
)
);
console.log(
chalk.yellow.bold("3.) ") +
chalk.cyan("main.json ") +
chalk.gray(
'main.json token needed '
)
);
} else {
client.login(token);
xfinity.invitelogger(client);
}
// 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);
});