dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.1.0
<CM-Punk>
I would have no clue how to do that
<leftylink>
save Time.now.to_i in an instance variable when a message is sent. When you would send a message, compare Time.now.to_i to stored time. If difference too small, don't send
<leftylink>
actually, wow, you don't even need the .to_i because Time values support the - operator
<leftylink>
that is a fun fact that I did not know until I tried it just now
<CM-Punk>
Oh
<CM-Punk>
That would be fun
<CM-Punk>
Do you have an example I could work off of leftylink? I learn by studying stuff like that
<leftylink>
HOWEVER, that is not as direct as the approach I gave
<leftylink>
since it's storing its state in a Game object as just a boolean
<leftylink>
and then starts a one-shot Timer to reset the boolean flag
<leftylink>
that *is* a possible approach you could take, and it is perfectly valid. so consider that a possible alternative to the approach I outlined above
<CM-Punk>
Okay
<CM-Punk>
Thank you so much
<leftylink>
my default approach (the way I immediately think of how to implement it if i were asked to) would be the way I described (store the time a message was last sent)
<leftylink>
but I didn't have an exapmle for that immediately handy
<leftylink>
and I know the example I gave ia bit piece of code, but again it's all I had, my apologies for not being able to provide something smaller
<leftylink>
I guess an advantage of this is you hvae the assurance that this code is actually in production and is currently known to be working well
hephaestus_rg has joined #cinch
<CM-Punk>
Yeah leftylink, thanks! :D
hephaestus_rg has quit [Ping timeout: 252 seconds]
postmodern has joined #cinch
cadence has quit [Ping timeout: 264 seconds]
postmodern has quit [Quit: Leaving]
kludge` has quit [Ping timeout: 264 seconds]
kludge` has joined #cinch
xeviox|afk is now known as xeviox
xeviox is now known as xeviox|afk
geopet has joined #cinch
<CM-Punk>
leftylink, I have to say...this code is impressive, and being a n00b to ruby I feel lost....
<CM-Punk>
Like...
<CM-Punk>
"game.reset_invitation" I have no idea how the code knows what to do what that
<nickrw>
it's reasonably important for the use-case of something triggering on a join as netsplits could make the code trigger multiple threads at the same time, each wanting to check the last ratelimit timestamp
<CM-Punk>
Ah yes
<CM-Punk>
More sane than crashing the threads
txdv has quit [Read error: Connection reset by peer]
txdv has joined #cinch
<nickrw>
well, they wouldn't crash, you'd just see unexpected results