Skip to content

Commit

Permalink
Merge pull request #246 from Tetracyl/2.5.0
Browse files Browse the repository at this point in the history
2.5.0
  • Loading branch information
3eif authored Nov 12, 2022
2 parents 2495e4b + c2e18f4 commit ea1eb16
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ If you installed and setup eveything correctly then the bot should output someth

## Contributors
- [2D](https://github.com/MeLike2D): Provided modified lavalink version with filters.
- [MrAugu](https://github.com/MrAugu): Cleaned up spaghetti code.
- [Sxmurai](https://github.com/Sxmurai/): Cleaned up spaghetti code.
- [2D](https://github.com/MeLike2D): Provided modified lavalink version with filters
- [MrAugu](https://github.com/MrAugu): Cleaned up spaghetti code
- [Sxmurai](https://github.com/Sxmurai/): Cleaned up spaghetti code
- [Omar](https://github.com/HysMX): Fixed Youtube playlist bug
- [lmpham1](https://github.com/lmpham1): Added clean command.
- [lmpham1](https://github.com/lmpham1): Added clean command
- [rajamoulimallareddy](https://github.com/rajamoulimallareddy): Updated bot to discord.js v13
- [ilikdoge](https://github.com/ilikdoge): Helped with implementation of yasha and overall development of bot
- [Berus](https://github.com/berusvn): Added lyrics command

## Bot Lists
[![Bots On Discord](https://bots.ondiscord.xyz/bots/472714545723342848/embed?theme=dark&showGuilds=true)](https://bots.ondiscord.xyz/bots/472714545723342848)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"homepage": "https://github.com/Tetracyl/EarTensifier#readme",
"dependencies": {
"axios": "^0.27.2",
"@discordjs/rest": "^1.1.0",
"@sentry/node": "^7.12.1",
"axios": "^0.27.2",
"blapi": "^3.0.0",
"cors": "^2.8.5",
"cpu-stat": "^2.0.1",
Expand All @@ -41,6 +41,7 @@
"express": "^4.17.1",
"figlet": "^1.5.2",
"fs": "^0.0.1-security",
"genius-lyrics": "^4.4.0",
"humanize-duration": "^3.27.0",
"mongoose": "^6.0.12",
"signale": "^1.4.0",
Expand All @@ -51,4 +52,4 @@
"devDependencies": {
"eslint": "^8.1.0"
}
}
}
58 changes: 58 additions & 0 deletions src/commands/music/Lyrics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { ApplicationCommandOptionType } = require('discord.js');
const Command = require('../../structures/Command');
const genius = require("genius-lyrics");
const Genius = new genius.Client(process.env.GENIUS_API);
const _ = require('lodash');
const { EmbedBuilder } = require('discord.js');

module.exports = class Lyrics extends Command {
constructor(client) {
super(client, {
name: 'lyrics',
description: {
content: 'Search lyrics of the song.',
usage: '<query>',
},
args: false,
voiceRequirements: {
isInVoiceChannel: false,
isInSameVoiceChannel: false,
isPlaying: false,
},
options: [{
name: 'song',
type: ApplicationCommandOptionType.String,
required: false,
description: 'Song name to find lyrics for.',
}],
slashCommand: true,
});
}
async run(client, ctx, args) {
const player = client.music.players.get(ctx.guild.id);
if (!args[0] && !player) return ctx.sendEphemeralMessage('There is nothing currently playing.');
let query = args.join(' ');
if (!args[0]) query = player.queue.current.title;
const getSongTitle = query.replace(
/lyrics|lyric|lyrical|official music video|\(official music video\)|\(Official Video\)|audio|\(audio\)|official|official video|official video hd|official hd video|offical video music|\(offical video music\)|extended|hd|(\[.+\])/gi,
'',
);

let songs = (await Genius.songs.search(getSongTitle))[0];
const songTitle = songs.title || song.featuredTitle;
const songLyrics = await songs.lyrics();
if (!songLyrics) return ctx.sendEphemeralMessage(`**No lyrics found for **${songTitle}**`);
const lyrics = songLyrics.split('\n');
const formattedLyrics = _.chunk(lyrics, 40);

let pages = formattedLyrics.map((ly) => {
const embed = new EmbedBuilder()
.setAuthor({ name: `Lyrics for ${songTitle}`, iconURL: client.user.displayAvatarURL() })
.setDescription(ly.join('\n'))
.setThumbnail(songs.thumbnail);
return embed;
});

return ctx.messageHelper.paginate(pages);
}
};
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (process.platform != 'linux') {
darwin: 'macOS',
win32: 'Windows',
};
console.error('You must be on linux to run this bot. You are currently using:', alias[process.platform] || process.platform);
logger.error('You must be on linux to run this bot. You are currently using:', alias[process.platform] || process.platform);
}

if (process.env.NODE_ENV == 'production') {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ea1eb16

Please sign in to comment.