Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/angeloanan/lyrics-finder

🎤 | Search the lyrics to your music with Lyrics Finder
https://github.com/angeloanan/lyrics-finder

discord-bot discord-js discordapp discordbot genius genius-api lyrics lyrics-finder

Last synced: about 2 months ago
JSON representation

🎤 | Search the lyrics to your music with Lyrics Finder

Awesome Lists containing this project

README

        



Lyrics Finder Logo

Lyrics Finder

![Status](https://img.shields.io/badge/status-active-success.svg)
[![Discord Invite Link](https://img.shields.io/badge/Support%20Server-Invite%20Link-blue?logo=discord)](https://discord.gg/mFvDvHc)
[![GitHub Issues](https://img.shields.io/github/issues/angeloanan/lyrics-finder.svg)](https://github.com/angeloanan/lyrics-finder/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/angeloanan/lyrics-finder.svg)](https://github.com/angeloanan/lyrics-finder/pulls)
[![License](https://img.shields.io/github/license/angeloanan/lyrics-finder)](/LICENSE)

---

🤖 A Discord bot which specializes on lyrics searching


## 📝 Table of Contents
+ [About](#about)
+ [Demo / Working](#demo)
+ [How it works](#working)
+ [Usage](#usage)
+ [Getting Started](#getting_started)
+ [Built Using](#built_using)
+ [TODO](../TODO.md)
+ [Contributing](../CONTRIBUTING.md)
+ [Authors](#authors)
+ [Acknowledgments](#acknowledgement)

## 🧐 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](https://img.angeloanan.xyz/XbWljK4B)
![Search using lyrics](https://img.angeloanan.xyz/PRLY7NeJ)
![Multilingual Support Demo](https://img.angeloanan.xyz/5baOdwRd)
![Autosearch Mode Demo](https://img.angeloanan.xyz/5e65mVRz)

## 💭 How it works

The bot uses the [Genius API](https://genius.com/developers) to search the lyrics of a song. When searching using Spotify, the bot grabs the User presence and forms the search query by ` `, 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](https://typescriptlang.org) with [Discord.JS](https://discord.js.org) as the framework

## 🎈 Usage

To use the bot, you will need to [**add the bot by clicking this link**](https://discord.com/oauth2/authorize?client_id=559265456008200222&permissions=314432&scope=bot).

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](https://nodejs.org) version 14 or higher and the `node-gyp` build tool ([info](https://github.com/nodejs/node-gyp#installation)). [Yarn](https://yarnpkg.com) 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
+ [Discord.js](https://discord.js.org) - Discord API wrapper
+ [Genius](https://genius.com/developer) - Provides lyrics and API
+ [Typescript](https://typescriptlang.org) - A typed superset of JavaScript

## ✍️ Authors
+ [@angeloanan](https://github.com/angeloanan) - Idea & Initial work

See also the list of [contributors](https://github.com/angeloanan/lyrics-finder/contributors) who participated in this project.

## 🎉 Acknowledgements
+ Beta testing by Sam