A decentralized music tracking and discovery platform built on AT Protocol 馃幍
at main 17 lines 577 B view raw
1import { RockskyClient } from "client"; 2 3export async function artists(did, { skip, limit = 20 }): Promise<string> { 4 try { 5 const client = new RockskyClient(); 6 const artists = await client.getArtists(did, { skip, limit }); 7 let rank = 1; 8 let response = `Top ${limit} artists:\n`; 9 for (const artist of artists) { 10 response += `${rank} ${artist.name} - ${artist.play_count} plays\n`; 11 rank++; 12 } 13 return response; 14 } catch (err) { 15 return `Failed to fetch artists data. Please check your token and try again, error: ${err.message}`; 16 } 17}