Skip to content

Commit

Permalink
Merge pull request #554 from aternosorg/restore-muted-role
Browse files Browse the repository at this point in the history
Don't attempt to restore the muted role if it doesn't exist
  • Loading branch information
JulianVennen authored Feb 1, 2023
2 parents b3b0299 + 4df552f commit c4f02c5
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ export default class RestoreMutedRoleEventListener extends GuildMemberAddEventLi
member.id,member.guild.id);

if (mute) {
const guildConfig = await GuildSettings.get(member.guild.id);
const guildSettings = await GuildSettings.get(member.guild.id);

if (!guildSettings.mutedRole) {
return;
}

try {
await member.roles.add(guildConfig.mutedRole);
await member.roles.add(guildSettings.mutedRole);
}
catch (e) {
if ([RESTJSONErrorCodes.UnknownMember, RESTJSONErrorCodes.UnknownRole].includes(e.code)) {
Expand Down

0 comments on commit c4f02c5

Please sign in to comment.