Exemplo n.º 1
0
class Leet:
    @scheduled(Task.every().day.at("13:37"))
    def l33t(self):
        for servername, server in self.bot.servers.items():
            for channel in server.channels:
                self.bot.send(
                    Message(server=servername,
                            params=channel,
                            command="PRIVMSG",
                            text="LEET TIME"))
Exemplo n.º 2
0
class testing2:
    @command("argtest", groups="(.)(.*)")
    def argtest(self, message):
        return message.reply(str(message.groups))

    @command("test")
    def test(self, message):
        yield message.reply("your message: " + str(message))
        yield message.reply("your message: " + str(message))

    @command("data")
    def data(self, message):
        return message.reply("your message's data is: " +
                             repr(str(message.data)))

    @regex("^<(.*?)>$")
    def regextest(self, message):
        return message.reply(message.groups)

    @command("admin", adminonly=True)
    def admin(self, message):
        return message.reply("yes {}, you are an admin!".format(message.nick))

    @scheduled(Task.every(1).minute)
    def oneminute(self):
        self.bot.send(
            Message(server="Holmes",
                    params="#piperbot",
                    command="PRIVMSG",
                    text="1 min"))

    @adv_command("time")
    def timer(self, arg, target):
        start = time.perf_counter()
        try:
            while 1:
                x = yield
        except GeneratorExit:
            total = time.perf_counter() - start
            target.send(arg.reply(total, "took %s seconds" % total))
            target.close()