dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.1.0
djbkd has joined #cinch
djbkd has quit [Remote host closed the connection]
kith has quit [Read error: Connection reset by peer]
kith has joined #cinch
FIQ has quit [Ping timeout: 252 seconds]
Guest58556 has joined #cinch
thews has quit [Read error: Connection reset by peer]
thews has joined #cinch
thews has joined #cinch
Edelwin has quit [Ping timeout: 245 seconds]
Edelwin has joined #cinch
Edelwin has joined #cinch
Edelwin has quit [Changing host]
Guest58556 has quit [Changing host]
Guest58556 has joined #cinch
Guest58556 is now known as FIQ
postmodern has quit [Quit: Leaving]
<Gizmokid2005> dominikh: I never did get a lambda working yesterday, however I was able to just create a helper method that works pretty well :)
frdmn has quit [Quit: ssssSSSSssss]
frdmn has joined #cinch
Snarf has joined #cinch
<dominikh> alright
<Gizmokid2005> oh how ironic. As you said that dominikh, it turns out it's matching incorrectly now.
<Gizmokid2005> I may have just done it wrong in my haze of fatigue last night. I thought doing this: on :message, /hello #{bot_nick}/i do |m| with a helper of def(bot_nick) bot.nick end would do it
<Gizmokid2005> turns out I was sorely mistaken
<Gizmokid2005> because then it just matches "hello" in any place in any message.
<dominikh> that won't do anything for you.
<dominikh> that regexp expression is evaluated *once*, and that's before the bot has a nick.
<dominikh> even if it were evaluated later, it'd still be *once* and wouldn't notice when the bot changes nick, for example
<dominikh> but as I said, stop using `on` handlers, use the plugin API. it's easy to do it there.
<Gizmokid2005> Yeah, I found the lambda example last night so I'm working on that right now
<Gizmokid2005> I think my big thing is it looks like the example is using the lambda to set what to search for in the beginning of the message and I need it at the end instead.
<dominikh> ignore the prefix/suffix bit; you can equally use a lambda for the pattern itself.
_Blizzy has joined #cinch
<_Blizzy> hello, I have a question. how would I check for a pm?
<dominikh> define "check"
<_Blizzy> example, I know to listen for a message, I would use 'on :message'
<_Blizzy> how would I listen for a pm.
<dominikh> :private
<_Blizzy> thank you very much, dominikh.
<dominikh> (also, :message includes both channel and private messages)
<dominikh> there,s :channel, :private and :message
<_Blizzy> thank you, dominikh.
<dominikh> you're welcome
<Gizmokid2005> dominikh: I feel really stupid looking at this lambda stuff. I'm just completely unable to get it to work like I'm expecting. if I want to just match "hello #{m.bot.nick}" in a plugin, I would expect the lambda should be within the match statement, if that's correct I'm just completely unclear on how it should be written
<Gizmokid2005> The example works and I mostly understand, but I've never worked with lambdas before and I'm just failing miserably to make sense of this.
<dominikh> the lambda gets called for every message and returns a regexp that Cinch then uses to try and match the message.
<Gizmokid2005> an empty prefix has to be // instead of '' then?
<dominikh> "" would work just as well. "" probably pins it to the beginning of the message (implicit ^ for string), while // allows the match anywhere in the message
<Gizmokid2005> I can just use // then. I had been wondering how best to just completely get rid of the prefix, which may have been part of my issue.
<Gizmokid2005> the other half is I seem to have been significantly complicating the lambda
<Gizmokid2005> my syntax is otherwise correct though, so that's good for me at least.
<dominikh> of course now that pattern also matches "foohello botnameothertext"
<Gizmokid2005> it seems using :prefix, '' at least makes sure it has to start with hello
<Gizmokid2005> with nothing else in front of it.
<dominikh> yes.
<dominikh> it's the same as saying /^/
<Gizmokid2005> someday I'll get the hang of regex too.
<dominikh> ("" equalling /^/ is an attribute of Cinch, not regexps. "foo" would e.g. translate to /^foo/ internally, for prefix)
<Gizmokid2005> Oohhh
<Gizmokid2005> got it.
<dominikh> it's… a weird special treatment of strings
<Gizmokid2005> but it works!
<Gizmokid2005> that's what counts, right? :)
<dominikh> it made sense for patterns, somewhat, because "foo" as a pattern would add ^ and $ anchors
<dominikh> meh, it's a terrible special case imo
<Gizmokid2005> Thanks again dominikh. In the end it was just my handling the lambda incorrectly to build the regex.
<Gizmokid2005> I was (once again) overcomplicating things.
<dominikh> heh
<Gizmokid2005> Is there a way I could donate to your "drink of choice purchasing fund" anywhere?
<dominikh> I used to have a pledgie I think, but nobody used it…
<dominikh> there's always paypal if one isn't disgusted by the company ;)
<Gizmokid2005> Paypal/google wallet?
<Gizmokid2005> I just get disgusted by Paypal's greedy fees
<dominikh> didn't know google wallet could be used to *accept* money as a private person
<Gizmokid2005> oh yes.
<Gizmokid2005> Send and receive
<Gizmokid2005> right through gmail actually
<dominikh> ah, gmail, now that's the catch
<Gizmokid2005> I'm not 100% sure if it's US only though...
<Gizmokid2005> Looks like gmail isn't a requirement
<Gizmokid2005> though US might be.
<Gizmokid2005> You can send money to anyone in the U.S. who has an email account, even if it is not Gmail. In order to claim the money, the recipient will just need to sign in or sign up for Google Wallet.
<dominikh> anyway, if you want to get me drunk, I'm dominik@honnef.co on paypal ;)
<Gizmokid2005> yep... :(
<Gizmokid2005> Haha, if that's your drink of choice :)
<dominikh> "google wallet card", now that sounds really american ;) a card for everything
<Gizmokid2005> haha yeah...
<Gizmokid2005> the card isn't required and actually only partiall works with wallet.
<_Blizzy> I have another question. let's say I wanted the bot to say 'Word is #{word}' when I typed '!word theword'
<_Blizzy> would I match using '!word (.+)'
<_Blizzy> I'm not good with regex.
<dominikh> for example. of course .+ does not limit it to a single word, since it can contain spaces
<_Blizzy> so, what would I use for a single word?
<dominikh> [^ ]+ would match a sequence of characters that doesn't contain a space
<_Blizzy> so '!word [^ ]+'
<_Blizzy> ?
<leftylink> http://rubular.com/ great for testing out your regular expressions
<dominikh> _Blizzy: you'll still need the () to capture it.
<leftylink> and quick reference at bottom
<_Blizzy> ok, thank you dominikh and leftylink.
<Gizmokid2005> dominikh: ^5
<dominikh> Gizmokid2005: thank you very much :)
<dominikh> that's enough for more than one drink
<Gizmokid2005> The pleasure is all mine :)
<Gizmokid2005> You've helped me out of my own stupidity more than once
<dominikh> :)
<Gizmokid2005> being pretty new to ruby in general it's more help than you may know. It's money well spent :D
<dominikh> well, it's certainly cheaper than a tutor :P
<Gizmokid2005> haha, exactly. Plus how much is the tutor going to know about how Cinch works? :D
<dominikh> well, that's what he'd pay me for :P
<Gizmokid2005> this is just a pet project for me to replace a multitude of bots I currently rely on (and can't work on) and to get into ruby a bit instead of only rails.
<Gizmokid2005> haha
<dominikh> what are these bots written in?
<Gizmokid2005> if it was feasible I'd give you a case of beer and a few meals worth of food to spend a saturday "hacking" with me :)
<Gizmokid2005> I think they're both written in python
<dominikh> yeah I don't think I live in the right country for that ;)
<Gizmokid2005> I'm positive one is and relatively sure the other is.
<Gizmokid2005> sadly that would be a long trip for sure dominikh
<dominikh> would have to be very good food.
<Gizmokid2005> I make some pretty good food
<dominikh> not "flying to the US" good ;)
<Gizmokid2005> (and my wife does as well, she is definitely quite the baker as well)
<Gizmokid2005> unless the trip was free :)
<dominikh> I'm not exactly a fan of long trips :)
<Gizmokid2005> I think my longest plane ride has been ~3 hours
<Gizmokid2005> and that's more than plenty.
<_Blizzy> I have a question. I am trying to use a plugin, yet it's not working. May I pastebin the plugin?
<Gizmokid2005> _Blizzy: it's hard to help without :)
<_Blizzy> the plugin doesn't work when I type for example: 'test hello'
<dominikh> first of all, drop the '' around the regexp
<Gizmokid2005> _Blizzy: that's because a plugin inherently requires that you use the prefix for the bot
<dominikh> that there matches a string
<Gizmokid2005> ^^ that too
<_Blizzy> so, what should I do then?
<dominikh> second, plugins have a default prefix, /^!/ -- so if the regexp were correct, it'd trigger on !test something
<dominikh> `set :prefix, //` would disable the prefix alltogether
<_Blizzy> I want to use the prefix !
<_Blizzy> I am testing it using !test word
<dominikh> <dominikh> first of all, drop the '' around the regexp
<_Blizzy> that was it. thank you, dominikh.
_Blizzy is now known as _NOTBLizzy
_NOTBLizzy is now known as _Blizzy
<_Blizzy> lets say I wanted to change the prefix to '-', would I type set :prefix, -
<dominikh> "-"
<_Blizzy> thank you again, dominikh.
_Blizzy has quit [Quit: Page closed]
<Gizmokid2005> dominikh: do you have any/know of any examples of using a sqlite db in cinch anywhere? I've got some ideas for using one for some things
<dominikh> Gizmokid2005: there's not much to it. same way you'd use sqlite in any other ruby script
<dominikh> either use it directly or throw some ORM (not AR) at it
<catepillar> you *have* to be careful with sqlite
<catepillar> cause it isn't threadsafe
<dominikh> catepillar: actually it is.
<Gizmokid2005> I'm good with sql (even though I hate sqlite) so I don't need an ORM luckily.
<dominikh> catepillar: well, if it got compiled properly.
<Gizmokid2005> serialized! <3
<dominikh> oh, even settable at runtime.
<Gizmokid2005> as long as the mode was compiled into it :)
<catepillar> hmmm, i had issues with it not being
<catepillar> but that was years ago
<Gizmokid2005> catepillar: using mode 1 :)
<catepillar> maybe it got better
<Gizmokid2005> but it could be new stuff too :)
<dominikh> honestly? it's been thread safe for at least.. 5 years I think. before that probably too, but I did not use it then
<Gizmokid2005> It'll be my first foray into ruby and sqlite so it should be fun.
djbkd has joined #cinch
<onewheelskyward> I'm using DataMapper in my cinch bot.
<onewheelskyward> Postgres backend, but there's no reason you couldn't sqlite it.
<dominikh> fwiw, I'm all for not using an ORM.
<onewheelskyward> Yeah, it's all about your use pattern.
<Gizmokid2005> It's been hard to use AR in rails just because I can think the sql out so much easier than I can ORM it.
<Gizmokid2005> For what I need a full-blown sql server isn't needed (at least yet) so sqlite is a good place to start.
<onewheelskyward> It's definitely a mental shift, the orms
<Gizmokid2005> most definitely the truth.
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
postmodern has joined #cinch
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
djbkd has quit [Remote host closed the connection]
frdmn has quit [*.net *.split]
lagweezle has quit [*.net *.split]
literal has quit [*.net *.split]
Snarf has quit [*.net *.split]
nickrw has quit [*.net *.split]
quaxim has quit [*.net *.split]
Rennex has quit [*.net *.split]
Liothen has quit [*.net *.split]
Paradox has quit [*.net *.split]
mpapis has quit [*.net *.split]
Rennex has joined #cinch
lagweezle has joined #cinch
Snarf has joined #cinch
quaxim has joined #cinch
lagweezle is now known as Guest68977
nickrw has joined #cinch
Guest68977 is now known as lagweezle
Liothen has joined #cinch
Paradox has joined #cinch
mpapis has joined #cinch
FiXato has quit [Ping timeout: 272 seconds]
FIQ has quit [Excess Flood]
Guest32925 has joined #cinch
djbkd has joined #cinch
djbkd has quit [Ping timeout: 255 seconds]
djbkd has joined #cinch
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
_Blizzy has joined #cinch
<_Blizzy> I finally got my pickrandom working on my bot.