π€ A Discord bot which specializes on lyrics searching
- About
- Demo / Working
- How it works
- Usage
- Getting Started
- Built Using
- TODO
- Contributing
- Authors
- Acknowledgments
Lyrics Finder is a Discord bot which searches for Lyrics on Genius. It supports all song language, as long as it's listed on Genius. If you don't know the song title, you can search the song by using its lyrics.
If you display your current Spotify song as your Discord status, it can automatically search the song by using a command. Feeling like singing to your song? There's also a mode to search every song you're playing on Spotify.
The bot uses the Genius API to search the lyrics of a song. When searching using Spotify, the bot grabs the User presence and forms the search query by <Song Title> <Song Artist>
, otherwise using the user's input.
After fetching the Genius API, it takes the first search result and scrape the lyrics page. This is complicated since Genius doesn't give the lyrics using their API and scraping the page tends to be very inconsistent.
The scrape result gets feed into a Regex filter, which then gets feed into a function, forming the Discord Embed fields.
The entire bot is written using Typescript with Discord.JS as the framework
To use the bot, you will need to add the bot by clicking this link.
Once done, you can display the help command by sending:
~!help
These instructions will get you a copy of the bot up and running on your local machine for development and testing purposes.
You will need to install NodeJS version 14 or higher and the node-gyp
build tool (info). Yarn is recommended to install the project's dependency.
You will need to clone the repo to your machine
$ git clone https://github.com/angeloanan/lyrics-finder.git
$ cd lyrics-finder
Install the dependencies
// Using NPM
$ npm install
// Using Yarn
$ yarn install
You will need to create a .env
file or edit the system environment variable
Example environment variable is available on .env.example
$ mv .env.example .env
$ nano .env
To compile (transpile) the code back to Javascript, you will need to do the following
$ tsc .
The compiled code will be available on the targets
folder. Now, you can run the index file to run the bot.
You can skip compiling / transpiling the code by using a package called ts-node
// Using NPM
$ npm i -g ts-node
// Using Yarn
$ yarn global add ts-node
After it's installed, you can start the bot by doing the following
// Using NPM
$ npm start
// Using Yarn
$ yarn start
- Discord.js - Discord API wrapper
- Genius - Provides lyrics and API
- Typescript - A typed superset of JavaScript
- @angeloanan - Idea & Initial work
See also the list of contributors who participated in this project.
- Beta testing by Sam