aboutsummaryrefslogtreecommitdiff
path: root/modules/tweets.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-26 18:27:17 +0100
committerGravatar jesopo2018-09-26 18:27:17 +0100
commit51a52e2b0e54031cce5876f54d1d48c268b5441c (patch)
treea4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/tweets.py
parentAlso use docstrings to check if a command has help available, allow one-string (diff)
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/tweets.py')
-rw-r--r--modules/tweets.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/tweets.py b/modules/tweets.py
index 9995293a..8f8d2396 100644
--- a/modules/tweets.py
+++ b/modules/tweets.py
@@ -16,16 +16,17 @@ class Module(object):
self.bot = bot
self.events = events
- events.on("received.command").on("tweet", "tw").hook(self.tweet,
- help="Find a tweet", usage="[@username/URL/ID]")
-
def make_timestamp(self, s):
seconds_since = time.time() - datetime.datetime.strptime(s,
"%a %b %d %H:%M:%S %z %Y").timestamp()
since, unit = Utils.time_unit(seconds_since)
return "%s %s ago" % (since, unit)
+ @Utils.hook("received.command.tweet|tw", usage="[@username/URL/ID]")
def tweet(self, event):
+ """
+ Get/find a tweet
+ """
api_key = self.bot.config["twitter-api-key"]
api_secret = self.bot.config["twitter-api-secret"]
access_token = self.bot.config["twitter-access-token"]