Thread linktitle functions as they may take time for invalid URLs
This commit is contained in:
parent
008dcda98f
commit
d07db06f94
|
@ -15,6 +15,7 @@ import praw #TODO: enable/disable modules
|
||||||
import datetime
|
import datetime
|
||||||
from requests import get
|
from requests import get
|
||||||
import html.parser
|
import html.parser
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
class LinkTitler(ModuleBase):
|
class LinkTitler(ModuleBase):
|
||||||
def __init__(self, bot, moduleName):
|
def __init__(self, bot, moduleName):
|
||||||
|
@ -22,6 +23,11 @@ class LinkTitler(ModuleBase):
|
||||||
self.hooks=[ModuleHook("PRIVMSG", self.searches)]
|
self.hooks=[ModuleHook("PRIVMSG", self.searches)]
|
||||||
|
|
||||||
def searches(self, args, prefix, trailing):
|
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)
|
sender = self.bot.decodePrefix(prefix)
|
||||||
|
|
||||||
# Youtube
|
# Youtube
|
||||||
|
|
Loading…
Reference in New Issue