Example #1
0
def delquote(user, channel, text):
    """Delete a quote with a specified number"""
    s_text = text.split()
    if is_admin(user):
        if len(s_text) > 1:
            quotenumber = s_text[1]
            logging.debug("Deleting quote: %s" % quotenumber)
            run_query("DELETE FROM quotes where ROWID = (?);",
                     [quotenumber], None)
Example #2
0
def addadmin(user, channel, text):
    """Add a user to the list of admins"""
    admin = text.split()[1]
    if is_admin(user):
        if admin in config.get("admins"):
            msg(channel, "%s already is an admin" % admin)
        else:
            config.set("admins", "%s,%s" % (config.get("admins"), admin))
            msg(channel,
                        "%s has been added to the list of admins" % admin)
Example #3
0
def deladmin(user, channel, text):
    """Remove a user from the list of admins"""
    admin = text.split()[1]
    if is_admin(user):
        if admin in config.get("admins"):
            admins = config.get("admins").split(",")
            admins.remove(admin)
            config.set("admins", ",".join(admins))
            msg(channel,
                        "%s has been removed from the list of admins" %
                        admin)
        else:
            msg(channel, "Sorry, %s is not even an admin" % admin)
Example #4
0
    def test_is_admin(self):
        config._get = mock.Mock(return_value=["superman", "bofh"])

        self.assertTrue(util.is_admin("superman"))
        self.assertFalse(util.is_admin("i'm-no-superman"))
Example #5
0
def admins(user, channel, text):
    """Show the list of admins"""
    if is_admin(user):
        msg(channel, config.get("admins"))
Example #6
0
def reconnect(user, channel, text):
    if is_admin(user):
        logging.debug("Reconnecting")
        util._BOT.quit("leaving")
Example #7
0
def quit(user, channel, text):
    if is_admin(user):
        logging.debug("Quitting")
        util._BOT.quit("leaving")
        reactor.stop()
Example #8
0
def join(user, channel, text):
    """Join a channel"""
    if is_admin(user):
        chan = text.split()[1]
        logging.debug("Joining %s" % chan)
        util._BOT.join_(chan)
Example #9
0
def part(user, channel, text):
    """Part a channel"""
    if is_admin(user):
        logging.debug("Parting %s" % text.split()[1])
        util._BOT.part(text.split()[1].encode("utf-8"))