Skip to content

Conversation

@me4502
Copy link

@me4502 me4502 commented Jul 26, 2019

This prevents IRC users spamming @everyone in massive Discord chats :)

Fixed #494

@coveralls
Copy link

Coverage Status

Coverage remained the same at 81.034% when pulling 8afec23 on me4502:patch-1 into ef553d3 on reactiflux:master.

@Throne3d
Copy link
Collaborator

It looks like this and #457 are designed to solve the same issue – the bot lets users from IRC use @everyone, without that necessarily being intended.

However, since sometimes it might be desirable to let users on IRC side use @everyone (say, on small servers where the security doesn't matter, or where the bridge is an announcements channel), it would be nice to let users turn this on sometimes. Additionally, since we already have a permission through Discord for whether the bot should be able to use @everyone or not, could we just disable it based on that?

We can check if the bot's got permission to use @everyone with:

const permissions = discordChannel.permissionsFor(this.discord.user);
let canPingEveryone = false;
if (permissions) {
  canPingEveryone = permissions.has(discord.Permissions.FLAGS.MENTION_EVERYONE);
}

Then later we can just use this in the sendMessage hash:

webhook.client.sendMessage(withMentions, {
  username,
  text,
  avatarURL,
  disableEveryone: !canPingEveryone,
}).catch(logger.error);

That way, we don't need a global configuration setting (like #457 did), nor are we blocking out flows where a bot operator might want this functionality.

At this point I suppose I could just write the PR myself, but it'd be nice to get some feedback on this idea before I just go about doing that (or you could implement it and maybe add tests for it?). :P

@me4502
Copy link
Author

me4502 commented Jul 31, 2019

Yeah if we could make it just obey the permissions provided by Discord that would make the most sense. Especially from a usability perspective, where people will just assume removing @everyone permissions prevents it from happening.

@Throne3d
Copy link
Collaborator

Throne3d commented Aug 1, 2019

I've set this up in #497!

@Throne3d Throne3d closed this Aug 4, 2019
@me4502 me4502 deleted the patch-1 branch February 5, 2022 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IRC users can ping @everyone

3 participants