def setup(): global client global user client = IRCClient() user = Bot(client) user.identify()
def run(self, host=None): if host == None and not hasattr(self,'host'): raise Exception("run: no host set or given") if self.nick == None: raise Exception("run: no nick set") if self.name == None: raise Exception("run: no name set") self.host = host or self.host Bot.run(self, self.host)
def __init__(self, nick=None, name=None, channels=None, password=None, debug=True): Bot.__init__(self, nick, name, channels, password) self.joined = False self.autoTofadeThreshold = 98 self.riddleMaxDist = 2 self.debug = debug self.TGtime = 5 self.pings = {} self.memoryDepth = 20 self.lolRateDepth = 8 self.msgMemory = [] self.cron = Cron() self.plugins = self.load_plugins()
def __init__(self, nick=None, name=None, channels=None, password=None, debug=True): Bot.__init__(self, nick, name, channels, password) self.joined = False self.autoTofadeThreshold = 98 self.riddleMaxDist = 2 self.debug = debug self.TGtime = 5 self.lolRateDepth = 8 self.cron = Cron() self.lastTGtofbot = 0 self.memoryDepth = 50 self.last_interaction = int(time.time()) self.plugins = self.load_plugins()
from config import Config from irc import Bot from treestatus import ( TreeStatus, UnknownBranch, ) from pulse_dispatch import PulseDispatcher import os config = Config('pulsebot.cfg') treestatus = TreeStatus(config.treestatus.server) bot = Bot(config) dispatcher = PulseDispatcher(bot.msg, config) for command, where, nick in bot: verb, args = command[0], command[1:] if verb == 'status': if len(args) != 1: bot.msg(where, nick, 'Try again with "status <branch>"') else: branch = args[0] try: status = treestatus.current_status(branch) bot.msg( where, nick, '%s is %s' % (status['tree'], status['status'].upper())
def msg(self, chan, msg): for m in msg.split("\n"): Bot.msg(self, chan, m)
# file, You can obtain one at http://mozilla.org/MPL/2.0/. from config import Config from irc import Bot from treestatus import ( TreeStatus, UnknownBranch, ) from pulse_dispatch import PulseDispatcher import os config = Config('pulsebot.cfg') treestatus = TreeStatus(config.treestatus.server) bot = Bot(config) dispatcher = PulseDispatcher(bot.msg, config) for command, where, nick in bot: verb, args = command[0], command[1:] if verb == 'status': if len(args) != 1: bot.msg(where, nick, 'Try again with "status <branch>"') else: branch = args[0] try: status = treestatus.current_status(branch) bot.msg( where, nick, '%s is %s' % (status['tree'], status['status'].upper()))