dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.2.5
britneywright has joined #cinch
_djbkd has quit [Quit: My people need me...]
britneywright has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Azure has quit [Read error: Connection reset by peer]
Azure has joined #cinch
postmodern has quit [Quit: Leaving]
sarkyniin has joined #cinch
britneywright has joined #cinch
apt-get_ has joined #cinch
sarkyniin has quit [Ping timeout: 264 seconds]
eebs has joined #cinch
v0n has quit [Ping timeout: 240 seconds]
v0n has joined #cinch
Lirion has quit [Ping timeout: 256 seconds]
Lirion has joined #cinch
rikai has quit [Read error: Connection reset by peer]
rikai has joined #cinch
rikai has quit [Ping timeout: 256 seconds]
ColdBlooder has joined #cinch
<ColdBlooder> Hi
djbkd has joined #cinch
rikai has joined #cinch
<ColdBlooder> Is there a way to make the bot choose a random person in the room?
ColdBlooder has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
ColdBlooder has joined #cinch
<leftylink> ColdBlooder: yup, http://www.rubydoc.info/gems/cinch/Cinch/Channel#users-instance_method will get you users in the channel, then you could randomly select one of those
<ColdBlooder> How do i randomly select one. Thats my main issue...
<eebs> ColdBlooder: You could call .to_a.sample on the users hash
<ColdBlooder> Cool i'll give it a try
<ColdBlooder> How do i get the username out of this? [#<User nick="ColdBlooder">, ["o"]]
<ColdBlooder> Split on the quotation mark and cut the leftover?
dRbiG has joined #cinch
<dRbiG> hello. quick question: is it possible to use a prefix only for channel messages?
<eebs> ColdBlooder: that's the output of User.inspect (https://github.com/cinchrb/cinch/blob/master/lib/cinch/user.rb#L339) All you have to do is call user.nick
<leftylink> dRbiG: aw man... yeah that seems tough. the only way I figured out how to do it is to do https://gist.github.com/an1itdp01y/8791843
<leftylink> and use xmatch instead of match
<leftylink> kinda bad but the best I could do
<dRbiG> aye, thanks for sharing your approach
<leftylink> as far as I can tell from reading https://github.com/cinchrb/cinch/blob/master/lib/cinch/plugin.rb#L196 and https://github.com/cinchrb/cinch/blob/master/lib/cinch/pattern.rb I didn't find a better way, so that might have to be o_o
<ColdBlooder> So using "randomuser = Channel($channel).users.to_a.sample" gives me a randomly chosen username but in an array. How do i call User.nick after that? I don't know why i don't understand that right now...
<eebs> ColdBlooder: as leftylink pointed out (http://www.rubydoc.info/gems/cinch/Cinch/Channel#users-instance_method) returns a hash, where the keys are the Users and the values are an array of modes
<eebs> I may have misspoken before
<eebs> I think you want to call #users.keys.sample.nick
<eebs> with the appropriate error handling
<ColdBlooder> Ahh now it works
<ColdBlooder> thx!
<ColdBlooder> And now i need to get to work... Bye!
<eebs> ColdBlooder: cheers, glad it works
<leftylink> ah, right, becuase Hash#to_a returns an array of [key, value] pairs. which explains the above behavior
<eebs> Yeah. I also misread it, and thought #users returned a hash where the values were an array of User => [modes].
<eebs> so I may have caused some confusion :P
ColdBlooder has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
britneywright has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eebs has quit [Quit: Leaving.]
djbkd has quit [Remote host closed the connection]
Azure has quit [Excess Flood]
Azure has joined #cinch
djbkd has joined #cinch
djbkd has quit [Ping timeout: 276 seconds]
djbkd has joined #cinch
apt-get_ has quit [Remote host closed the connection]