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
+5
-17
@@ -12,12 +12,6 @@ const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.TicketAdd,
|
||||
description: cmdconfig.TicketAddDesc,
|
||||
@@ -32,16 +26,10 @@ module.exports = new Command({
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(interaction) {
|
||||
let SupportStaff = interaction.guild.roles.cache.find(
|
||||
(SupportTeam) =>
|
||||
SupportTeam.name == supportbot.Staff ||
|
||||
SupportTeam.id == supportbot.Staff
|
||||
);
|
||||
let Admins = interaction.guild.roles.cache.find(
|
||||
(AdminUser) =>
|
||||
AdminUser.name == supportbot.Admin || AdminUser.id == supportbot.Admin
|
||||
);
|
||||
if (!SupportStaff || !Admins)
|
||||
const { getRole, getChannel, getCategory } = interaction.client;
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||
);
|
||||
@@ -55,7 +43,7 @@ module.exports = new Command({
|
||||
|
||||
if (
|
||||
!interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||
!interaction.member.roles.cache.has(Admins.id)
|
||||
!interaction.member.roles.cache.has(Admin.id)
|
||||
)
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
|
||||
|
||||
Reference in new issue
Block a user