10
2
Task
Make a simple IRC bot which does simple task like greeting user.
Detail
(You may see this RFC document.)
Write a complete program that perform these:
The program inputs
nickname
andrealname
from the user.- All
nickname
andrealname
which form is[A-Za-z0-9]+
should be allowed, but it isn't important whether other forms are allowed. For example, if the user wants1234qwerty
asnickname
and5319009
asrealname
, the program should use those names, but it isn't important whether the program can use^^☆Rick Astley☆^^
(which includes non-alphabet&decimals) as (nickname
orrealname
) or not, even thought this name may be rejected by the server.
- All
The program inputs
serverAddress
from the user.- The form of
serverAddress
isserverIP:serverPort
, whereserverIP
is the IP address of the server andserverPort
is the port num of the server.
- The form of
The program connects to port
serverPort
at IRC serverserverIP
, and it should set it's nickname asnickname
and realname asrealname
by sendingUSER realname 0 * :realname
andNICK nickname
.The program inputs a single
channelName
which doesn't include#
, and join to the channel#channelName
.Send a private message
Hello, world!
to the#channelName
channel like this:PRIVMSG #channelName :Hello, world!
Then, the program does these:
A. If someone joins, greeting him by saying
Hello, @!
to#channelName
, where @ is the nickname of him/her.B. If the program is kicked, try re-joining.
C. If a person is kicked or banned, say
POW HAHA
.D. If a person leaves (
PART
orQUIT
), sayGoodbye, @!
, where @ is the nickname of him/her.E. If someone says some text including
Turing test
orturing test
, sayI'm a human!
.F. If someone says some text including
6*9
, quit by sendingQUIT :42
to the server.G. If someone says some text including
all your base are belong to us
(case-insensitive), quit by sendingQUIT :What you say!
to the server.H. If someone says some text preceding with a space and above acts aren't performed by the text, say the sum of charcode of all (except the first space) chars in the text.
If an error is occurred
If an error (such as connection error or invalid nickname
) is occurred, you can do what you want to do. For example, if the nickname
is already in use, the program may stop, gets a new nickname
from the user, or automatically change the nickname
and retry.
Restriction
The program
- Should not use any internal functions or libraries which is for IRC client/bot making. i.e. something like IRC client libraries
- Should prompt what it'll input, before it gets an input. For example, before inputs
serverAddress
, it should promptWrite the address of server:
,serverIP:serverPort >
,serverAddress >
, or some text that the user can recognize. - Should work on several IRC servers using UTF-8. (i.e. not for single server)
- 's messages send to server shouldn't be
NOTICE
. (RFC 2812, 3.3.2 Notice : The difference betweenNOTICE
andPRIVMSG
is that automatic replies MUST NEVER be sent in response to aNOTICE
message.) - Should send a message where the request came from (
#channelName
ornickname
). - Should
PONG
whenPING
ed, of course.
PS
Well, I just made this, because there was no puzzle about IRC bot.
Edit
After reading @dmckee's comment, I changed the rule for choosing winner.
Default
bonus
= +0If somehow the program can connect to a channel (even if it's not
#channelName
),bonus
= 1If the program can perform step 1~5,
bonus
*= 2.For each tasks A~H in step 6, if the program implements,
bonus
*=1.2
.For each six restrictions, if the program follows that,
bonus
*=1.05
.
and score = int(codelength/bonus)
.
Program with lowest score is winner. If two answers have same score, then the answer with highest votes wins.
EDIT Edit : I think 1.2
and 1.05
in step 4 and 5 should be adjusted slightly bigger.. What do you think about this?
The winner is decided, however, I think there was too few entries.
Anyone still may submit the code.. :P
@lunixbochs: as a person who uses IRC waaay too much, kicks are channel only. If you're not on the server anymore, you got killed. – Wug – 2012-10-09T19:45:59.643
4
Frankly we have not been very accepting of "There is no metric, just vote.". There are things for you to work with here in terms of setting up an objective metric for this task. See Fake error message for a possible example.
– dmckee --- ex-moderator kitten – 2011-06-11T16:18:49.620@dmckee : Sorry, I didn't know that votes was quite subjective.. :( – JiminP – 2011-06-12T00:36:09.150
@JiminP: Nice save. – dmckee --- ex-moderator kitten – 2011-06-12T00:38:35.863
irc bot sounds like a longer golf - I'm in though :) – lunixbochs – 2011-06-12T01:01:00.737
clarification: "If the program is kicked, try re-joining." - does this mean from the server or the channel? – lunixbochs – 2011-06-12T01:40:13.213
@lunixbochs From the channel. – JiminP – 2011-06-12T01:52:32.110
no other comers? sadness. playing golf by myself is lonely :) – lunixbochs – 2011-06-15T06:09:20.083
I think I can't decide winner now, because there isn't many codes... :( – JiminP – 2011-06-17T05:53:16.547