Internet Relay Chat
Revision as of 16:50, 8 January 2013 by Michael Murtaugh (talk | contribs) (→Programming an IRC bot in Python)
Servers
As free software, anyone can download and run IRC server. In addition, there are many public IRC servers where you can create your own channels.
Public IRC: http://quakenet.org, http://freenode.net
Clients
IRC Clients
- Pidgin
Browser Plugins
Web IRC Interfaces
- [Kiwi IRC] a free javascript/web based IRC client
<Derp> _____ _____ ______ _______ ________ __ _____ _______
<Derp> | __ \_ _| ____|__ __| |___ /\ \ / /\ | __ \__ __|
<Derp> | |__) || | | |__ | | / / \ \ /\ / / \ | |__) | | |
<Derp> | ___/ | | | __| | | / / \ \/ \/ / /\ \ | _ / | |
<Derp> | | _| |_| |____ | | / /__ \ /\ / ____ \| | \ \ | |
<Derp> |_| |_____|______| |_| /_____| \/ \/_/ \_\_| \_\ |_|
<Derp> __ ___ ___ ___ __ _ __ ___
<Derp> )_) ) )_ ) / \ X / /_) )_) )
<Derp> / _(_ (__ ( /_ \/ \/ / / / \ (
<Derp> o--o o-O-o o--o o-O-o o---o o o O o--o o-O-o
<Derp> | | | | | / | | / \ | | |
<Derp> O--o | O-o | -O- o o o o---oO-Oo |
<Derp> | | | | / \ / \ / | || \ |
<mennomarlon> ..
<Derp> o o-O-o o--o o o---o o o o oo o o
<source>
== Using in python ==
* [http://pypi.python.org/pypi/irc irc] library for python
=== Creating a bot in python ===
<source lang="python">
...
<joak> ok
<DerKaizer> o _ _ _
<DerKaizer> _o /\_ _ \\o (_)\__/o (_)
<DerKaizer> _< \_ _>(_) (_)/<_ \_| \ _|/' \/
<DerKaizer> (_)>(_) (_) (_) (_) (_)' _\o_
<Derp> ▄██████████████▄▐█▄▄▄▄█▌
<Derp> ██████▌▄▌▄▐▐▌███▌▀▀██▀▀
<Derp> ████▄█▌▄▌▄▐▐▌▀███▄▄█▌
<Derp> ▄▄▄▄▄██████████████▀
Programming an IRC bot in Python
Download this http://pypi.python.org/pypi/irc
#! /usr/bin/env python
"""
HelloBot
"""
import irc.bot
from time import sleep
class Bot (irc.bot.SingleServerIRCBot):
def __init__(self, server, channel, nickname, port=6667):
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
self.channel = channel
def on_nicknameinuse(self, c, e):
c.nick(c.get_nickname() + "_")
def on_welcome(self, c, e):
c.join(self.channel)
def on_privmsg(self, c, e):
sleep(2)
c.privmsg(e.source.nick, "I don't speak privately")
# self.do_command(e, e.arguments[0])
def on_pubmsg(self, c, e):
msg = e.arguments[0]
print msg
sleep(2)
c.privmsg(self.channel, "you said:" + msg)
# c.privmsg(e.source.nick, "EEEE")
#############################################
# Standard code to start the bot
#############################################
def main():
import sys
if not len(sys.argv) >= 3 :
print "Usage: testbot server[:port] channel nickname"
sys.exit(1)
s = sys.argv[1].split(":", 1)
server = s[0]
if len(s) == 2:
try:
port = int(s[1])
except ValueError:
print "Error: Erroneous port."
sys.exit(1)
else:
port = 6667
channel = sys.argv[2]
nickname = sys.argv[3]
bot = Bot(server, channel, nickname, port)
bot.start()
if __name__ == "__main__":
main()