aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar dngfx2018-09-09 13:20:59 +0100
committerGravatar dongfix2018-09-09 13:20:59 +0100
commit2d4dbf922f98f5b454e77c0bf8d16aa0ea65310f (patch)
tree04b873f28c0197e8b38db306840b5342cce1e5ae
parentWOOP WOOP THAT'S THE SOUND OF LINKS FOR TWEETS (diff)
signature
h8 everything right now
-rw-r--r--modules/bitly.py2
-rw-r--r--modules/tweets.py5
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="<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
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"