Code:
import socket
import string
import urllib2
host = "irc.rizon.net"
port = 6667
channel = "#help"
nick = "TestBot"
ident = "TestBot"
realname = "TestBot"
irc = socket.socket()
irc.connect( (host,port) )
irc.send('NICK ' + nick + '\r\n')
irc.send('USER ' + ident + ' ' + host + ' bla : ' + realname + '\r\n')
irc.send('JOIN '+ channel + '\r\n')
irc.send('PRIVMSG' + channel + ':test\r\n')
while 1:
read = irc.recv(4096)
if read.find ('PING') != -1:
irc.send( ' PONG ' + read.split() [ 1 ] + '\r\n')
print read
if read.find('!hello') != -1:
irc.send('PRIVMSG ' + channel + ' :Hello world!\r\n')
It doesn't have the Urban Dictionary API yet.
Here's a link to the API:
https://github.com/novel/py-urbandict
(or http://urbandictionary.com/define.php?term=)
Bookmarks