This repository has been archived by the owner on May 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
77 lines (71 loc) · 2.18 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
const { Client, version } = require("discord.js-light");
const { prefix, token } = require("./config.json");
const { loadCommands, getCommand } = require("./util/storage");
const client = new Client({
disableMentions: "everyone",
cacheGuilds: true,
cacheChannels: false,
cacheOverwrites: false,
cacheRoles: false,
cacheEmojis: false,
cachePresences: false,
intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_VOICE_STATES"],
disabledEvents: [
"channelCreate",
"channelDelete",
"channelUpdate",
"channelPinsUpdate",
"emojiCreate",
"emojiDelete",
"emojiUpdate",
"guildBanAdd",
"guildBanRemove",
"guildIntegrationsUpdate",
"guildUnavailable",
"guildUpdate",
"guildMemberAdd",
"guildMemberRemove",
"guildMembersChunk",
"guildMemberSpeaking",
"guildMemberUpdate",
"inviteCreate",
"inviteDelete",
"messageDelete",
"messageUpdate",
"messageDeleteBulk",
"messageReactionAdd",
"messageReactionRemove",
"messageReactionRemoveAll",
"messageReactionRemoveEmoji",
"roleCreate",
"roleDelete",
"roleUpdate",
"shardDisconnect",
"shardError",
"shardReady",
"shardReconnecting",
"shardResume",
"presenceUpdate",
"rateLimit",
"typingStart",
"userUpdate",
"voiceStateUpdate",
"warn",
"debug",
"error",
"webhookUpdate"
]
});
process.stdout.write(`Discord.JS Version: ${version}\nXeno Version: ${require("./package.json").version}\nStarting...\n\n`)
client.login(token).catch(console.error);
loadCommands();
client
.on("ready", async () => {
process.stdout.write(`Bot is now ready! Logged in as ${client.user.username}\n`);
})
.on("message", async (msg) => {
if (!msg.content.startsWith(prefix) || msg.author.bot || msg.channel.type != "text") return;
const args = msg.content.split(/ +/);
const cmd = getCommand(args[0].toLowerCase().slice(prefix.length));
if (cmd) cmd.command.run(client, msg, args.slice(1));
});