Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

IRC: Missing RealName on events #39

Closed
doenietzomoeilijk opened this issue Feb 4, 2017 · 2 comments
Closed

IRC: Missing RealName on events #39

doenietzomoeilijk opened this issue Feb 4, 2017 · 2 comments

Comments

@doenietzomoeilijk
Copy link
Contributor

I'd like to use go-chat-bot for IRC purposes, but I'm running into a snag. I can solve the snag, but I'm looking for some input on the best way to solve it.

The issue I'm running into is the fact that in irc/irc.go, on a privmsg event, the User is created with only his nick. If I want some command to be limited to certain user/host combo's, I'm out of luck, since I only have the nick to work with. As I see it, there's three ways of solving it:

  • Stuff the username/host into User.RealName. This works, but it's slightly ugly since we're stuffing something that's not a RealName into a RealName.
  • Add host info to the User, for example User.Host. I'm not sure how that'd impact other networks, if at all. I don't know if you get that kind of info from Slack / Telegram, and whether they make any sense there. Still, this seems like the best solution to me.
  • Do an IRC whois inside my command to validate the user. This would work (assuming I can do that from within the bot, I haven't looked into it that much), but it's wasteful as it results in more IRC traffic on each request. Last-ditch resort, I'm really not a fan of this one.

I think the second option would be the best one; it'd involve adding some properties to User that might go unused for non-IRC networks - I don't think that's a huge problem, but input on this would be welcome.

I can come up with a pull request, of course.

@doenietzomoeilijk
Copy link
Contributor Author

I've done a little digging, and both Telegram and Slack have a user ID for every user - Slack can have an e-mail address too, sometimes, but it's not a given.

I propose to add an ID field to the User struct, which gets filled with user ID for Slack and Telegram, and user@host for IRC. This gives you a unique identifier on all three networks.

I'll come up with a PR soon-ish.

@fabioxgn
Copy link
Member

fabioxgn commented Feb 5, 2017

@doenietzomoeilijk hi, thanks for the interest in this project. Using the ID for me looks good enough, go for it :)

doenietzomoeilijk added a commit to doenietzomoeilijk/go-chat-bot that referenced this issue Feb 5, 2017
Also make sure it's filled in the appropriate places. This allows you to add
some granularity to whom can run certain commands.

Fixes go-chat-bot#39
fabioxgn pushed a commit that referenced this issue Feb 6, 2017
Also make sure it's filled in the appropriate places. This allows you to add
some granularity to whom can run certain commands.

Fixes #39
fabioxgn pushed a commit that referenced this issue Feb 22, 2017
* Add ID field to User struct

Also make sure it's filled in the appropriate places. This allows you to add
some granularity to whom can run certain commands.

Fixes #39
fabioxgn pushed a commit that referenced this issue Aug 6, 2017
* Add ID field to User struct

Also make sure it's filled in the appropriate places. This allows you to add
some granularity to whom can run certain commands.

Fixes #39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants