Parse role mentions appropriately, as with channel and user mentions #203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As requested in #186, translate role mentions appropriately between IRC and Discord. This works both ways, so the numbers will be translated into proper text when outputted in IRC, and the plain-text mentions will be made into proper role mentions when outputted in Discord, if (and only if) the role is mentionable.
Present behavior
As in #186, using e.g.
@sysadmin
in Discord will end up outputting a long string into IRC, e.g.<@&233558485999…>
. In addition, using@sysadmin
in IRC will not produce a mention in Discord, even if the sysadmin role is mentionable.Modified behavior
If
newrole
is not mentionable andotherrole
is mentionable, the following output is produced in Discord:and in IRC:
I wasn't sure how exactly to set up the tests (you may note the first commit, a1dfdf6, sets up a
const getRole
inbot.test.js
, which is later removed in favor of athis.findRoleStub
, behaving somewhat likethis.findUserStub
), but they seem to pass where appropriate and match the style of the other tests at least reasonably well.This should solve #186.