xmlrpc: expose IRCBot.reply, use it over privmsg

converts dispatch and the admin form to reply

closes bss/dr.botzo#21
This commit is contained in:
2017-02-12 11:39:40 -06:00
parent 6cb3757ef9
commit 015eacbe53
4 changed files with 8 additions and 7 deletions

View File

@@ -77,9 +77,9 @@ class DispatchMessage(generics.GenericAPIView):
# connect over XML-RPC and send
try:
bot_url = 'http://{0:s}:{1:d}/'.format(settings.IRCBOT_XMLRPC_HOST, settings.IRCBOT_XMLRPC_PORT)
bot = xmlrpc.client.ServerProxy(bot_url)
bot = xmlrpc.client.ServerProxy(bot_url, allow_none=True)
log.debug("sending '%s' to channel %s", text, action.destination)
bot.privmsg(action.destination, text)
bot.reply(None, text, False, action.destination)
except Exception as e:
new_data = copy.deepcopy(message.data)
new_data['status'] = "FAILED - {0:s}".format(str(e))