Example #1
0
def enable_channel(receiver):
    conf = utils.get_safe_setting('disabled_channels', list)
    if receiver not in conf:
        return "Channel is not disabled!"
    utils.generic_cfg(receiver, 'remove', list, 'disabled_channels')
    utils.reload_cfg_plugins('disabled_channels')
    return "Channel enabled"
Example #2
0
def disable_channel(receiver):
    conf = utils.get_safe_setting('disabled_channels', list)
    if receiver in conf:
        return "Channel already disabled!"
    utils.generic_cfg(receiver, 'append', list, 'disabled_channels')
    utils.reload_cfg_plugins('disabled_channels')
    return "Channel disabled"
Example #3
0
def pre_process(msg):
    receiver = utils.get_receiver_id(msg)
    if utils.is_sudo(msg) and msg.text == "!channel enable":
        peer = utils.get_receiver(msg)
        enable_channel(receiver)
        peer.send_msg("Channel enabled")
        return None  # Already processed
    conf = utils.get_safe_setting('disabled_channels', list)
    if receiver in conf:
        return None  # Don't process the message
    return msg