예제 #1
0
파일: plugins.py 프로젝트: kanhan258/phbot
def disable_plugin(name, receiver):
    if not utils.plugin_exists(name):
        return 'Plugin {} does not exists'.format(name)
    if not utils.plugin_enabled(name):
        return 'Plugin {} is not enabled'.format(name)
    generic_cfg(name, 'remove')
    print("Removed plugin {} to config file".format(name))
    utils.reload_cfg_plugins()
    return list_plugins(True, receiver)
예제 #2
0
def disable_plugin(name, receiver):
    if not utils.plugin_exists(name):
        return "Plugin {} does not exists".format(name)
    if not utils.plugin_enabled(name):
        return "Plugin {} is not enabled".format(name)
    generic_cfg(name, "remove")
    print("Removed plugin {} to config file".format(name))
    utils.reload_cfg_plugins()
    return list_plugins(True, receiver)
예제 #3
0
파일: plugins.py 프로젝트: kanhan258/phbot
def enable_plugin(name, receiver):
    print("")
    if utils.plugin_enabled(name):
        return 'Plugin {} is enabled'.format(name)
    if utils.plugin_exists(name):
        generic_cfg(name, 'append')
        print("Added plugin {} to config file".format(name))
        utils.reload_cfg_plugins()
        return list_plugins(True, receiver)
    else:
        return 'Plugin "{}" does not exists'.format(name)
예제 #4
0
def enable_plugin(name, receiver):
    print("")
    if utils.plugin_enabled(name):
        return "Plugin {} is enabled".format(name)
    if utils.plugin_exists(name):
        generic_cfg(name, "append")
        print("Added plugin {} to config file".format(name))
        utils.reload_cfg_plugins()
        return list_plugins(True, receiver)
    else:
        return 'Plugin "{}" does not exists'.format(name)
예제 #5
0
def disable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return "Plugin {} does not exists".format(name)
    cfg, data = getOrElse("disabled_plugins_on_chat", dict)
    plgs = data.get(receiver) or set()
    plgs.add(name)
    data[receiver] = plgs
    generic_cfg(data, "update", dict, field="disabled_plugins_on_chat")
    print("Disabled plugin {} in chat {} and saved".format(name, receiver))
    cfg["disabled_plugins_on_chat"] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} disabled in the chat {}".format(name, utils.emojis["wut"])
예제 #6
0
파일: plugins.py 프로젝트: kanhan258/phbot
def disable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return 'Plugin {} does not exists'.format(name)
    cfg, data = getOrElse('disabled_plugins_on_chat', dict)
    plgs = data.get(receiver) or set()
    plgs.add(name)
    data[receiver] = plgs
    generic_cfg(data, 'update', dict, field='disabled_plugins_on_chat')
    print("Disabled plugin {} in chat {} and saved".format(name, receiver))
    cfg['disabled_plugins_on_chat'] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} disabled in the chat {}".format(name,
                                                      utils.emojis['wut'])
예제 #7
0
def enable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return "Plugin {} does not exists".format(name)
    if not utils.is_plugin_disabled_on_chat(name, receiver):
        return "Plugin {} is not disabled in this chat".format(name)
    cfg, data = getOrElse("disabled_plugins_on_chat", dict)
    plgs = data.get(receiver)
    plgs.remove(name)
    data[receiver] = plgs
    generic_cfg(data, "update", dict, field="disabled_plugins_on_chat")
    print("Enabled plugin {} in chat {} and saved".format(name, receiver))
    cfg["disabled_plugins_on_chat"] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} enabled in the chat again! {}".format(name, utils.emojis["smile"])
예제 #8
0
파일: plugins.py 프로젝트: kanhan258/phbot
def enable_plugin_chat(name, receiver):
    if not utils.plugin_exists(name):
        return 'Plugin {} does not exists'.format(name)
    if not utils.is_plugin_disabled_on_chat(name, receiver):
        return 'Plugin {} is not disabled in this chat'.format(name)
    cfg, data = getOrElse('disabled_plugins_on_chat', dict)
    plgs = data.get(receiver)
    plgs.remove(name)
    data[receiver] = plgs
    generic_cfg(data, 'update', dict, field='disabled_plugins_on_chat')
    print("Enabled plugin {} in chat {} and saved".format(name, receiver))
    cfg['disabled_plugins_on_chat'] = data
    utils.save_cfg_settings(cfg)
    return "Plugin {} enabled in the chat again! {}".format(
        name, utils.emojis['smile'])