2015-12-20 15:24:42 +01:00
|
|
|
#!/usr/bin/env python3
|
2014-08-10 22:10:00 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2015-11-30 19:50:11 +01:00
|
|
|
"""
|
|
|
|
|
The URLBot - ready to strive for desaster in YOUR jabber MUC
|
|
|
|
|
"""
|
2015-12-31 15:32:13 +01:00
|
|
|
import re
|
2016-01-03 18:37:48 +01:00
|
|
|
import shlex
|
2015-11-20 21:07:48 +01:00
|
|
|
import sys
|
2015-12-06 00:06:31 +01:00
|
|
|
import time
|
2015-12-31 15:32:13 +01:00
|
|
|
from lxml import etree
|
|
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
|
2015-11-28 01:25:18 +01:00
|
|
|
from common import (
|
2015-11-30 19:17:40 +01:00
|
|
|
rate_limit_classes,
|
|
|
|
|
RATE_GLOBAL,
|
|
|
|
|
RATE_CHAT,
|
|
|
|
|
RATE_EVENT,
|
|
|
|
|
rate_limit,
|
2016-01-28 20:18:26 +01:00
|
|
|
get_nick_from_object)
|
2015-12-20 15:24:42 +01:00
|
|
|
from config import runtimeconf_set
|
2015-11-20 21:07:48 +01:00
|
|
|
from idlebot import IdleBot, start
|
2015-11-20 21:56:37 +01:00
|
|
|
from plugins import (
|
2015-11-30 19:17:40 +01:00
|
|
|
plugins as plugin_storage,
|
|
|
|
|
ptypes_COMMAND,
|
|
|
|
|
plugin_enabled_get,
|
|
|
|
|
ptypes_PARSE,
|
|
|
|
|
register_event,
|
2016-01-04 14:27:02 +01:00
|
|
|
register_active_event,
|
|
|
|
|
else_command,
|
2015-11-20 21:56:37 +01:00
|
|
|
)
|
2015-12-20 12:36:08 +01:00
|
|
|
import config
|
2015-07-19 20:47:57 +02:00
|
|
|
|
|
|
|
|
|
2015-11-20 21:07:48 +01:00
|
|
|
class UrlBot(IdleBot):
|
2015-11-30 19:50:11 +01:00
|
|
|
"""
|
|
|
|
|
The URLBot, doing things the IdleBot wouldn't dare to.
|
|
|
|
|
"""
|
2015-12-26 23:17:22 +01:00
|
|
|
|
2015-11-30 19:17:40 +01:00
|
|
|
def __init__(self, jid, password, rooms, nick):
|
|
|
|
|
super(UrlBot, self).__init__(jid, password, rooms, nick)
|
|
|
|
|
|
|
|
|
|
self.hist_ts = {p: [] for p in rate_limit_classes}
|
|
|
|
|
self.hist_flag = {p: True for p in rate_limit_classes}
|
2016-01-08 23:55:29 +01:00
|
|
|
self.message_stack = []
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
self.add_event_handler('message', self.message)
|
|
|
|
|
self.priority = 100
|
|
|
|
|
|
2015-11-30 19:50:11 +01:00
|
|
|
for room in self.rooms:
|
|
|
|
|
self.add_event_handler('muc::%s::got_online' % room, self.muc_online)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
def muc_message(self, msg_obj):
|
2015-11-30 19:50:11 +01:00
|
|
|
"""
|
|
|
|
|
Handle muc messages, return if irrelevant content or die by hangup.
|
|
|
|
|
:param msg_obj:
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
2015-11-30 19:17:40 +01:00
|
|
|
return super(UrlBot, self).muc_message(msg_obj) and self.handle_msg(msg_obj)
|
|
|
|
|
|
|
|
|
|
def message(self, msg_obj):
|
2015-11-30 19:50:11 +01:00
|
|
|
"""
|
|
|
|
|
General message hook
|
|
|
|
|
:param msg_obj:
|
|
|
|
|
"""
|
|
|
|
|
if msg_obj['type'] == 'groupchat':
|
2015-12-26 23:06:46 +01:00
|
|
|
self.logger.info("Got the following MUC message: %s", str(msg_obj))
|
2015-11-30 19:17:40 +01:00
|
|
|
return
|
|
|
|
|
else:
|
2015-11-30 19:50:11 +01:00
|
|
|
self.logger.info("Got the following PM: %s", str(msg_obj))
|
2015-12-26 23:06:46 +01:00
|
|
|
self.handle_msg(msg_obj)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
def muc_online(self, msg_obj):
|
|
|
|
|
"""
|
|
|
|
|
Hook for muc event "user joins"
|
|
|
|
|
"""
|
|
|
|
|
# don't react to yourself
|
|
|
|
|
if msg_obj['muc']['nick'] == self.nick:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
# TODO: move this to a undirected plugin, maybe new plugin type
|
|
|
|
|
arg_user = msg_obj['muc']['nick']
|
|
|
|
|
arg_user_key = arg_user.lower()
|
2015-12-21 10:41:58 +01:00
|
|
|
user_records = config.runtimeconf_get('user_records')
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-12-20 15:24:42 +01:00
|
|
|
if arg_user_key in user_records:
|
|
|
|
|
records = user_records[arg_user_key]
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
if not records:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
self.send_message(
|
|
|
|
|
mto=msg_obj['from'].bare,
|
|
|
|
|
mbody='%s, there %s %d message%s for you:\n%s' % (
|
|
|
|
|
arg_user,
|
2015-11-30 19:50:11 +01:00
|
|
|
'is' if len(records) == 1 else 'are',
|
2015-11-30 19:17:40 +01:00
|
|
|
len(records),
|
2015-11-30 19:50:11 +01:00
|
|
|
'' if len(records) == 1 else 's',
|
2015-11-30 19:17:40 +01:00
|
|
|
'\n'.join(records)
|
|
|
|
|
),
|
|
|
|
|
mtype='groupchat'
|
|
|
|
|
)
|
2015-11-30 19:50:11 +01:00
|
|
|
self.logger.info('sent %d offline records to room %s',
|
|
|
|
|
len(records), msg_obj['from'].bare)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-12-20 15:24:42 +01:00
|
|
|
if config.conf_get('persistent_locked'):
|
2015-11-30 19:50:11 +01:00
|
|
|
self.logger.warning("couldn't get exclusive lock")
|
2015-11-30 19:17:40 +01:00
|
|
|
return False
|
|
|
|
|
|
2015-12-20 15:24:42 +01:00
|
|
|
config.conf_set('persistent_locked', True)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-12-21 09:52:01 +01:00
|
|
|
user_records.pop(arg_user_key)
|
2015-12-21 10:41:58 +01:00
|
|
|
config.runtimeconf_persist()
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-12-20 15:24:42 +01:00
|
|
|
config.conf_set('persistent_locked', False)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
# @rate_limited(10)
|
|
|
|
|
def send_reply(self, message, msg_obj=None):
|
|
|
|
|
"""
|
|
|
|
|
Send a reply to a message
|
|
|
|
|
"""
|
|
|
|
|
if self.show:
|
2015-11-30 19:50:11 +01:00
|
|
|
self.logger.warning("I'm muted! (status: %s)", self.show)
|
2015-11-30 19:17:40 +01:00
|
|
|
return
|
|
|
|
|
|
2015-12-21 16:24:56 +01:00
|
|
|
request_counter = int(config.runtimeconf_get('request_counter'))
|
|
|
|
|
config.runtimeconf_set('request_counter', request_counter + 1)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
if str is not type(message):
|
|
|
|
|
message = '\n'.join(message)
|
|
|
|
|
|
2015-12-06 00:06:31 +01:00
|
|
|
def cached(function, ttl=60):
|
|
|
|
|
cache = {}
|
|
|
|
|
ttl = 60
|
|
|
|
|
now = time.time()
|
|
|
|
|
|
|
|
|
|
def wrapper(*args):
|
|
|
|
|
hash_ = hash(args)
|
|
|
|
|
if hash_ in cache and cache[args]['time'] < now - ttl:
|
|
|
|
|
return cache[hash_]['result']
|
|
|
|
|
else:
|
|
|
|
|
result = function(*args)
|
|
|
|
|
cache[hash_] = {}
|
|
|
|
|
cache[hash_]['time'] = now
|
|
|
|
|
cache[hash_]['result'] = result
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
@cached
|
|
|
|
|
def get_bots_present(room):
|
2015-12-21 10:41:58 +01:00
|
|
|
other_bots = config.runtimeconf_get("other_bots")
|
2015-12-20 15:24:42 +01:00
|
|
|
if not other_bots:
|
|
|
|
|
return False
|
2015-12-06 00:06:31 +01:00
|
|
|
users = self.plugin['xep_0045'].getRoster(room)
|
|
|
|
|
return set(users).intersection(set(other_bots))
|
|
|
|
|
|
2015-11-30 19:17:40 +01:00
|
|
|
def _prevent_panic(message, room):
|
2015-12-06 00:06:31 +01:00
|
|
|
"""check other bots, add nospoiler with urls"""
|
2015-12-20 15:24:42 +01:00
|
|
|
if 'http' in message and get_bots_present(room):
|
|
|
|
|
message = '(nospoiler) %s' % message
|
2015-11-30 19:17:40 +01:00
|
|
|
return message
|
|
|
|
|
|
2015-12-20 15:24:42 +01:00
|
|
|
if config.conf_get('debug_mode'):
|
2015-11-30 19:17:40 +01:00
|
|
|
print(message)
|
|
|
|
|
else:
|
|
|
|
|
if msg_obj:
|
2015-12-06 00:06:31 +01:00
|
|
|
# TODO: bot modes off/on/auto... this should be active for "on".
|
|
|
|
|
# message = _prevent_panic(message, msg_obj['from'].bare)
|
2015-12-21 14:17:00 +01:00
|
|
|
# if get_bots_present(msg_obj['from'].bare):
|
|
|
|
|
# return
|
2015-12-26 23:06:46 +01:00
|
|
|
if msg_obj['type'] == 'groupchat':
|
|
|
|
|
if msg_obj['mucnick'] in config.runtimeconf_get("other_bots", ()):
|
2015-12-26 23:17:22 +01:00
|
|
|
msg_obj['type'] = 'chat'
|
|
|
|
|
self.send_reply("You're flagged as bot, please write {}: remove-from-botlist "
|
|
|
|
|
"{} if you're not a bot.".format(
|
2016-01-28 20:18:26 +01:00
|
|
|
config.conf_get('bot_nickname'),
|
|
|
|
|
get_nick_from_object(msg_obj)
|
|
|
|
|
), msg_obj)
|
|
|
|
|
self.logger.debug("not talking to the other bot named {}".format(get_nick_from_object(msg_obj)))
|
2015-12-26 23:06:46 +01:00
|
|
|
return False
|
|
|
|
|
self.send_message(
|
|
|
|
|
mto=msg_obj['from'].bare,
|
|
|
|
|
mbody=message,
|
|
|
|
|
mtype='groupchat'
|
|
|
|
|
)
|
|
|
|
|
elif msg_obj['type'] == 'chat':
|
|
|
|
|
self.send_message(
|
|
|
|
|
mto=msg_obj['from'],
|
|
|
|
|
mbody=message,
|
|
|
|
|
mtype='chat'
|
|
|
|
|
)
|
2015-12-06 00:06:31 +01:00
|
|
|
else:
|
2015-11-30 19:17:40 +01:00
|
|
|
for room in self.rooms:
|
2015-12-06 00:06:31 +01:00
|
|
|
# message = _prevent_panic(message, room)
|
|
|
|
|
if get_bots_present(room):
|
|
|
|
|
continue
|
2015-11-30 19:17:40 +01:00
|
|
|
self.send_message(
|
|
|
|
|
mto=room,
|
|
|
|
|
mbody=message,
|
|
|
|
|
mtype='groupchat'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def handle_msg(self, msg_obj):
|
|
|
|
|
"""
|
|
|
|
|
called for incoming messages
|
|
|
|
|
:param msg_obj:
|
|
|
|
|
:returns nothing
|
|
|
|
|
"""
|
|
|
|
|
content = msg_obj['body']
|
|
|
|
|
|
|
|
|
|
if 'has set the subject to:' in content:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if sys.argv[0] in content:
|
|
|
|
|
self.logger.info('silenced, this is my own log')
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if 'nospoiler' in content:
|
|
|
|
|
self.logger.info('no spoiler for: ' + content)
|
|
|
|
|
return
|
|
|
|
|
|
2015-12-26 20:43:25 +01:00
|
|
|
if msg_obj['mucnick'] in config.runtime_config_store['spammers']:
|
|
|
|
|
self.logger.info("ignoring spammer {}".format(msg_obj['mucnick']))
|
|
|
|
|
return
|
|
|
|
|
|
2015-12-20 15:24:42 +01:00
|
|
|
try:
|
2015-12-27 00:00:59 +01:00
|
|
|
reacted_on_command = self.data_parse_commands(msg_obj)
|
|
|
|
|
reacted_on_parse = self.data_parse_other(msg_obj)
|
2016-01-01 19:36:41 +01:00
|
|
|
|
|
|
|
|
# disabled for now
|
|
|
|
|
# self.data_parse_forum_thread(msg_obj)
|
|
|
|
|
# self.data_parse_forum_post(msg_obj)
|
2015-12-27 00:00:59 +01:00
|
|
|
|
2015-12-28 14:01:55 +01:00
|
|
|
if (msg_obj['body'].startswith(config.conf_get('bot_nickname')) and not any(
|
2015-12-27 00:10:28 +01:00
|
|
|
[reacted_on_command, reacted_on_parse]) and rate_limit(RATE_GLOBAL)):
|
2016-01-28 20:18:26 +01:00
|
|
|
ret = else_command({'reply_user': get_nick_from_object(msg_obj)})
|
2015-12-27 00:00:59 +01:00
|
|
|
if ret:
|
|
|
|
|
if 'msg' in ret:
|
|
|
|
|
self.send_reply(ret['msg'], msg_obj)
|
2015-12-20 15:24:42 +01:00
|
|
|
except Exception as e:
|
|
|
|
|
self.logger.exception(e)
|
2016-01-08 23:55:29 +01:00
|
|
|
finally:
|
|
|
|
|
if len(self.message_stack) > 4:
|
|
|
|
|
self.message_stack.pop(0)
|
|
|
|
|
self.message_stack.append(msg_obj)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
def data_parse_commands(self, msg_obj):
|
|
|
|
|
"""
|
|
|
|
|
react to a message with the bots nick
|
|
|
|
|
:param msg_obj: dictionary with incoming message parameters
|
|
|
|
|
|
|
|
|
|
:returns: nothing
|
|
|
|
|
"""
|
|
|
|
|
data = msg_obj['body']
|
2016-01-03 18:37:48 +01:00
|
|
|
try:
|
|
|
|
|
words = shlex.split(data)
|
|
|
|
|
except ValueError:
|
|
|
|
|
words = data.split()
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2016-01-01 20:54:19 +01:00
|
|
|
# prepend the bot nick so we have the same syntax as in muc
|
|
|
|
|
if msg_obj['type'] == 'chat' and words and self.nick not in words[0]:
|
|
|
|
|
words = [self.nick] + words
|
|
|
|
|
|
2015-11-30 19:50:11 +01:00
|
|
|
if len(words) < 2: # need at least two words
|
2015-11-30 19:17:40 +01:00
|
|
|
return None
|
|
|
|
|
|
2016-01-01 20:54:19 +01:00
|
|
|
# only reply if beginning of the text matches bot_nickname or it's a private session.
|
|
|
|
|
if msg_obj['type'] == 'groupchat' and not data.startswith(config.conf_get('bot_nickname')):
|
2015-11-30 19:17:40 +01:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
if 'hangup' in data:
|
2015-11-30 19:50:11 +01:00
|
|
|
self.logger.warning('received hangup: ' + data)
|
|
|
|
|
self.hangup()
|
2015-11-30 19:17:40 +01:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
2016-01-28 20:18:26 +01:00
|
|
|
reply_user = get_nick_from_object(msg_obj)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-11-30 19:50:11 +01:00
|
|
|
# TODO: check how several commands/plugins
|
|
|
|
|
# in a single message behave (also with rate limiting)
|
2015-11-30 19:17:40 +01:00
|
|
|
reacted = False
|
2015-12-20 21:15:16 +01:00
|
|
|
for plugin in filter(lambda p: p.plugin_name == words[1], plugin_storage[ptypes_COMMAND]):
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
if not plugin_enabled_get(plugin):
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
ret = plugin(
|
|
|
|
|
data=data,
|
|
|
|
|
cmd_list=[pl.plugin_name for pl in plugin_storage[ptypes_COMMAND]],
|
|
|
|
|
parser_list=[pl.plugin_name for pl in plugin_storage[ptypes_PARSE]],
|
|
|
|
|
reply_user=reply_user,
|
|
|
|
|
msg_obj=msg_obj,
|
2016-01-08 23:55:29 +01:00
|
|
|
argv=words[2:] if len(words) > 1 else [],
|
|
|
|
|
stack=self.message_stack
|
2015-11-30 19:17:40 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if ret:
|
|
|
|
|
self._run_action(ret, plugin, msg_obj)
|
|
|
|
|
reacted = True
|
2015-12-27 00:00:59 +01:00
|
|
|
return reacted
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
def data_parse_other(self, msg_obj):
|
|
|
|
|
"""
|
|
|
|
|
react to any message
|
|
|
|
|
|
|
|
|
|
:param msg_obj: incoming message parameters
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
|
|
|
|
data = msg_obj['body']
|
2016-01-28 20:18:26 +01:00
|
|
|
reply_user = get_nick_from_object(msg_obj)
|
2015-12-27 00:00:59 +01:00
|
|
|
reacted = False
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
for plugin in plugin_storage[ptypes_PARSE]:
|
|
|
|
|
if not plugin_enabled_get(plugin):
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
ret = plugin(reply_user=reply_user, data=data)
|
|
|
|
|
|
|
|
|
|
if ret:
|
|
|
|
|
self._run_action(ret, plugin, msg_obj)
|
2015-12-27 00:00:59 +01:00
|
|
|
reacted = True
|
|
|
|
|
return reacted
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-12-31 15:32:13 +01:00
|
|
|
def data_parse_forum_thread(self, msg_obj):
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
def data_parse_forum_post(self, msg_obj):
|
|
|
|
|
links = re.findall(r'(https?://(?:www\.)?debianforum\.de/forum/[^\s>]+)', msg_obj['body'])
|
|
|
|
|
for link in links:
|
|
|
|
|
html = requests.get(link).text
|
|
|
|
|
tree = etree.XML(html, etree.HTMLParser())
|
|
|
|
|
postid = re.findall('p=?([0-9]{4,})', link)
|
|
|
|
|
if not postid:
|
|
|
|
|
return
|
|
|
|
|
postid = 'p{}'.format(postid[0])
|
|
|
|
|
post_path = '//div[@id="{}"]'.format(postid)
|
|
|
|
|
postelement = tree.xpath(post_path)
|
|
|
|
|
if postelement:
|
|
|
|
|
postelement = postelement[0]
|
|
|
|
|
else:
|
|
|
|
|
self.logger.warn("No post with id {} found!".format(postid))
|
|
|
|
|
return
|
|
|
|
|
# excludes any [code] and [quote] elements by only looking at direct text child nodes
|
|
|
|
|
username_xpath = '//dl[@class="postprofile"]//*[contains(@href, "memberlist")]/text()'
|
|
|
|
|
user = tree.xpath('{}{}'.format(post_path, username_xpath))[0]
|
|
|
|
|
posttext = postelement.xpath('{}//div[@class="content"]/text()'.format(post_path))
|
|
|
|
|
print(user, '\n'.join(posttext))
|
|
|
|
|
summary_action = {'msg': '{} posted {} words'.format(user, len('\n'.join(posttext).split()))}
|
|
|
|
|
self._run_action(summary_action, plugin=plugin_storage[ptypes_COMMAND][0], msg_obj=msg_obj)
|
|
|
|
|
return
|
|
|
|
|
|
2015-11-30 19:17:40 +01:00
|
|
|
def _run_action(self, action, plugin, msg_obj):
|
|
|
|
|
"""
|
|
|
|
|
Execute the plugin's execution plan
|
|
|
|
|
:param action: dict with event and/or msg
|
|
|
|
|
:param plugin: plugin obj
|
|
|
|
|
:param msg_obj: xmpp message obj
|
|
|
|
|
"""
|
2016-01-31 19:28:22 +01:00
|
|
|
if 'event' in action and action["event"] is not None:
|
2015-11-30 19:17:40 +01:00
|
|
|
event = action["event"]
|
|
|
|
|
if 'msg' in event:
|
2015-12-06 00:06:31 +01:00
|
|
|
register_event(event["time"], self.send_reply, [event['msg'], msg_obj])
|
2015-11-30 19:17:40 +01:00
|
|
|
elif 'command' in event:
|
|
|
|
|
command = event["command"]
|
|
|
|
|
if rate_limit(RATE_EVENT):
|
2016-01-31 19:28:22 +01:00
|
|
|
# register_event(t=event["time"], callback=command[0], args=command[1])
|
2016-01-04 14:27:02 +01:00
|
|
|
# kind of ugly..
|
|
|
|
|
register_active_event(
|
|
|
|
|
t=event['time'],
|
|
|
|
|
callback=command[0],
|
|
|
|
|
args=command[1],
|
|
|
|
|
action_runner=self._run_action,
|
|
|
|
|
plugin=plugin,
|
|
|
|
|
msg_obj=msg_obj
|
|
|
|
|
)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
if 'msg' in action and rate_limit(RATE_CHAT | plugin.ratelimit_class):
|
|
|
|
|
self.send_reply(action['msg'], msg_obj)
|
|
|
|
|
|
2015-12-26 23:06:46 +01:00
|
|
|
if 'priv_msg' in action and rate_limit(RATE_CHAT | plugin.ratelimit_class):
|
|
|
|
|
msg_obj['type'] = 'chat'
|
|
|
|
|
self.send_reply(action['priv_msg'], msg_obj)
|
|
|
|
|
|
2015-11-30 19:17:40 +01:00
|
|
|
if 'presence' in action:
|
|
|
|
|
presence = action['presence']
|
2015-12-20 15:24:42 +01:00
|
|
|
runtimeconf_set('presence', presence)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
|
|
|
|
self.status = presence.get('msg')
|
|
|
|
|
self.show = presence.get('status')
|
|
|
|
|
|
|
|
|
|
self.send_presence(pstatus=self.status, pshow=self.show)
|
2015-12-26 23:17:22 +01:00
|
|
|
# self.reconnect(wait=True)
|
2015-11-30 19:17:40 +01:00
|
|
|
|
2015-11-20 21:07:48 +01:00
|
|
|
|
2015-11-30 19:50:11 +01:00
|
|
|
if __name__ == '__main__':
|
2015-11-30 19:17:40 +01:00
|
|
|
start(UrlBot, True)
|