From 2d4dbf922f98f5b454e77c0bf8d16aa0ea65310f Mon Sep 17 00:00:00 2001 From: dngfx <294904+dngfx@users.noreply.github.com> Date: Sun, 9 Sep 2018 13:20:59 +0100 Subject: [PATCH] h8 everything right now --- modules/bitly.py | 2 +- modules/tweets.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/bitly.py b/modules/bitly.py index cd69bb4e..7736a8c5 100644 --- a/modules/bitly.py +++ b/modules/bitly.py @@ -16,7 +16,7 @@ class Module(object): usage="") 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 diff --git a/modules/tweets.py b/modules/tweets.py index 93492212..72358899 100644 --- a/modules/tweets.py +++ b/modules/tweets.py @@ -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"