Skip to content

nexpid-labs/SongSpotlight

 
 

Repository files navigation

Icon Song Spotlight

A fork of Cloud Sync. A service built using Hono to show off songs on your Discord profile.

You can find the API documentation here

Installation

# install without optionalDependencies
$ bun install --omit=optional

Selfhosting

Deploy to Cloudflare

Prerequsities

You need:

In your Discord application's page, go to the OAuth2 tab and create a new OAuth2 Redirect in the format of https://your-worker.workers.dev/api/auth/authorize and http://localhost:8787/api/auth/authorize

After that, create a .dev.vars file based on .dev.vars.example with all of your secrets filled in, then run:

# publish secrets
$ bunx wrangler secret bulk .dev.vars

Running

# development
$ bun run dev

# bench the size of your deployment
$ bun run dry-deploy

# deploy
$ bun run deploy

Discord bot

Along with the Discord application for OAuth2, you can also create a Discord bot. This allows you to:

  • Enable the /songspotlight Discord command — users will need to add your app as an userapp (the applications.commands scope) or add it to their server to use the command
  • Enable the Silly service — a cron schedule that runs every day at 2:00 AM UTC which generates a randomized color palette for its avatar, banner and even FPTE

To create a bot user, go to the Bot tab in your Discord application's page, create it, and save its token in .dev.vars:

# optional, only used for extra bot features
CLIENT_TOKEN="Bot [your token here]"

Then run:

# publish secrets
$ bunx wrangler secret bulk .dev.vars

To enable the Discord command, start with enabling Public Bot in the Bot tab, along with User Install and Guild Install in the Installation tab.

You can also optionally set a Last.fm API key.

Then, set Interactions Endpoint URL in the General Information tab to https://your-worker.workers.dev/api/bot/interaction. Copy your application's Public Key and put it in .dev.vars. Then run:

# publish secrets
$ bunx wrangler secret bulk .dev.vars

# create global commands
$ bun run commands

To enable the Silly service, run:

# install @resvg/resvg-wasm
$ bun install

Testing

There are some basic tests in the test folder, but if you're feeling brave enough, feel free to write some actual unit tests!

License

MIT

Footnotes

  1. setup guide is here

  2. run openssl rand -hex 32

About

A service built using Hono to show off songs on your Discord profile. A fork of Cloud Sync

Topics

Resources

License

Stars

Watchers

Forks

Contributors

No contributors

Languages

  • TypeScript 99.4%
  • JavaScript 0.6%