[Tutor] How to interact with users on IRC using Python
suryak at live.com
Mon Apr 16 17:11:56 CEST 2012
Actually, I am writing a small IRC bot for a game (A Multiplayer one).
This how my code looks. (I this code, I am just trying to read from IRC client and send a message to it..)
import sysimport socketimport string
s=socket.socket( )s.connect((HOST, PORT))s.send("NICK %s\r\n" % NICK)s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))s.send("JOIN ##MyChannel\n")
while 1: readbuffer=readbuffer+s.recv(1024) print readbuffer s.send("text:") .... # MY Code goes like this.
Actually, I am not even aware of IRC commands.. so I thought to take some help to carry on
This is what I require:
As my game is quite simple, I just need to transfer a small string from each player to another.
My game will have a two players.. so, Each user will join my ##myExampleChannel.Say, a player (or a IRC user) "p1" wants to play with "p2". They simply have to exchange private messages from each other.
So, what IRC commands should I use and how do I typically implement them?
Let me put the above this way:
How do I create a small IRC program which can send and receive private messages from users?
Thanks for reading! Hope you help me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor