🏡 index : ~doyle/dave.git

author Jordan Doyle <jordan@doyle.wf> 2017-07-30 10:27:27.0 +01:00:00
committer Jordan Doyle <jordan@doyle.wf> 2017-07-30 10:27:27.0 +01:00:00
commit
85c434df22c2b65fbc72c9c31f74356c6dcac5ba [patch]
tree
1fe39a11f3d7e068f7121ec57abb58151466ef8e
parent
6edf271571f2bf123a4484a158f2365dd3bf3539
download
85c434df22c2b65fbc72c9c31f74356c6dcac5ba.tar.gz

Fix call to non-thread safe method



Diff

 dave/dave.py |  9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dave/dave.py b/dave/dave.py
index deff98d..0e20577 100644
--- a/dave/dave.py
+++ a/dave/dave.py
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
import sys
from datetime import datetime

from humanize import naturaltime
from twisted.internet import reactor, protocol, ssl
from twisted.internet import reactor, protocol, ssl, task
from twisted.words.protocols import irc
from twisted.internet.threads import deferToThread
from twisted.python import log
import time
import pkgutil
@@ -13,8 +14,6 @@
import subprocess
import dave.config as config
import requests
from twisted.internet import reactor, task
from twisted.internet.threads import deferToThread


class Dave(irc.IRCClient):
@@ -106,10 +105,10 @@
        if command == "INVITE":
            self.join(params[1])

    def msg(self, user, message, length=None):
    def msg(self, dest, message, length=None):
        """Override msg() to log what the bot says"""
        log.msg("<{}> {}".format(self.nickname, message))
        super(Dave, self).msg(user, message, length)
        reactor.callFromThread(super(Dave, self).msg, dest, message, length)

    def reply(self, source, sender, msg):
        if source == sender: