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

send a message to "bots" when not reacting to their messages

This commit is contained in:
Thorsten
2015-12-26 23:17:22 +01:00
parent d4741a55ea
commit f43106d471

View File

@@ -4,9 +4,7 @@
The URLBot - ready to strive for desaster in YOUR jabber MUC The URLBot - ready to strive for desaster in YOUR jabber MUC
""" """
import sys import sys
import time import time
from common import ( from common import (
rate_limit_classes, rate_limit_classes,
RATE_GLOBAL, RATE_GLOBAL,
@@ -24,7 +22,6 @@ from plugins import (
register_event, register_event,
else_command else_command
) )
import config import config
@@ -32,6 +29,7 @@ class UrlBot(IdleBot):
""" """
The URLBot, doing things the IdleBot wouldn't dare to. The URLBot, doing things the IdleBot wouldn't dare to.
""" """
def __init__(self, jid, password, rooms, nick): def __init__(self, jid, password, rooms, nick):
super(UrlBot, self).__init__(jid, password, rooms, nick) super(UrlBot, self).__init__(jid, password, rooms, nick)
@@ -165,6 +163,11 @@ class UrlBot(IdleBot):
# return # return
if msg_obj['type'] == 'groupchat': if msg_obj['type'] == 'groupchat':
if msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()): if msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()):
msg_obj['type'] = 'chat'
self.send_reply("You're flagged as bot, please write {}: remove-from-botlist "
"{} if you're not a bot.".format(
config.conf_get('bot_nickname'), msg_obj['mucnick']
), msg_obj)
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
self.send_message( self.send_message(
@@ -319,7 +322,7 @@ class UrlBot(IdleBot):
self.show = presence.get('status') self.show = presence.get('status')
self.send_presence(pstatus=self.status, pshow=self.show) self.send_presence(pstatus=self.status, pshow=self.show)
# self.reconnect(wait=True) # self.reconnect(wait=True)
if __name__ == '__main__': if __name__ == '__main__':