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()
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"])
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'])
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"])
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'])