This is a Discord bot that interacts with Last.fm API to fetch and display the user's most played albums over the past week. It can send a collage of the user's top albums in the last 7 days to the Discord channel.
- Top albums in the last 7 days: Generate and send a collage of the top 25 albums played by a user in the last 7 days.
Before you can use the bot, you'll need:
- Node.js (v16.x or higher recommended)
- A Discord Bot Token (from Discord Developer Portal)
- Last.fm API Key and Secret (from Last.fm API)
git clone https://github.com/brunorcoelho/bot-semaninha.git
cd bot-semaninha
Run the following command to install all required packages:
npm install
Create a .env
file in the root of your project and add the following variables:
TOKEN=YOUR_DISCORD_BOT_TOKEN
GUILD_ID=YOUR_DISCORD_SERVER_ID
CLIENT_ID=YOUR_DISCORD_ID
LASTFM_API=YOUR_LASTFM_API_KEY
LASTFM_SECRET=YOUR_LASTFM_API_SECRET
Replace YOUR_DISCORD_BOT_TOKEN
, YOUR_DISCORD_SERVER_ID
YOUR_DISCORD_ID
with your Discord credentials,YOUR_LASTFM_API_KEY
and YOUR_LASTFM_API_SECRET
with the credentials from Last.fm.
To start the bot, run:
node src/index.js
The bot should now be online and respond to commands in your Discord server.
Generates and sends a collage of the top 25 albums played in the last 7 days by a specific user.
Usage:
/semaninha nome-do-usuário: [username]
Example:
/semaninha nome-do-usuário: bruno090904
- If you want to test the bot on your local machine, just run
node src/index.js
after making your changes. - If you make any changes to the bot's commands or interactions, you will need to update your Discord bot permissions.
-
Missing environment variables:
- Ensure that your
.env
file contains the correct API credentials. - If you're missing any required variables, the bot may fail to start.
- Ensure that your
-
Rate limits:
- Last.fm imposes rate limits on their API. Make sure to handle retries or adjust the frequency of API calls if you hit a rate limit.
-
Bot not responding:
- Double-check that your bot has the necessary permissions to read and send messages in your Discord server.