diff --git a/LastFM/plugin.py b/LastFM/plugin.py index d18f4b5..f31de8f 100644 --- a/LastFM/plugin.py +++ b/LastFM/plugin.py @@ -136,13 +136,16 @@ class LastFM(callbacks.Plugin): return True def setuser(self, irc, msg, args, channel, user): - """[] + """[] Assigns the to the current nick, in [channel]. """ userinfo = self.network.get_user(user) - if not userinfo: - irc.error("User not found", prefixNick=False) + + try: + userinfo.get_registered() + except pylast.WSError as e: + irc.error(str(e), prefixNick=False) return self.db.set_user(channel, msg.nick.lower(), user) @@ -156,7 +159,7 @@ class LastFM(callbacks.Plugin): def compare(self, irc, msg, args, channel, user): """[] - Compares your account with the account, in [channel]. + Compares your account with the , in [channel]. """ if self.connect() is False: return @@ -213,9 +216,9 @@ class LastFM(callbacks.Plugin): compare = wrap(compare, ['channel', 'anything']) def nowplaying(self, irc, msg, args, channel, user): - """[] [] + """[] [] - Show the currently playing song, by [last.fm user], in [channel]. + Show the currently playing song, by [last.fm account/nick], in [channel]. """ if self.connect() is False: return @@ -226,8 +229,11 @@ class LastFM(callbacks.Plugin): username = self.db.get_user(channel, msg.nick.lower()) userinfo = self.network.get_user(username) - if not userinfo: - irc.error("User not found", prefixNick=False) + + try: + userinfo.get_registered() + except pylast.WSError as e: + irc.error(str(e), prefixNick=False) return track = userinfo.get_now_playing() @@ -248,7 +254,7 @@ class LastFM(callbacks.Plugin): message = "{} {} is not playing anything right now".format( self.prepend, - msg.nick + username ) if track: @@ -272,7 +278,7 @@ class LastFM(callbacks.Plugin): message = "{} {} is listening to: {} {}({} plays) {}".format( self.prepend, - msg.nick, + username, track, lovemsg, playcount,