예제 #1
0
파일: channels.py 프로젝트: kanhan258/phbot
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
예제 #2
0
파일: plugins.py 프로젝트: kanhan258/phbot
def run(msg, matches):
    receiver = utils.get_receiver_id(msg)
    if len(matches) == 1:
        if matches[0] == "!plugins":
            return list_plugins(receiver=receiver)
        elif matches[0] == "reload":
            utils.load_enabled_plugins()
            return list_plugins(True)
    elif len(matches) == 2:
        if matches[0] == 'enable':
            return enable_plugin(matches[1], receiver)
        else:
            print("Disable {} on this chat".format(matches[1]))
            return disable_plugin(matches[1], receiver)
    elif len(matches) == 3:
        if matches[0] == 'enable':
            return enable_plugin_chat(matches[1], receiver)
        else:
            return disable_plugin_chat(matches[1], receiver)
예제 #3
0
def run(msg, matches):
    receiver = utils.get_receiver_id(msg)
    if len(matches) == 1:
        if matches[0] == "!plugins":
            return list_plugins(receiver=receiver)
        elif matches[0] == "reload":
            utils.load_enabled_plugins()
            return list_plugins(True)
    elif len(matches) == 2:
        if matches[0] == "enable":
            return enable_plugin(matches[1], receiver)
        else:
            print("Disable {} on this chat".format(matches[1]))
            return disable_plugin(matches[1], receiver)
    elif len(matches) == 3:
        if matches[0] == "enable":
            return enable_plugin_chat(matches[1], receiver)
        else:
            return disable_plugin_chat(matches[1], receiver)
예제 #4
0
파일: channels.py 프로젝트: kanhan258/phbot
def run(msg, matches):
    receiver = utils.get_receiver_id(msg)
    if matches[0] == "enable":
        return enable_channel(receiver)
    if matches[0] == "disable":
        return disable_channel(receiver)