21 Maret 2008

Writing automatonshttp://www.irchelp.org/irchelp/ircprimer.html#Start

2.10 Writing automatons
An automaton, (also called robot or service), is a program that is connected to the IRC network to provide services. Many people try to set that up with a few ircII commands like:

on ^msg "% help" notice $0 This is LameBot 1.0

However, you should know that setting up an automaton using ircII ON facilities is quick and dirty, and should be reserved for robots that rely on ircII specific features such as DCC (file servers for instance). Writing a program in C, perl or any decent programming language should take longer in the beginning, but your efforts will be rewarded. You can download skeletons of such programs on some ftp sites that keep IRC related stuff (check in the Frequently Asked Questions part).

Although most robots-writers believe they have created a "smart thing", 99% of the robots online happen to be a nuisance to the IRC community, because a few simple rules were not respected by their owners. The main idea is that robots should neither be seen nor heard:

1. automatons should be clearly identified as such, having "bot","serv" or "srv" in their nickname.

2. they should use NOTICES to communicate with the rest of the world, and not reply to NOTICES they get.

3. they should be able to always be killed (craziness is a frequent disease among robots).

4. they should be able to be killed remotely by their owner via IRC.

5. they should not give access to their owner's real files, (bandits have already been able to crack people's accounts through their robots).

6. they should not send messages to channels (unless the channel is dedicated to that robot).

7. they should not flood channels with MODE changes. Basically, if you have such a command as:


on -JOIN "Lamer #BotTub" mode #BotTub +o Lamer

then you are wrong. Because this is what you will get:

*** Lamer (clueless@where.the.hell) has joined channel #bottub
*** Mode change "+o Lamer" on channel #bottub by LameBot
*** Mode change "+o Lamer" on channel #bottub by StupidSrv
*** Mode change "+ooo Lamer Lamer Lamer" on channel #bottub by FloodServ
*** Mode change "+o Lamer" on channel #bottub by Dumbbot

And this will get boring very soon, so don't be surprised if such robots get banned from most channels. A good kludge is to wait until someone asks explicitly the robot to be opped on a channel. This could be:


on -MSG "Lamer op me on #BotTub" mode #BotTub +o Lamer

If you don't respect rules 2 and 6 above, this may happen too:

*** TalkBot (clueless@where.the.hell) has joined channel #bottub
Hi TalkBot!
Hello LameBot! How are you?
*** Mode change "+o TalkBot" on channel #bottub by LameBot
Fine thanx.
Thank you for the op, LameBot.
No problem, TalkBot.
*** Signoff: Talkbot (ircserver.irc.edu where.the.hell)
*** TalkBot (clueless@where.the.hell) has joined channel #bottub
*** Mode change "+o TalkBot" on channel #bottub by where.the.hell
*** Mode change "+o LameBot" on channel #bottub by TalkBot
*** Mode change "+o TalkBot" on channel #bottub by LameBot
Thank you for the op, LameBot.
No problem, TalkBot.
...

See? Remember the golden rule:

A smart bot won't act unless explicitly asked by someone to.

0 komentar: