Skip to content

Parse role mentions appropriately, as with channel and user mentions #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 29, 2017

Conversation

Throne3d
Copy link
Collaborator

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 and otherrole is mentionable, the following output is produced in Discord:

Throne3d wrote:
@newrole

IrcBridge wrote:
<Throne> @newrole
<Throne> @otherrole # actually works

Throne3d wrote:
@otherrole # actually works

and in IRC:

<test2> <Throne3d> @newrole
<Throne> @newrole
<Throne> @otherrole
<test2> <Throne3d> @otherrole

I wasn't sure how exactly to set up the tests (you may note the first commit, a1dfdf6, sets up a const getRole in bot.test.js, which is later removed in favor of a this.findRoleStub, behaving somewhat like this.findUserStub), but they seem to pass where appropriate and match the style of the other tests at least reasonably well.

This should solve #186.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 97.452% when pulling b30c4c3 on Throne3d:add/role-mentions into 26626e5 on reactiflux:master.

@ekmartin
Copy link
Member

Beautiful pull request - thank you!

@ekmartin ekmartin merged commit 1daf62e into reactiflux:master Mar 29, 2017
@Throne3d Throne3d deleted the add/role-mentions branch March 29, 2017 20:24
@ekmartin
Copy link
Member

ekmartin commented Apr 4, 2017

Released in 2.3.0!

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.

3 participants