dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.0.9
UberDragon has joined #cinch
Spami has quit [Quit: This computer has gone to sleep]
Spami has joined #cinch
leftylink has joined #cinch
Spami has quit [Quit: This computer has gone to sleep]
DonovanYoung has quit [*.net *.split]
catepillar has quit [*.net *.split]
DonovanYoung has joined #cinch
catepillar has joined #cinch
robonerd has joined #cinch
<robonerd> ahh, channel!
<robonerd> what is the most direct way i can run cinch? i just compiled and installed ruby 2 into /usr/local/bin. and now i've downloaded cinch's source code. what next?
robonerd has quit [Quit: ...]
robonerd has joined #cinch
space_ has joined #cinch
space has quit [Ping timeout: 248 seconds]
kludge` has quit [Ping timeout: 245 seconds]
kludge` has joined #cinch
space_ has quit [Remote host closed the connection]
<ayonix> robonerd: look at the examples in the repository
postmodern has quit [Quit: Leaving]
xeviox|afk is now known as xeviox
<DonovanYoung> dominikh: heh, yeah that's me. I keep waffling on my nick.
<DonovanYoung> I figure 'dyoung522' is in my /whois info
<DonovanYoung> do you ever go back and look at code you wrote a while back and shudder?
<dominikh> yup.
space has joined #cinch
swingha has joined #cinch
<DonovanYoung> I wish I had a time machine just so I could go back in time and slap myself.
<dominikh> I wish I were motivated enough to fix the code ;)
<cout> my old self would still justify it.
<DonovanYoung> heh, I imagine having an argument with myself.
<dominikh> also, sometimes "a while back" is 1-2 days
<DonovanYoung> heh
<DonovanYoung> also true
Spami has joined #cinch
robonerd has quit [Quit: ...]
AJ-Lee has joined #cinch
<AJ-Lee> Hi there...
<dominikh> Ahoy.
<AJ-Lee> I'm kind of new to Ruby (which is why I got Cinch to begin with) is there a way to create a config file and have it included in a controller scipt, same with plugins?
<dominikh> No idea what a "controller script" is, but this is really a Ruby question and not a Cinch question.
<AJ-Lee> No, it's a cinch question because I want to do it for my cinch-bot. A controller scipt in this context would be a script that I run that would load a config and the plugins for my bot instead of having one big messy file.
<dominikh> It's a Ruby question because it doesn't matter what you want to use it for, it's basic Ruby.
<AJ-Lee> Listen dominikh, I don't need you to be rude. I'm just trying to get some answers here.
<dominikh> *shrug* good luck.
<ayonix> AJ-Lee: so what's wrong with the standard way of doing so?
<ayonix> also, you might want to have a look at https://github.com/netfeed/cinchize
<AJ-Lee> There's nothing really "wrong" with it, but I'm a neat sort of coder and I want to have the plugins in seperate scripts for neatness.
<ayonix> have a look at how cinchize is implemented then
<AJ-Lee> Will do. Thank you.
postmodern has joined #cinch
<ayonix> well..basically you would just have to write such a config file and convert some of the values and pass it to the configuration
<ayonix> it would be practically the same
<ayonix> if you don't want to use another gem
<AJ-Lee> Alright, thank you.
robonerd has joined #cinch
space has quit [Read error: Connection reset by peer]
<AJ-Lee> Can someone tell me why when I use "helpers do" it's telling me it's an unknown method?
<AJ-Lee> well "undefined"
<dominikh> using it in a plugin class or in a Bot.new block?
<AJ-Lee> Bot.new
<dominikh> show code.
<dominikh> and the actual exception
<AJ-Lee> helpers do
<AJ-Lee> def google(query)
<AJ-Lee> res = Nokogiri::HTML(open(url)).at("h3.r")
<AJ-Lee>
<AJ-Lee> url = "http://www.google.com/search?q=#{CGI.escape(query)}"
<AJ-Lee> title = res.text
<AJ-Lee> link = res.at('a')[:href]
<AJ-Lee> desc = res.at("./following::div").children.first.text
<AJ-Lee> rescue
<AJ-Lee> "No results found"
<AJ-Lee> else
<AJ-Lee> CGI.unescape_html "#{title} - #{desc} (#{link})"
<dominikh> a) do not paste code in IRC b) I don't want a random excerpt, I want the entire file you are executing.
<dominikh> that helpers invocation is certainly not in a Bot.new block
<dominikh> ... nor is one of your 'on's
<AJ-Lee> Well both 'on's work
<dominikh> but of course it's hard to tell what's where with that messed up indentation :)
<AJ-Lee> So what do I do.
<dominikh> both ons? there are three…
<AJ-Lee> Both of the ones I added.
<dominikh> and yet there are three.
<AJ-Lee> Because one came in the example. :|
<dominikh> and did the example have it outside the Bot.new block?
<AJ-Lee> Yeah
<AJ-Lee> I don't know if that one works because the bot will no load.
<AJ-Lee> not*
<dominikh> doubtful. what's the example?
<AJ-Lee> It's the one that calls the google.
<dominikh> https://github.com/cinchrb/cinch/blob/master/examples/basic/google.rb doesn't have it outside the Bot.new block.
<AJ-Lee> I fixed it.
<AJ-Lee> It runs.
<dominikh> great
<AJ-Lee> I would use the plugin example and work off that but I can't figure out what the trigger is. Like I said, I'm a n00b, I've done TCL and mIRC coding for irc and VB and C++ for anything else.
xeviox is now known as xeviox|afk
<dominikh> plugins have a default prefix of ! for matchers
<dominikh> so match "foo" would trigger on !foo
<dominikh> same for ones that use regexes
<dominikh> I'm afk for the next 1-2 hours now.
<AJ-Lee> Okay. Thanks
<robonerd> heya =)
<AJ-Lee> Hi there
<AJ-Lee> Well the google plugin isn't working, but the urban dictionary is
Agent08 has joined #cinch
<robonerd> so with cinch, if i want my bot to use a registered nick, how do i go about configuring the nick password in the configure method of Bot.new?
<robonerd> please, and thank you :D
<robonerd> i'm not finding "identify" in cinch documentation yet
<catepillar> robonerd: it depends on what server the bot is connecting to
<catepillar> but sometime you can have a config.password = "password"
<catepillar> otherwise you might have to User("Nickserv").send "IDENTIFY password"
<catepillar> irc registration isn't a standard
<robonerd> would i put User("Nickserv").send "IDENTIFY password" in Bot.new ?
<robonerd> in initialize, vs configure
<robonerd> i tried putting that code in the configure block but i got an error: "/Library/Ruby/Gems/2.0.0/gems/cinch-2.0.9/lib/cinch/user_list.rb:35:in `find_ensured': undefined method `isupport' for nil:NilClass (NoMethodError)" etc
<catepillar> i don't think it can go in configure
<catepillar> cause that all happens before the bot is connected to the IRC network
<catepillar> i dont remember all the handlers, but there might be one for on connect. every server I connected to was ok with config.password
<robonerd> mm
<robonerd> trying c.password now
<robonerd> omfg der it was there! i'm using xcode and it wasn't showing up in the intellisense
<robonerd> codesense? w/e
waxjar has quit [*.net *.split]
robonerd has quit [Ping timeout: 268 seconds]
robonerd has joined #cinch
waxjar has joined #cinch
<AJ-Lee> Can cinch only handle one Plugin class at a time?
<dominikh> cinch can handle as many plugins as you want
<robonerd> dominikh setting c.password in configure worked :P
<robonerd> i didn't find that in the docs for some rason
<dominikh> sure, that works for some servers. for freenode you could/should also use SASL
<Netfeed> \o/ "random" people recomending cinchize, rejoice
<robonerd> dominikh what's the best way to use sasl then?
<robonerd> and yea, freenode
Spami has quit [Quit: This computer has gone to sleep]
<Cinchy_> [URL] Module: Cinch::SASL — Documentation for cinch (2.0.9)
<robonerd> ahh, thank you!
<ayonix> Netfeed: srorry :P
<ayonix> s/srorry/sorry/
<Netfeed> no, no, it's great
<Netfeed> i'm even thinking about changing the numbering on cinchize to 1.0 or something, it's been kinda stable for more than a year now
<dominikh> time for a Cinch 3.0 with backwards incompatible changes then
<robonerd> what's cinchize?
<Netfeed> daemonizer for cinch
<Netfeed> dominikh: :)
<dominikh> of course daemonizing is a terrible idea, but cinchize has some other nice bits :P
<robonerd> why terrible idea?
<Netfeed> dameonizer for "trival" cinch bots, for bots that is using only plugins
<robonerd> isn't cinch good to run on a server's shell account?
<Netfeed> i wrote it because i didn't want to have a screen running all the time with it
<dominikh> Netfeed: that's what you use a supervisor for :)
<Netfeed> or just "ruby bot.rb &"
<dominikh> runit, upstart, systemd, what have you :P
<dominikh> #!/bin/sh
<dominikh> cd ~/Cinchy
<dominikh> exec ~/.rvm/bin/rvm 1.9.3-p448@cinchy do ruby -Ilib bot.rb 2>&1
<dominikh> that's my startup script for Cinchy_ :P
<dominikh> !eval @bot.nick = "Cinchy"
Cinchy_ is now known as Cinchy
<Cinchy> "Cinchy"
<dominikh> for Cinchy!
<Netfeed> meh, same stuff different name
<dominikh> no. the point here is that it's not detached from its starting process
<dominikh> no PID files, and direct monitoring to restart it, stop it etc
<dominikh> aka it runs in the foreground and a supervisor is multiplexing the fds of all processes it runs
<Netfeed> isn't that a bit overkill for a irc bot?
<dominikh> it's 3 lines of shell script, and I use it for all processes on my server ;)
<dominikh> it's my init system
<dominikh> same as nginx, postfix, etc
<robonerd> yea, irc bot is a service like any other
<robonerd> should be reliable
Agent08 has quit [Remote host closed the connection]
<Netfeed> /service/dominikh <-? :P
Agent08 has joined #cinch
<dominikh> a second service tree, that of the user dominikh
<dominikh> the bottom 3 entries in the paste
<dominikh> (yeah, I'm bad, I don't have a separate user for each of those things)
<Netfeed> robonerd: cinchize is reliable, it handles disconnects and such too, the only thing it doesn't really handle is server reboots
<robonerd> cool
<robonerd> dominikh lol
<robonerd> you wild man!
<Netfeed> but that can be handled by init-scripts really
<dominikh> don't get me wrong, I think cinchize is well done for what it is, I just think what it does isn't worth doing (to quote Sheldon) :P
<dominikh> it loads config files nicely though!
<robonerd> totally raining on his parade bro
<Netfeed> it depends
<dominikh> robonerd: it's okay, he's a fan. according to his possibly outdated host :D
<robonerd> hm
<Netfeed> if you only have "stock" plugins then cinchize's great, but it sucks if you have fancy stuff with say sharing two networks in one bot and so on
<robonerd> does cinch have poor handling of multiple network connections? i need my bot to have multi channel multi network
<dominikh> Cinch 3 will totally have built-in multi-network support. too bad nobody is working on Cinch 3 :<
<robonerd> so it's deadware, damn
<dominikh> robonerd: you need one instance of Bot per server
Agent08 has quit [Ping timeout: 245 seconds]
<dominikh> Cinch is maintained, it's not actively developed.
<dominikh> *not being
<Netfeed> it's fine as it is (tm)
<Netfeed> same with my plugins *cough*
<dominikh> :>
<Netfeed> the only thing i'd like to change is that cinch-title only checks for title for content-type text/html
<Netfeed> because ruby segfaults if you give nokogiri a pdf for example :)
<dominikh> it shouldn't segfault
<dominikh> but yeah, Cinchy has several such checks. only html/xhtml, only up to a certain file size, and iirc no chunked encoding
<Netfeed> no, wait, it segfaulted if you give it a .mov or whatever video-format it was
<dominikh> still shouldn't segfault :P
<dominikh> segfaults are bugs
<Netfeed> yeah, i asked on their email list if i should write a bug report (as they want to have it) but they just ignored me
<dominikh> just write a bug report, sheesh :P
<Netfeed> i don't care, ruby is in "lecay" mode right now for me
<dominikh> fair enough
<dominikh> same here, really
<dominikh> even though it was probably an issue in nokogiri's C extensions, in case you use that for cinch-title
<Netfeed> i'm "all" for go, but i'm not really sure i'm all that into it after reading about how database/sql works
<dominikh> not sure if mechanize is pure Ruby
<dominikh> what's wrong with database/sql
<Netfeed> i'm not really sure i like how it works, especially for not null fields with out defaults
<Netfeed> without
<dominikh> hm, no idea how that's handled. I tend not to use SQL
<dominikh> I thought people complain about null fields more
<Netfeed> ah, yeah, sorry, null fields i guess
<Netfeed> and that you have to scan into variables
<Netfeed> but it might just be that i'm not used to it yet
<dominikh> well, the latter part is pretty normal
<Netfeed> scanning or my ignorance? :P
<dominikh> the scanning :)
<Netfeed> yeah, it might be idiomatic for go, but i'm not just used to it i guess
<dominikh> you'll get used to it
<dominikh> if not, hire me.
Spami has joined #cinch
<Netfeed> go is kinda cumbersome if you come from perl(but most things is if you compare it to perl), but i really like the strictness and that it's explicit in a good way (not in a bad way like java)
<robonerd> wait, so you are against null or support it?
Spami has quit [Ping timeout: 240 seconds]
Spami has joined #cinch
<AJ-Lee> For some reason when I have more than one plugin in the script one one will work.
<dominikh> are you adding all plugins to the c.plugins.plugins setting?
<AJ-Lee> Yes I am.
<dominikh> as usual, show all code
<dominikh> that's not adding all plugins to c.plugins.plugins, that's setting the variable three times to three different values
<dominikh> if I say `a = 1; a = 2; a = 3`, the value of a will not be 6, or [1, 2, 3] – it will be 3.
<dominikh> c.plugins.plugins = [Google, UrbanDictionary, JoinPart];
<AJ-Lee> That's true. Makes sense.
<AJ-Lee> I was assuming it was like loadfile or something :|
<dominikh> nope, [] is an array, and Google etc are the classes.
<AJ-Lee> Gotcha, now the plugin you made, JoinPart; that's to get the bot to join and part channels on command, right?
<dominikh> iirc, yes.
<dominikh> they're only example plugins
<AJ-Lee> Okay