From 5bf5772b9ae9bb6d6741a8ef614e32b137b27449 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 25 Feb 2016 06:58:30 -0800 Subject: [PATCH] LastFM: switch to using wrap() as a decorator --- LastFM/plugin.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/LastFM/plugin.py b/LastFM/plugin.py index 22af0ce..b99e23d 100644 --- a/LastFM/plugin.py +++ b/LastFM/plugin.py @@ -94,7 +94,8 @@ class LastFM(callbacks.Plugin): self.db.flush() self.__parent.die() - def nowPlaying(self, irc, msg, args, user): + @wrap([optional("something")]) + def np(self, irc, msg, args, user): """[] Announces the track currently being played by . If @@ -168,9 +169,8 @@ class LastFM(callbacks.Plugin): (ircutils.bold(user), ircutils.bold(track), ircutils.bold(artist), ircutils.bold(album), time, public_url)) - np = wrap(nowPlaying, [optional("something")]) - - def setUserId(self, irc, msg, args, newId): + @wrap(["something"]) + def set(self, irc, msg, args, newId): """ Sets the LastFM username for the caller and saves it in a database. @@ -179,8 +179,7 @@ class LastFM(callbacks.Plugin): self.db.set(msg.prefix, newId) irc.replySuccess() - set = wrap(setUserId, ["something"]) - + @wrap([optional("something")]) def profile(self, irc, msg, args, user): """[] @@ -226,8 +225,6 @@ class LastFM(callbacks.Plugin): irc.reply("%(id)s (realname: %(realname)s) registered on %(registered)s; age: %(age)s / %(gender)s; " "Country: %(country)s; Tracks played: %(playcount)s" % profile) - profile = wrap(profile, [optional("something")]) - filename = conf.supybot.directories.data.dirize("LastFM.db") Class = LastFM