KittehOrg/KittehIRCClientLib

Verify Channel.getuser() behaviour

Zarthus opened this issue · 1 comments

(18:10:42) * Wray (webchat) has joined #kitteh.org
(18:49:12) <Wray> I feel I must be missing something obvious. I would like my program to respond to a command posted in the room by sending a private message to the user who posted it. I tried Optional<User> user = channel.getUser(nickname) and was going to use user.get.sendMessage(blah), but user.isPresent always returns false. So how can I do a PRIVMSG user msg in
(18:49:13) <Wray> stead of PRIVMSG #Channel msg
(18:51:59) <@mbaxter> User being always not there is... odd. But why are you getting the nickname from the User just to get the User again? The event should have them.
(18:52:15) <@mbaxter> If you have a github account from which to post an issue about the missing user that'd be appreciated. I might forget  :D
(18:58:46) <Wray> > But why are you getting the nickname from the User just to get the User again? The event should have them.  The reason is the command is posted to the channel, my code has to send it off for processing and can't block. When the results are available I want to send them directly to that user. Just to be sure: If I save off event.getActor().getNick
(18:58:47) <Wray> () and then later pass that value to channel.getUser() it should retrieve the User correct?
(19:06:30) <@mbaxter> It should, assuming the user hasn't left.
(19:06:56) <@mbaxter> But keep in mind you can hold on to User objects. They're immutable little friends of data.
(19:07:40) <@mbaxter> If you're wanting to confirm they're still in channel, doing channel.getUser makes sense but if you don't care if they happened to part at that moment, you could just do client.sendMessage(nick, message)
(19:09:26) <@Zarthus> or channel#message(nick + ": " + response)
(19:10:00) <@mbaxter> Sure but they wanted to message the user instead. First message up there ^
(19:10:07) <@Zarthus> tells you what i know
(19:14:48) <@mbaxter> :D
(19:14:53) <@mbaxter> Thanks Zarthus! :)
(19:15:32) <@Zarthus> i do find it interesting a channel-triggered command gets a PM as response
(19:20:11) <@mbaxter> Indeed
(19:22:40) <Wray> It is a hack to be sure. Thanks for the info
(20:08:12) <@mbaxter> That is a hack, but I'll investigate it if there's a github issue ticket thing
(20:09:05) <Wray> The client.sendMessage(nick,message) works fine. Thanks again
(20:09:09) * Wray (webchat) Quit (Quit: webchat.esper.net)```
mbax commented

Fixed in 4.0.2, forgot to close and spent twenty minutes trying to reproduce. Oops.