Skip to content

Commit

Permalink
Merge pull request #745 from CharlesNaig/main
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet authored Oct 20, 2024
2 parents e90bdf5 + fefb055 commit f715e77
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/commands/music/Lyrics.ts.txt → src/commands/music/Lyrics.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
/* import {
ActionRowBuilder,
ButtonBuilder,
type ButtonInteraction,
ButtonStyle,
ComponentType,
type TextChannel,
} from 'discord.js';
import { ActionRowBuilder, ButtonBuilder, type ButtonInteraction, ButtonStyle, ComponentType, type TextChannel, } from 'discord.js';
import { getLyrics } from 'genius-lyrics-api';
import { Command, type Context, type Lavamusic } from '../../structures/index';

Expand All @@ -14,9 +7,9 @@ export default class Lyrics extends Command {
super(client, {
name: 'lyrics',
description: {
content: 'cmd.lyrics.description',
examples: ['lyrics'],
usage: 'lyrics',
content: 'cmd.lyrics.description',
examples: ['lyrics'],
usage: 'lyrics',
},
category: 'music',
aliases: ['ly'],
Expand All @@ -40,14 +33,15 @@ export default class Lyrics extends Command {
}

public async run(client: Lavamusic, ctx: Context): Promise<any> {
const player = client.manager.getPlayer(ctx.guild!.id);
let player = client.manager.getPlayer(ctx.guild!.id);
if (!player) return await ctx.sendMessage(ctx.locale('event.message.no_music_playing'))
const embed = this.client.embed();

const currentTrack = player.queue.current!;
const trackTitle = currentTrack.info.title.replace(/\[.*?\]/g, '').trim();
const artistName = currentTrack.info.author.replace(/\[.*?\]/g, '').trim();
const trackUrl = currentTrack.info.uri;
const artworkUrl = currentTrack.info.artworkUrl;
const track = player.queue.current!;
const trackTitle = track.info.title.replace(/\[.*?\]/g, '').trim();
const artistName = track.info.author.replace(/\[.*?\]/g, '').trim();
const trackUrl = track.info.uri;
const artworkUrl = track.info.artworkUrl;

await ctx.sendDeferMessage(ctx.locale('cmd.lyrics.searching', { trackTitle }));

Expand Down Expand Up @@ -173,7 +167,6 @@ export default class Lyrics extends Command {
return pages;
}
}
*/

/**
* Project: lavamusic
Expand All @@ -184,4 +177,4 @@ export default class Lyrics extends Command {
* This code is the property of Coder and may not be reproduced or
* modified without permission. For more information, contact us at
* https://discord.gg/ns8CTk9J3e
*/
*/
36 changes: 36 additions & 0 deletions src/utils/genius-lyrics-api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
declare module 'genius-lyrics-api' {
interface SearchOptions {
apiKey: string;
title: string;
artist?: string;
optimizeQuery?: boolean;
}

interface Song {
id: number;
title: string;
url: string;
}

interface LyricsOptions {
title: string;
artist: string;
}

interface AlbumArtOptions {
title: string;
artist: string;
}

interface SongByIdOptions {
id: number;
apiKey: string;
}

export function search(options: SearchOptions): Promise<Song[]>;
export function getSong(options: { id: number; apiKey: string }): Promise<Song>;
export function getLyrics(options: LyricsOptions): Promise<string>;
export function getAlbumArt(options: AlbumArtOptions): Promise<string>;
export function getSongById(options: SongByIdOptions): Promise<Song>;
export function searchSong(options: SearchOptions): Promise<Song[]>;
}

0 comments on commit f715e77

Please sign in to comment.