1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

allow bots to activate plugins, but do not answer them

This commit is contained in:
Thorsten S
2015-12-21 17:03:38 +01:00
parent 5c2f1b82ae
commit d2301d1679
4 changed files with 9 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ def runtimeconf_get(key, default=None):
@interprocess_locked(runtime_config_store.filename) @interprocess_locked(runtime_config_store.filename)
def runtimeconf_persist(): 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() runtime_config_store.write()

View File

@@ -52,9 +52,9 @@ class IdleBot(ClientXMPP):
)) ))
self.hangup() self.hangup()
return False return False
elif msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()): # elif msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()):
self.logger.debug("not talking to the other bot named {}".format( msg_obj['mucnick'])) # self.logger.debug("not talking to the other bot named {}".format( msg_obj['mucnick']))
return False # return False
else: else:
return True return True

View File

@@ -978,14 +978,11 @@ def recognize_bots(**args):
@pluginfunction("remove-from-botlist", "remove a user from the botlist", ptypes_COMMAND) @pluginfunction("remove-from-botlist", "remove a user from the botlist", ptypes_COMMAND)
def remove_from_botlist(argv, **args): def remove_from_botlist(argv, **args):
if 'remove-from-botlist' != argv[0]:
return
if len(argv) != 2: if len(argv) != 2:
return {'msg': "wrong number of arguments!"} return {'msg': "wrong number of arguments!"}
if args['reply_user'] != config.conf_get('bot_owner'): if args['reply_user'] != config.conf_get('bot_owner') and args['reply_user'] != argv[1]:
return {'msg': "only %s may do this!" % config.conf_get('bot_owner')} 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']: if argv[1] in config.runtime_config_store['other_bots']:
config.runtime_config_store['other_bots'].remove(argv[1]) config.runtime_config_store['other_bots'].remove(argv[1])

View File

@@ -161,6 +161,9 @@ class UrlBot(IdleBot):
# message = _prevent_panic(message, msg_obj['from'].bare) # message = _prevent_panic(message, msg_obj['from'].bare)
# if get_bots_present(msg_obj['from'].bare): # if get_bots_present(msg_obj['from'].bare):
# return # 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( self.send_message(
mto=msg_obj['from'].bare, mto=msg_obj['from'].bare,
mbody=message, mbody=message,