Thread linktitle functions as they may take time for invalid URLs

This commit is contained in:
dave 2014-10-12 00:53:08 -07:00
parent 008dcda98f
commit d07db06f94
1 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import praw #TODO: enable/disable modules
import datetime
from requests import get
import html.parser
from threading import Thread
class LinkTitler(ModuleBase):
def __init__(self, bot, moduleName):
@ -22,6 +23,11 @@ class LinkTitler(ModuleBase):
self.hooks=[ModuleHook("PRIVMSG", self.searches)]
def searches(self, args, prefix, trailing):
t = Thread(target=self.doLinkTitle, args=(args, prefix, trailing))
t.daemon = True
t.start()
def doLinkTitle(self, args, prefix, trailing):
sender = self.bot.decodePrefix(prefix)
# Youtube