itabashi
itabashi copied to clipboard
Allow pinging between Discord and IRC
If someone on IRC says: @Somecooldude yo what up
And there is someone on Discord who has that name, it should ping them in the message.
Discord -> IRC is not required as client highlighting is based on nick matching already, rather than the explicit name mentioning that Discord uses.
NOTE: I created an issue for this a minute or two ago without checking the issue list. Sorry for the spam!
I have a solution in mind. When parsing a message from a bridged IRC channel, follow these steps (in addition to parsing it as normal):
- If it doesn't has a
@
character in it, just parse it as normal and ignore the following steps. - For each
@
character in the message, parse the characters following it until we reach a whitespace character (there is an issue here, which I'll mention soon). Search through the list of members of the server and pick the user whose name exactly matches that string (should we be case-sensitive?). If there are multiple users with that screen name, we pick the one who most recently typed. (up for debate) - Replace each
@
-string from the IRC message with a mention (following the example above) according the the details of that user (i.e. matching the screen name and discriminator). I'm not extremely familiar with the Discord chat API so I'm not sure if we will have to do anything else besides this to "mention" that user when Itabashi is sending the bridged message to the Discord channel, but Discord's UI uses the above format to do mentions internally.
We do have some potential issues though:
- What if a Discord user's screen name has whitespace characters in it? Should we add a delimiter for it?
- The
#
prefixing the discriminator effectively functions as one in the Discord universe.
- The
- Should we be case sensitive when trying to match up an IRC -> Discord mention to the correct Discord user?
- We should probably find out if Discord is. I'd imagine that it is, but I'm not sure.
- If multiple Discord users have the same screen name, how do we decide which to mention?
EDIT: Basically, this would allow IRC users to mention Discord users by doing @user
, where user
is the Discord user's screen name.