cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Corrected join_part.rb example #110

Closed aytch closed 10 years ago

aytch commented 11 years ago

Newbie here, but while following the example code, I found that the instance variable (@admin) declared in the configure section wasn't available to the helper functions. Changing it to a class variable allowed the example code to succeed - though I'm sure that's not the "proper" way of doing it.

Anyway, thanks for the great framework! I'm having lots of fun playing with it.

ElliottH commented 11 years ago

I'm having this problem with instance variables too. I don't think I'm doing anything stupid...

dominikh commented 11 years ago

Using instance variables in basic handlers (as opposed to plugins) is currently not possible. Using class variables would work, unless you run two or more instances of Bot in the same Ruby process, because then they'd conflict.

In a nutshell: If you need state, use plugins.