Added get_title

This commit is contained in:
aewens 2018-11-15 17:34:10 -05:00
parent 16c8052ee8
commit d77dd8b828
1 changed files with 3 additions and 1 deletions

4
bot.py
View File

@ -1,4 +1,5 @@
import teambot, time, datastore
import lxml.html
USAGE = dict(admin="Stop trying to use this command!",sotd="{}sotd <link> <name>",listsotd="{}listsotd")
PUBLIC_COMMANDS = ["sotd","listsotd"]
@ -6,7 +7,8 @@ PUBLIC_COMMANDS = ["sotd","listsotd"]
SOTDS = datastore.DataStore("sotd.json")
def get_title(link):
return link # TODO: actually make this get the title of a link.
page = lxml.html.parse(link)
return page.find(".//title").text
class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin):
def __init__(self,*args):