dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.2.5
djbkd has quit [Remote host closed the connection]
Azure has quit [Excess Flood]
Azure has joined #cinch
newtoruby has joined #cinch
newtoruby is now known as isuckatruby
<isuckatruby>
hey all. i'm playing around with ruby/cinch with pretty much no prior development experience so forgive my ignorance. i'd like to require someone to be a channel operator to be able to issue ! commands for a couple plugins i created.
<isuckatruby>
would anyone be able to help me out for a bit? i know i'm asking a lot.
<isuckatruby>
i've gone through the API and found the #opped? helper, but im not sure how to implement it
<isuckatruby>
perfect. thank you. did you just type that example up, or is there a repository out there somewhere?
<dominikh>
I typed that up
<isuckatruby>
ok. thanks for the help, and for the framework. i'm using the "cinch-for-twitch" fork. it's made it pretty easy to do what i want it to do, having never touched ruby before today
<dominikh>
(there's nothing special about that code, it's just normal programming)
<isuckatruby>
it connects, i think some of the functionality was ripped out to make it compatible (i think i remember reading some of the WHOIS checks caused it to fail)
<dominikh>
yeah, that sounds about right
<dominikh>
(twitch isn't technically IRC)
<isuckatruby>
i know their "IRC" implementation is.... lacking
<isuckatruby>
but i'm just trying to put something together for a buddy so it doesn't have to be pretty, though i'd definitely prefer if they did use IRC or implemented the whole RFC correctly
<dominikh>
I've seen numerous streaming websites using "IRC" that wasn't IRC. I think that's a basic requirement internally, having a messy, broken implementation :P
<isuckatruby>
lol
<dominikh>
the fork doesn't look too bad. It's basically the changes I refused to add to Cinch itself
<isuckatruby>
cool. i haven't run into any issues with it, and haven't noticed anything missing that i would have used, but i'm a noob so what do i know
<isuckatruby>
i wouldn't really know of an easy way to diff the files to know what's changed
<isuckatruby>
lol, figured it was alreayd built into github :P
<isuckatruby>
really not as much changed as i would have expected. pulled out autovoice, some whois checks, and some mask stuff that i'm not sure what entirely it does
<dominikh>
it's really quite hacky tbh. a clean job would've removed more things and restructured others.
<dominikh>
but I guess it's fine for simple twitch bots
<isuckatruby>
i'm sure this is really hacky and i haven't tested it yet, but here's what i'm doing : http://pastebin.com/21v2deEV
<isuckatruby>
anything i should do better to clean that up?
<dominikh>
you should definitely not use #{} to call quoteadd
<dominikh>
string interpolation shouldn't have side effects like that, that just makes the code harder to follow
<dominikh>
id = quoteadd(quote); m.reply("...#{id}")
<dominikh>
and, of course, you shouldn't use string interpolation for your SQL query… line 11 allows for SQL injection
<dominikh>
that should be a prepared statement instead
<dominikh>
stmt = con.prepare("INSERT INTO foo(...) VALUES(?)"); res = stmt.execute(quote); -- or whatever the specific API of that mysql gem is.
<isuckatruby>
And would that prevent a peasant from writing to the sql database, since i only have the check under def execute and not def quoteadd?
<dominikh>
there's no way for a peasant to call quoteadd, other than by going through execute
<isuckatruby>
so quoteadd isn't called until the execute method defines the quoteid variable?
<dominikh>
until the execute method calls quoteadd, yes
<isuckatruby>
ok, good to know. i should have just joined this channel 6 hours ago. ;) (not only new to ruby, but development in general)
<dominikh>
do note that this channel isn't really for teaching Ruby, or programming, it tends to be for specific questions about Cinch. #ruby is a much better channel for learning Ruby. I don't mind helping out with some things, but I don't generally teach Ruby :)
<isuckatruby>
well thanks a ton for the patience and advice. really appreciate it. gonna get back to it
<dominikh>
enjoy
isuckatruby has quit [Quit: Page closed]
sarkyniin has joined #cinch
ConcernedHobbit is now known as ConcernedQuestin
ConcernedQuestin is now known as ConcernedHobbit
Azure has quit [Ping timeout: 252 seconds]
Azure has joined #cinch
head8debian has quit [Ping timeout: 246 seconds]
head8debian has joined #cinch
head8debian has joined #cinch
sarkyniin has quit [Remote host closed the connection]
sarkyniin has joined #cinch
Azure has quit [Quit: Oops.]
Azure has joined #cinch
Liothen has quit [Ping timeout: 264 seconds]
Liothen has joined #cinch
sarkyniin has quit [Remote host closed the connection]