From 51a52e2b0e54031cce5876f54d1d48c268b5441c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Sep 2018 18:27:17 +0100 Subject: Switch to using @Utils.hook and docstrings for event hooks --- modules/tweets.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules/tweets.py') 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"] -- cgit v1.3.1-10-gc9f91