<dominikh>
well, for one you won't be able to do anything after bot.start, because it blocks, second you can't expect the helpers to work in random places such as the global namespace.
<Xeago>
^C after .start works just fine, and I can do bot.user_list.find_ensured "Xeago"
<Xeago>
I don't expect it to without a require, but I can't find the require
<dominikh>
it won't work with a require, either. and pretty sure that "^C after .start" doesn't work "just fine". You're aborting what that method is doing…
<Xeago>
looking at #start, only the reconnect will be affected
<Xeago>
which is fine for my testing
<Xeago>
in any case
<Xeago>
looking at how to write plugins then
<Xeago>
include Cinch::Plugin should make them available?
<Xeago>
(for that plugin?)
<dominikh>
yes.
<Xeago>
I don't understand how that works
<Xeago>
including Cinch::Plugin which has a require 'cinch/helpers'
<Xeago>
but I can't seem to load that?
<Xeago>
dominikh: would you mind explaining the ruby fu that is going on there?
<Xeago>
dominikh: using Configuration#load
<Xeago>
how do I specify the array of plugins?
<dominikh>
as an array of classes. or strings, which will be looked up and turned into classes.
<Xeago>
{plugins: [Plugin]} {plugins: {plugins: [Plugin]}} both don't work
<Xeago>
do I need to OpenStruct the inner {plugins: [Plugin]} ?
<dominikh>
I don't even know what "to OpenStruct" means. You also didn't show how exactly you're calling #load
<Xeago>
yea, openstructing it works
<Xeago>
bot.config.load(…)
<Xeago>
to OpenStruct: OpenStruct.new(…)
<dominikh>
{plugins: {plugins: [Plugin]}} should work just fine.
<Xeago>
where … is any of the 2 hashes I provided
<Xeago>
that gives me NoMethodError: undefined method `plugins' for {:plugins=>[Hello]}:Hash
<Xeago>
when I then call #start
<dominikh>
sounds like a bug.
<Xeago>
am using cinch-2.0.11
<dominikh>
yeah, it's a bug *shrug*. use OpenStruct, I doubt anyone is going to fix it anytime soon.
<Xeago>
NoMethodError: undefined method `plugins' for {:plugins=>[Hello]}:Hash from /Users/TwN/.gem/ruby/2.0.0/gems/cinch-2.0.11/lib/cinch/bot.rb:239:in `start'
<Xeago>
ok, using openstruct isn't too difficult I guess
<Xeago>
thanks!
[krisbulman] is now known as krisbulman
<Xeago>
is there a preference for using "on :symbol" vs listen_to :symbol
<dominikh>
you won't be using `on` in plugins.
<Xeago>
so on :symbol is used only in the block for Bot#new?
<dominikh>
you can call it directly on a bot instance, too.
<dominikh>
usually you shouldn't be using `on` for anything.
<Xeago>
ok I see, the suggested approach is thus to use plugins for anything but trivial runnable examples
<dominikh>
yes.
CM-Punk has quit [Ping timeout: 245 seconds]
v0n has joined #cinch
<Xeago>
when using match //
<Xeago>
can I get the MatchData object that would be the result of that regex from the message object?
<Xeago>
it is in @matches, but that doesn't have an accessor
<dominikh>
no you can not, and that's not what's in @matchers (I don't know any @matches). every capture group will be one argument to the called method, but there's no MatchData object stored or passed around.