mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
cleanup; test .reply().send()
This commit is contained in:
25
urlbot.py
25
urlbot.py
@@ -113,11 +113,12 @@ def send_reply(message, msg_obj):
|
|||||||
if debug_enabled():
|
if debug_enabled():
|
||||||
print(message)
|
print(message)
|
||||||
else:
|
else:
|
||||||
xmpp.send_message(
|
msg_obj.reply(body=message).send()
|
||||||
mto=msg_obj['from'].bare,
|
# xmpp.send_message(
|
||||||
mbody=message,
|
# mto=msg_obj['from'].bare,
|
||||||
mtype=msg_obj['type']
|
# mbody=message,
|
||||||
)
|
# mtype=msg_obj['type']
|
||||||
|
# )
|
||||||
|
|
||||||
def ratelimit_touch(ignored=None): # FIXME: separate counters
|
def ratelimit_touch(ignored=None): # FIXME: separate counters
|
||||||
hist_ts.append(time.time())
|
hist_ts.append(time.time())
|
||||||
@@ -208,14 +209,6 @@ def extract_url(data, msg_obj):
|
|||||||
ret = True
|
ret = True
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def parse_pn(data):
|
|
||||||
# FIXME: changed
|
|
||||||
## reply_user = data.split(' ')[0].strip('<>')
|
|
||||||
# since we can't determine if a user named 'foo> ' just wrote ' > bar'
|
|
||||||
# or a user 'foo' just wrote '> > bar', we can't safely answer here
|
|
||||||
logger('warn', 'received PN: ' + data)
|
|
||||||
return False
|
|
||||||
|
|
||||||
def handle_msg(msg_obj):
|
def handle_msg(msg_obj):
|
||||||
content = msg_obj['body']
|
content = msg_obj['body']
|
||||||
|
|
||||||
@@ -269,7 +262,11 @@ class bot(ClientXMPP):
|
|||||||
if 'groupchat' == msg_obj['type']:
|
if 'groupchat' == msg_obj['type']:
|
||||||
return
|
return
|
||||||
|
|
||||||
print('msg from %s: %s' % (msg_obj['from'].bare, msg_obj['body']))
|
plugins.data_parse_commands(msg_obj)
|
||||||
|
plugins.data_parse_other(msg_obj)
|
||||||
|
|
||||||
|
print('msg from %s: %s' % (msg_obj['from'].bare, msg_obj))
|
||||||
|
# msg_obj.reply(body='waaaaah').send()
|
||||||
|
|
||||||
if '__main__' == __name__:
|
if '__main__' == __name__:
|
||||||
import plugins
|
import plugins
|
||||||
|
|||||||
Reference in New Issue
Block a user