Skip to content

Commit

Permalink
3.1.1
Browse files Browse the repository at this point in the history
Fixed lyrics error handling.
Add /lyrics command to wiki.
Changed publish-docker-image action to ignore wiki folder.
  • Loading branch information
AlexInCube committed Jul 9, 2024
1 parent 08b40f0 commit c759ed6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
.env*
runInDocker.*
yt-cookies.json
wiki
3 changes: 3 additions & 0 deletions .github/workflows/publish-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Publish Docker image
on:
push:
branches: ['master']
paths-ignore:
- '**/wiki/**'
- '/wiki/**'

env:
IMAGE_TAG: alexincube/aicotest
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aicbot",
"version": "3.1.0",
"version": "3.1.1",
"description": "Discord Bot for playing music",
"main": "build/main.js",
"scripts": {
Expand Down
24 changes: 14 additions & 10 deletions src/audioplayer/Lyrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ export async function generateLyricsEmbed(songQuery: string) {
return generateErrorEmbed(i18next.t('commands:lyrics_embed_lyrics_not_found'));
}

const lyrics = await geniusSong.lyrics();

const lyricsText = lyrics.slice(0, 4096);

return new EmbedBuilder()
.setTitle(geniusSong.title)
.setURL(geniusSong.url)
.setDescription(lyricsText)
.setColor(Colors.Yellow)
.setFooter({ text: i18next.t('commands:lyrics_embed_text_not_correct') });
try{
const lyrics = await geniusSong.lyrics();

const lyricsText = lyrics.slice(0, 4096);

return new EmbedBuilder()
.setTitle(geniusSong.title)
.setURL(geniusSong.url)
.setDescription(lyricsText)
.setColor(Colors.Yellow)
.setFooter({ text: i18next.t('commands:lyrics_embed_text_not_correct') });
} catch (e){
return generateErrorEmbed(i18next.t('commands:lyrics_embed_lyrics_not_found'));
}
}
1 change: 1 addition & 0 deletions src/commands/audio/lyrics.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function (): ICommand {
execute: async (interaction) => {
const songQuery = interaction.options.getString('request')!;

await interaction.deferReply()
await interaction.reply({ embeds: [await generateLyricsEmbed(songQuery)] });
}
},
Expand Down
6 changes: 6 additions & 0 deletions wiki/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ Skip current playing song

Kill the audioplayer

### lyrics

Example: /lyrics faded alan walker

Searching a provided query for song lyrics and return text

### audiodebug

Give the current count of spawned audioplayers
Expand Down

0 comments on commit c759ed6

Please sign in to comment.