Ejemplo n.º 1
0
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())
                )
            except UnknownBranch:
                bot.msg(where, nick, 'Unknown branch: %s' % branch)
    elif verb == 'retry':
        # This isn't very secure, but then the action is presumably not very
        # sensitive.
        if where == nick == bot.owner:
            url = args[0]
Ejemplo n.º 2
0
 def msg(self, chan, msg):
     for m in msg.split("\n"):
         Bot.msg(self, chan, m)
Ejemplo n.º 3
0
 def msg(self, chan, msg):
     for m in msg.split("\n"):
         Bot.msg(self, chan, m)
Ejemplo n.º 4
0
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()))
            except UnknownBranch:
                bot.msg(where, nick, 'Unknown branch: %s' % branch)
    elif verb == 'retry':
        # This isn't very secure, but then the action is presumably not very
        # sensitive.
        if where == nick == bot.owner:
            url = args[0]
            for push in dispatcher.hgpushes.get_push_info_from(url):