allow bots to activate plugins, but do not answer them
This commit is contained in:
@@ -67,7 +67,7 @@ def runtimeconf_get(key, default=None):
|
||||
|
||||
@interprocess_locked(runtime_config_store.filename)
|
||||
def runtimeconf_persist():
|
||||
logging.getLogger(__name__).debug(json.dumps(runtime_config_store, indent=2))
|
||||
# logging.getLogger(__name__).debug(json.dumps(runtime_config_store, indent=2))
|
||||
runtime_config_store.write()
|
||||
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ class IdleBot(ClientXMPP):
|
||||
))
|
||||
self.hangup()
|
||||
return False
|
||||
elif msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()):
|
||||
self.logger.debug("not talking to the other bot named {}".format( msg_obj['mucnick']))
|
||||
return False
|
||||
# elif msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()):
|
||||
# self.logger.debug("not talking to the other bot named {}".format( msg_obj['mucnick']))
|
||||
# return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
@@ -978,14 +978,11 @@ def recognize_bots(**args):
|
||||
|
||||
@pluginfunction("remove-from-botlist", "remove a user from the botlist", ptypes_COMMAND)
|
||||
def remove_from_botlist(argv, **args):
|
||||
if 'remove-from-botlist' != argv[0]:
|
||||
return
|
||||
|
||||
if len(argv) != 2:
|
||||
return {'msg': "wrong number of arguments!"}
|
||||
|
||||
if args['reply_user'] != config.conf_get('bot_owner'):
|
||||
return {'msg': "only %s may do this!" % config.conf_get('bot_owner')}
|
||||
if args['reply_user'] != config.conf_get('bot_owner') and args['reply_user'] != argv[1]:
|
||||
return {'msg': "only %s or the bot may do this!" % config.conf_get('bot_owner')}
|
||||
|
||||
if argv[1] in config.runtime_config_store['other_bots']:
|
||||
config.runtime_config_store['other_bots'].remove(argv[1])
|
||||
|
||||
@@ -161,6 +161,9 @@ class UrlBot(IdleBot):
|
||||
# message = _prevent_panic(message, msg_obj['from'].bare)
|
||||
# if get_bots_present(msg_obj['from'].bare):
|
||||
# return
|
||||
if msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()):
|
||||
self.logger.debug("not talking to the other bot named {}".format( msg_obj['mucnick']))
|
||||
return False
|
||||
self.send_message(
|
||||
mto=msg_obj['from'].bare,
|
||||
mbody=message,
|
||||
|
||||
Reference in New Issue
Block a user