Awesome
<p align="center"> <a href="" rel="noopener"> <img width=200px height=200px src="https://img.angeloanan.xyz/Y4laXvRA" alt="Lyrics Finder Logo"></a> </p> <h3 align="center">Lyrics Finder</h3> <div align="center"> </div><p align="center"> 🤖 A Discord bot which specializes on lyrics searching <br> </p>
📝 Table of Contents
- About
- Demo / Working
- How it works
- Usage
- Getting Started
- Built Using
- TODO
- Contributing
- Authors
- Acknowledgments
🧐 About <a name = "about"></a>
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.
🎥 Demo / Working <a name = "demo"></a>
💭 How it works <a name = "working"></a>
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
🎈 Usage <a name = "usage"></a>
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
🏁 Getting Started <a name = "getting_started"></a>
These instructions will get you a copy of the bot up and running on your local machine for development and testing purposes.
Prerequisites
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.
Installing
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
Compiling and running
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.
Running with ts-node
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
⛏️ Built Using <a name = "built_using"></a>
- Discord.js - Discord API wrapper
- Genius - Provides lyrics and API
- Typescript - A typed superset of JavaScript
✍️ Authors <a name = "authors"></a>
- @angeloanan - Idea & Initial work
See also the list of contributors who participated in this project.
🎉 Acknowledgements <a name = "acknowledgement"></a>
- Beta testing by Sam