def addadmin(user, channel, admin): """Add a user to the list of admins""" 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)
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)
def deladmin(user, channel, admin): """Remove a user from the list of admins""" 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)
def test_exists(self): config.set("key", "value") self.assertEqual("value", config.get("key"))
def test_converter_int_setandget(self): config.set("intkey", 2) self.assertTrue(isinstance(config.get_int("intkey"), int))
def test_default_doesnt_overwrite(self): config.set("not_overwritten_key", 1) self._set_default_options(not_overwritten_key=2) self.assertEquals(config.get_int("not_overwritten_key"), 1)