Skip to content

Commit

Permalink
Added channel permissions check
Browse files Browse the repository at this point in the history
  • Loading branch information
OrigamingWasTaken committed Nov 26, 2023
1 parent 32ad678 commit d11c2dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/alerts/hander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export async function alert(data: EventAlert, client: Client) {
.setLabel("Aller à l'annonce")
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(button)
channel.send({content: server.roles ? server.roles.map(role => `<@&${role}>`).join(" ") : "@here",embeds: [embed], components: [row]})
try {
channel.send({content: server.roles ? server.roles.map(role => `<@&${role}>`).join(" ") : "@here",embeds: [embed], components: [row]})
} catch (err) {
// Missing permissions in channel
}
})
}

0 comments on commit d11c2dc

Please sign in to comment.