예제 #1
0
파일: bot.py 프로젝트: MeGaTG/pybot
def on_binlog_replay_end():
    global started
    started = True
    config = load_config()
    utils.save_cfg_settings(config)
    handle_sudoers(config)
    utils.load_enabled_plugins()
    cron_plugins()
예제 #2
0
def on_binlog_replay_end():
    global started
    started = True
    config = load_config()
    utils.save_cfg_settings(config)
    handle_sudoers(config)
    utils.load_enabled_plugins()
    cron_plugins()
예제 #3
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"])
예제 #4
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'])
예제 #5
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"])
예제 #6
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'])