qaisjp / go-discord-irc

The Discord and IRC bridge with puppets! An IRC user is created for each Discord user, messages from IRC seamlessly appear on Discord, and Discord mentions are automagically converted to and from IRC.
MIT License
113 stars 32 forks source link

Use AllowedMentions instead of manually disabling everyone pings #132

Closed yutotakano closed 2 years ago

yutotakano commented 2 years ago

This PR switches how go-discord-irc disables @everyone and @here pings from manual text replacement to the webhook AllowedMentions option.

This is safer and more future-proof as it makes Discord responsible on the server-side for not parsing the pings, instead of performing flaky text replacement that can be broken if Discord changes the way it parses. (If Discord decides to strip all zero-width space for example, existing code will need to be changed to avoid pinging everyone). This PR should also lessens the maintainability burden in that regard.