diff options
author | tv <tv@xso> | 2011-09-05 20:45:56 +0200 |
---|---|---|
committer | tv <tv@xso> | 2011-09-05 20:45:56 +0200 |
commit | 2f5655ced03243ef03eb3417c9f090117568a885 (patch) | |
tree | 968bb8da4ae7508bd30371c13a239edfc7728d9d /Synapse/bot.py | |
parent | 34b55bc3cf29cdfbaa40c494e3d2011855f15cc8 (diff) |
//Synapse: emergency commit^_^
Diffstat (limited to 'Synapse/bot.py')
-rwxr-xr-x | Synapse/bot.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Synapse/bot.py b/Synapse/bot.py new file mode 100755 index 00000000..af974f4e --- /dev/null +++ b/Synapse/bot.py @@ -0,0 +1,34 @@ +#! /usr/bin/env python2 + +from irclib import IRC, ServerConnectionError, is_channel +from sys import exit +from os import environ as env + +host = str(env.get('host', 'irc.freenode.org')) +port = int(env.get('port', 6667)) +nick = str(env.get('nick', 'crabspasm')) +channel = str(env.get('channel', '#tincspasm')) +print '====> irc://%s@%s:%s/%s' % (nick, host, port, channel) + +irc = IRC() +try: + client = irc.server().connect(host, port, nick) +except ServerConnectionError, error: + print error + exit + +def on_connect(connection, event): + connection.join(channel) + print 'Es passiert...' + +def on_join(connection, event): + connection.privmsg(channel, 'lol') + +def on_disconnect(connection, event): + exit + +client.add_global_handler('welcome', on_connect) +client.add_global_handler('join', on_join) +client.add_global_handler('disconnect', on_disconnect) + +irc.process_forever() |