sleetdrop has quit [Quit: Computer has gone to sleep.]
cout has quit [Ping timeout: 260 seconds]
cout has joined #cinch
<nickrw>
is it possible to access an instance of another plugging running in the same bot?
<dominikh>
yes.
<nickrw>
so fiddling about I found bot.plugins
<dominikh>
right
<nickrw>
is there a built in way I'm missing to find a particular one, or should I just do something like bot.plugins.find_index { |x| x.class == My::Plugin }
<nickrw>
to pick mine from the array
<dominikh>
nope, that's pretty much it
<nickrw>
cool
postmodern has joined #cinch
<nickrw>
is it possible to block on all handler threads triggered by bot.handlers.dispatch?
<dominikh>
nickrw: what exactly do you mean?
<nickrw>
I'm making some changes to a game I wrote a while ago, and I'm trying to keep features of it modular. Each feature is a cinch plugin, and until now I've used bot.handlers.dispatch(:some_event) to have them cooperate
<nickrw>
which has been fine because none of the events outside the main plugin have needed to write state anywhere
<dominikh>
so you want to wait for the threads spawned by dispatch to finish?
<nickrw>
yes
<dominikh>
let me take a look if there's anything in the public API that'd make this possible
<dominikh>
for what it's worth, each handler has its own thread group, but HandlerList#dispatch won't tell you which handlers it just ran, and you wouldn't know which threads in the thread group belong to which invocation
<nickrw>
yeah, I'm looking at the code for #dispatch just now
<dominikh>
so no, there's currently nothing in the API allowing that. it's doable in a couple lines though
<dominikh>
Handler#call would need to return a thread, HandlerList#dispatch would need to collect them and return a list
<dominikh>
I might not even object to a patch adding that to Cinch, unless I can think of an issue with that.
<dominikh>
nickrw: I'd probably use a plain Array, not a Set, but yeah.
<dominikh>
s/probably// – I'd definitely use an array
<dominikh>
there's no possible way to end up with duplicate threads
<nickrw>
ah, yes
<nickrw>
I'll test my plugins against patched cinch and if it works well I'll send a pull request
<dominikh>
alright
<dominikh>
nickrw: while you're at it, pull line 42 (based on your last pastebin) out of the if. we want an empty array if there's nothing to run, not a nil