Skip to content

Commit

Permalink
Validate role exists?
Browse files Browse the repository at this point in the history
  • Loading branch information
saiteja-madha committed Apr 25, 2022
1 parent a09e7f6 commit fa7f599
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/ticketUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ async function openTicket(guild, user, config) {
},
];

if (config.support_roles.length > 0) {
config.support_roles.forEach((role) => {
for (const roleId of config.support_roles) {
const role = guild.roles.cache.get(roleId);
if (role) {
permissionOverwrites.push({
id: role,
allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "READ_MESSAGE_HISTORY"],
});
});
}
}

const tktChannel = await guild.channels.create(`tіcket-${ticketNumber}`, {
Expand Down

0 comments on commit fa7f599

Please sign in to comment.