From 85c434df22c2b65fbc72c9c31f74356c6dcac5ba Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 30 Jul 2017 10:27:27 +0100 Subject: [PATCH] Fix call to non-thread safe method --- 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: -- rgit 0.1.3