h8 everything right now

This commit is contained in:
dngfx 2018-09-09 13:20:59 +01:00 committed by dongfix
parent 7aecd2b4ca
commit 2d4dbf922f
2 changed files with 4 additions and 3 deletions

View file

@ -16,7 +16,7 @@ class Module(object):
usage="<url>")
def shortlink(self, event):
url = event if type(event) is str else event["url"]
url = event["url"]
if not re.match(REGEX_URL, url):
url = "http://%s" % url

View file

@ -16,6 +16,7 @@ class Module(object):
def __init__(self, bot, events, exports):
self.bot = bot
self.bitly_is_enabled = "bitly" in self.bot.modules.modules
self.events = events
events.on("received").on("command").on("tweet", "tw"
).hook(self.tweet,
@ -68,12 +69,12 @@ class Module(object):
bitly_link = ""
if self.bitly_is_enabled:
bitly = self.bot.modules.modules["bitly"]
chopped_uname = username[1:]
tweet_link = "https://twitter.com/%s/status/%s" % (
chopped_uname, linked_id)
bitly_link = " -- " + bitly.shortlink(tweet_link)
bitly_link = " -- " + self.events.call("get.shortlink",
url=tweet_link)
if "retweeted_status" in tweet:
original_username = "@%s" % tweet["retweeted_status"