Skip to content

Commit

Permalink
role null check
Browse files Browse the repository at this point in the history
  • Loading branch information
LarmuseauNiels committed Mar 20, 2023
1 parent 8f736e8 commit 4e7ea3f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions modules/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,10 @@ module.exports = async function (client) {
let eventText =
event.name + event.description ? event.description : "";
guild.roles.fetch().then((roles) => {
let roleId = roles.find((role) =>
eventText.includes(role.name)
).id;
if (roleId) {
let role = roles.find((role) => eventText.includes(role.name));
if (role?.id) {
global.client.logChannel.send({
content: "<@&" + roleId + ">",
content: "<@&" + role.id + ">",
embeds: [eventEmbed],
});
} else {
Expand Down

0 comments on commit 4e7ea3f

Please sign in to comment.