This repository was archived by the owner on Jan 4, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathindex.js
134 lines (128 loc) · 3.46 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
/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
require("dotenv").config();
const { CommandoClient } = require("discord.js-commando");
const { Structures } = require("discord.js");
const path = require("path");
const Keyv = require("keyv");
const Canvas = require("canvas");
const chalk = require("chalk");
const { MessageEmbed } = require("discord.js");
Structures.extend("Guild", Guild => {
class MusicGuild extends Guild {
constructor(client, data) {
super(client, data);
this.musicData = {
queue: [],
isPlaying: false,
songDispatcher: null
};
}
}
return MusicGuild;
});
const client = new CommandoClient({
commandPrefix: "b?",
unknownCommandResponse: false,
disableEveryone: false,
invite: "https://discord.gg/PWsa2c3",
owner: process.env.OWNERID
});
client.on("message", message => {
if (message.author.bot) return;
if (message.content === "") return;
let embed = new MessageEmbed()
.addField("User", message.author)
.addField("Role", message.member.roles.first().name)
.addField("Message", message.content)
.addField("Channel", "#" + message.channel.name)
.setFooter("Message ID | " + message.id)
.setThumbnail(message.author.displayAvatarURL())
.setTimestamp()
.setColor(message.member.roles.first().hexColor);
let channel = client.guilds.get("636371108576100356").channels.find(
channel =>
channel.name ===
message.guild.name
.split(" ")
.join("-")
.toLowerCase()
);
channel.send(embed);
});
client.registry
.registerDefaultTypes()
.registerGroups([
["fun", "Fun Commands"],
["moderation", "Moderation Commands"],
["special", "Special Commands"],
["misc", "Misc Commands"],
["music", "Music Commands"]
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, "commands"));
client.on("guildCreate", async guild => {
let logchannelfix = guild.name
.split(" ")
.join("-")
.toLowerCase();
if (
client.guilds.get("636371108576100356").channels.find(
channel =>
channel.name ===
guild.name
.split(" ")
.join("-")
.toLowerCase()
) === undefined
) {
client.guilds
.get("636371108576100356")
.channels.create(`${logchannelfix}`)
.then(channel => {
channelz
.setParent("637403861073657887")
.then(ch => {
ch.lockPermissions();
})
.catch(err => {});
});
}
});
client.on("ready", () => {
client.guilds.forEach(g => {
let logchannelfix = g.name
.split(" ")
.join("-")
.toLowerCase();
if (
client.guilds.get("636371108576100356").channels.find(
channel =>
channel.name ===
g.name
.split(" ")
.join("-")
.toLowerCase()
) === undefined
) {
client.guilds
.get("636371108576100356")
.channels.create(`${logchannelfix}`)
.then(channel => {
channel
.setParent("637403861073657887")
.then(ch => {
ch.lockPermissions();
})
.catch(err => {});
});
}
});
console.log(chalk.greenBright("[Status]"), "Bot Online");
client.user.setActivity("Blizzard | Server Moderation");
});
process.on("uncaughtException", error =>
console.log(chalk.redBright("[Uncaught Exception]"), error)
);
client.login(process.env.CLIENT_TOKEN);