dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.3.1
tinnvec has quit [Remote host closed the connection]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tinnvec has joined #cinch
michae has joined #cinch
<michae>
hey all
<michae>
I'm super new at this, but, new threads for each plugin match mean that instance variables aren't persistent over multiple messages, right?
<michae>
Is a new object created for every thread?
<leftylink>
michae: in my experience, instance variables have been persistent
<michae>
Oh, okay. The problem must be something else then
<michae>
I'm currently hacking away at this bot and I have my main script matching "reload" to reload the plugin which acts as a catch-all for the rest of my functionality
<michae>
it seems super hacky, and I was wondering if there was a better way to re-load a bot's scripts without reconnecting?
<leftylink>
hmm. well reload would probably cause instance variables to go away
<dominikh>
if you use the plugin API (i.e. classes), you have one instance of the class per bot, and the handlers may run in parallel in threads. i.e. ivars work, but you need mutexes etc
<dominikh>
if you use the `on` syntax (which is discouraged), then ivars won't work, as the handler executes in the context of a Callback class, which is different for each invocation
<dominikh>
and reloads definitely cause ivars to go away, as you are redefining classes and reinstantiating them
<michae>
ah, okay. I don't mind if they go away upon reload as I only really use that for testing
<michae>
the ivar in question is just a @last_message timestamp which I use for flood protection
<dominikh>
I'm afraid you'll need to show code if you want help with a concrete problem
<michae>
okay, I fixed my main problem, my only remaining question is whether or not there's a cleaner way to do this
<michae>
it's currently making a new thread for each and every message, but I guess that's unavoidable if I plan to add further functionality to SheepCore without disconnecting the bot
<dominikh>
huh? Cinch creates the threads for you, it's unavoidable either way
<michae>
ah okay
<dominikh>
as for reloading/hot loading code: I would recommend running the bot behind a proxy like znc. you can hack around with Ruby, but it has its limitations
<michae>
hmm that's a good idea
<dominikh>
as for the Ruby hack, check out... anyone got the link to my gist?