From 0cc72d5d66bc3a6abf7757c7202905bd656ddf1d Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 26 Dec 2017 10:32:36 +0000 Subject: Added a "replay" system to EventManager hooks, to replay missed .calls --- modules/lastfm.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'modules/lastfm.py') diff --git a/modules/lastfm.py b/modules/lastfm.py index 77f693c1..7a607dd0 100644 --- a/modules/lastfm.py +++ b/modules/lastfm.py @@ -7,17 +7,16 @@ URL_SCROBBLER = "http://ws.audioscrobbler.com/2.0/" class Module(object): def __init__(self, bot): self.bot = bot - bot.events.on("boot").on("done").hook(self.boot_done) + + bot.events.on("postboot").on("configure").on( + "set").call(setting="lastfm", + help="Set username on last.fm") + bot.events.on("received").on("command").on("np", "listening", "nowplaying").hook(self.np, help="Get the last listen to track from a user", usage="[username]") - def boot_done(self, event): - self.bot.events.on("postboot").on("configure").on( - "set").call(setting="lastfm", - help="Set username on last.fm") - def np(self, event): if event["args_split"]: username = event["args_split"][0] -- cgit v1.3.1-10-gc9f91