Skip to content

tromai/lemon-soda

Repository files navigation

lemon-soda

A very simple music playing bot, with an autoplay feature backed by Spotify track recommendation system.

Local Development

Prerequisites

  • Ubuntu 22.04
  • Node v20.18.0
  • ffmpeg. For Ubuntu you can install it with apt install ffmpeg.

Install dependencies

npm install

Running the bot

Credentials

The final credentials must be stored as environment variables.

  • TOKEN
  • CLIENT_ID
  • GUILD_ID
  • SPOTIFY_CLIENT_ID
  • SPOTIFY_CLIENT_SECRET

Discord setup

After you finish those instructions, you will be able to obtain:

  • TOKEN - The Discord bot token.
  • CLIENT_ID - from the Discord developer portal.
  • GUILD_ID (aka your channel's ID) - Make sure developer mode is enabled. Right click on the channel's title -> Copy Server ID.

Spotify API

Spotify API is used for obtaining song recommendations. It requires a token to query from it.

Follow these instructions to obtain SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET:

Registering the slash commands of the bot to Discord

Reference: https://discord.com/developers/docs/interactions/application-commands#registering-a-command

npm run deploy-commands

Running the bot with tsx

You can use tsx to run the bot directly without compiling:

npx tsx src/index.

Compile and run

npm run build
npm run start

Tests

npm run test

Linting and Styling

npm run style

Container

podman build -t lemon-soda:testing -f Dockerfile ./
podman run --init -it --rm -e TOKEN=$TOKEN -e SPOTIFY_CLIENT_ID=$SPOTIFY_CLIENT_ID -e SPOTIFY_CLIENT_SECRET=$SPOTIFY_CLIENT_SECRET lemon-soda:testing