plugin.description='View your Last.fm now playing and recent tracks'
plugin.commands={'lastfm','np','fmset'}
plugin.help='/np - Show your currently playing or most recent track.\n/fmset <username> - Link your Last.fm account.\n/lastfm [username] - View recent tracks for a Last.fm user.'
functionplugin.on_message(api,message,ctx)
localhttp=require('src.core.http')
localurl=require('socket.url')
localtools=require('telegram-bot-lua.tools')
localconfig=require('src.core.config')
localapi_key=config.get('LASTFM_API_KEY')
ifnotapi_keyorapi_key==''then
returnapi.send_message(message.chat.id,'Last.fm is not configured. The bot admin needs to set LASTFM_API_KEY.')
end
-- /fmset: link Last.fm username
ifmessage.command=='fmset'then
localusername=message.args
ifnotusernameorusername==''then
returnapi.send_message(message.chat.id,'Please provide your Last.fm username. Usage: /fmset <username>')