diff --git a/bot.py b/bot.py index b2d491b..6ac7955 100644 --- a/bot.py +++ b/bot.py @@ -1,4 +1,5 @@ import teambot, time, datastore +import lxml.html USAGE = dict(admin="Stop trying to use this command!",sotd="{}sotd ",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):