diff --git a/tipbot/modules/irc.py b/tipbot/modules/irc.py new file mode 100644 index 0000000..edc19e6 --- /dev/null +++ b/tipbot/modules/irc.py @@ -0,0 +1,58 @@ +#!/bin/python +# +# Cryptonote tipbot - IRC commands +# Copyright 2014 moneromooo +# +# The Cryptonote tipbot is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2, or (at your option) +# any later version. +# + +import sys +import string +import tipbot.config as config +from tipbot.log import log_error, log_warn, log_info, log_log +from tipbot.utils import * +from tipbot.irc import * +from tipbot.command_manager import * + +def JoinChannel(nick,chan,cmd): + sendto=GetSendTo(nick,chan) + jchan = GetParam(cmd,1) + if not jchan: + SendTo(sendto,'Usage: join ') + rerurn + if jchan[0] != '#': + SendTo(sendto,'Channel name must start with #') + return + Join(jchan) + +def PartChannel(nick,chan,cmd): + sendto=GetSendTo(nick,chan) + pchan = GetParam(cmd,1) + if pchan: + if pchan[0] != '#': + SendTo(sendto,'Channel name must start with #') + return + else: + pchan = chan + Part(pchan) + + +RegisterCommand({ + 'module': __name__, + 'name': 'join', + 'parms': '', + 'function': JoinChannel, + 'admin': True, + 'help': "Makes %s join a channel" % (config.tipbot_name) +}) +RegisterCommand({ + 'module': __name__, + 'name': 'part', + 'parms': '', + 'function': PartChannel, + 'admin': True, + 'help': "Makes %s part from a channel" % (config.tipbot_name) +})