Opinions wanted! Is Ruby a good choice for

Hi there,

Some days ago I started to code an IRC bot like eggdrop for the antispam
society I am part in.
If you do not know about IRC or eggdrop you can stop here, otherwise I
would be happy if you read further on and tell me your opinions.

So… first of all, why Ruby?
I coded several websites in php and want something new, that’s all.
Some friends told me I should give Ruby a try and after reading some
tutorials it gets me because it’s very natural and easy to understand.

Why eggdrop?
Eggdrop is a really great bot with many features and is the choice if
you want to operate with a botnet. However, after included many own
scripts to support regexp/realname bans and many many other features
there are some things we don’t like. Sometimes it’s tcl itself,
sometimes the way how eggdrop acts, sometimes settings which are
hardcoded in eggdrop (e.g. logging, namesx) which are not easily to
change or impossible.
Eggdrop is not really under active development and so I got the idea to
code something new myself.

Ruby is really great, after some days I got the basics finished but the
first time I struggled with Ruby was at the time I tried to implement
the userdatase and banlists.
If you want to match strings against each other and want to use
wildcards you need to use regexp. “Basic use” of ? and * are not
supported and you need to create a workaround. (my prior question to
this: How to convert a "normal" searchstring into regexp - Ruby - Ruby-Forum )
The bad side is that IRC sets bans in this form and not in regexp, also
a normal user would set its userhost as mynick!myident@.some.thing and
wouldn’t use regexp, either.

So you would need to push all those bans, invites, exempts, userhosts
and so on through this workaround and back and I don’t think that this
is a good deal.

After I took a short break to do some other work I opened my scripts
again and looked at this workaround and now I’m not really sure anymore
if Ruby is the best choice to code such a bot.

Thanks for reading - it’s not like the normal posts in here, not a
technical question nor a script request :wink:
I would like to know your opinions about this because I’m really new to
Ruby and maybe I will run into more problems which I didn’t see yet.

Is it possible to code such a bot(net) by using Ruby? (sure, but I don’t
like workarounds)
… or maybe a better question:
Would you advise it?

Greetings, Noxx

On Tue, Oct 6, 2009 at 1:21 PM, Kioko – [email protected] wrote:

If you want to match strings against each other and want to use
wildcards you need to use regexp. “Basic use” of ? and * are not
supported and you need to create a workaround. (my prior question to
this: How to convert a "normal" searchstring into regexp - Ruby - Ruby-Forum )
The bad side is that IRC sets bans in this form and not in regexp, also
a normal user would set its userhost as mynick!myident@.some.thing and
wouldn’t use regexp, either.

It’s not too hard to handle this sort of thing - just convert the
pattern to a regexp and store the regexp internally. Conversion is
simply a matter of

Regexp.compile(pattern.gsub(‘.’, ‘.’).gsub(‘', '.’))

that is, replace “.” with “.” to match a literal . character, then
replace * with .* since that’s the regexp equivalent.

Is it possible to code such a bot(net) by using Ruby? (sure, but I don’t
like workarounds)
… or maybe a better question:
Would you advise it?

Absolutely. Ruby’s one of the most maintainable languages I’ve used,
and I’ve used a lot. Plus it’s a lot of fun to code in.

martin

Of course ruby is ideal for this!

There are ruby gems already with irc functionality for example:

http://rubyforge.org/projects/ruby-irc-yail/

http://rubyforge.org/projects/ril/

just google search for ‘ruby irc’!

Check them out, see if any meet your needs, (I haven’t tried these
myself )

For your database you could use yaml files or sqlite3
sqlite gives you the power of sql for queries but yaml is human
readable.

sqlite can be accessed with ruby libraries (gems) such as sequel,
datamapper or activerecord

All simple to use.

Have fun!