-
Notifications
You must be signed in to change notification settings - Fork 290
Mention discord users in messages sent from IRC #31
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
Conversation
lib/bot.js
Outdated
|
||
const withMentions = text.replace(/@[^\s]+\b/g, m => { | ||
const user = this.discord.users.get('username', m.substring(1)); | ||
return user ? user.mention() : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be return user ? user.mention () : m
? I.e. not 0
. Also, could probably rename m to match
or something more readable.
Great! Do you think you could write a couple of tests for this too? Feel free to ask here or PM me on Discord (username ekmartin, server link here: http://www.reactiflux.com/) if you have any questions. By the way, over at slack-irc (the application this is based on) we try to prefix usernames with an Updated code: https://github.com/ekmartin/slack-irc/blob/master/lib%2Fhelpers.js#L30-L51 Could be something to think about for another pull request later on. This is more important first though, what I'm mentioning here is more of a nice to have. |
@ekmartin I added some tests! Hopefully they are fine. I may look into adding |
test/stubs/discord-stub.js
Outdated
constructor() { | ||
super(); | ||
this.users = { | ||
get: sinon.stub() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be a sandbox stub, like the ones defined here? https://github.com/rce/discord-irc/blob/irc-to-discord-mentions/test/bot.test.js#L29 That way it gets reset after each test, here: https://github.com/rce/discord-irc/blob/irc-to-discord-mentions/test/bot.test.js#L38
Other than my comment it looks great! :) |
@ekmartin Using |
Great, thanks! |
Mention discord users in messages sent from IRC
Published in 0.6.0 :) |
This was requested by my friends. Also closes #30.
Hopefully I'll have the time to get more contributions coming!