Added getRole, getChannel, getCategory functions
This commit is contained in:
1 parent
6107d268f7
commit
2c7be5882c
9 files changed
+97
-120
No files matched your search
+19
-8
@@ -15,6 +15,7 @@ const panelconfig = yaml.load(
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("ready", async (client) => {
|
||||
const { getRole, getChannel, getCategory } = client;
|
||||
client.user.setActivity(supportbot.BotActivity, {
|
||||
type: supportbot.ActivityType,
|
||||
url: supportbot.StreamingURL,
|
||||
@@ -92,21 +93,23 @@ module.exports = new Event("ready", async (client) => {
|
||||
supportbot.TranscriptLog,
|
||||
panelconfig.Channel,
|
||||
];
|
||||
const missingR = [];
|
||||
const missingC = [];
|
||||
const categories = [supportbot.TicketCategory];
|
||||
|
||||
const missingC = [];
|
||||
const missingR = [];
|
||||
const missingCat = [];
|
||||
for (let c of channels) {
|
||||
const find = await client.channels.cache.find(
|
||||
(channel) => channel.name === c || channel.id === c
|
||||
);
|
||||
const find = await getChannel(c, client.guilds.cache.first());
|
||||
if (!find) missingC.push(c);
|
||||
}
|
||||
for (let r of roles) {
|
||||
const find = await client.guilds.cache
|
||||
.first()
|
||||
.roles.cache.find((role) => role.name === r || role.id === r);
|
||||
const find = await getRole(r, client.guilds.cache.first());
|
||||
if (!find) missingR.push(r);
|
||||
}
|
||||
for (let cat of categories) {
|
||||
const find = await getCategory(cat, client.guilds.cache.first());
|
||||
if (!find) missingCat.push(cat);
|
||||
}
|
||||
|
||||
if (missingR.length > 0) {
|
||||
console.log(
|
||||
@@ -125,6 +128,14 @@ module.exports = new Event("ready", async (client) => {
|
||||
)}`
|
||||
);
|
||||
}
|
||||
if (missingCat.length > 0) {
|
||||
console.log(
|
||||
"\u001b[33m",
|
||||
`[WARN] The following Categories could not be found! Please check your configs!\n${missingCat.join(
|
||||
", "
|
||||
)}`
|
||||
);
|
||||
}
|
||||
if (panelconfig.TicketPanel) {
|
||||
let chan1 = client.channels.cache.find(
|
||||
(channel) => channel.name === panelconfig.Channel
|
||||
|
||||
Reference in new issue
Block a user