Skip to content

🎤 | Search the lyrics to your music with Lyrics Finder

License

Notifications You must be signed in to change notification settings

angeloanan/lyrics-finder

Repository files navigation

Lyrics Finder Logo

Lyrics Finder

Status Discord Invite Link GitHub Issues GitHub Pull Requests License


🤖 A Discord bot which specializes on lyrics searching

📝 Table of Contents

🧐 About

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

Simple Search Search using lyrics Multilingual Support Demo Autosearch Mode Demo

💭 How it works

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

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

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

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

  • Beta testing by Sam