Skip to content

Commit

Permalink
Merge branch 'appujet:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hwangsihu authored Jul 6, 2024
2 parents 592a044 + ea80f33 commit 76c63a7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ RUN npm install --omit=dev
RUN npx prisma generate
RUN npx prisma db push

# Ensure application.yml is a file, not a directory
RUN rm -rf /opt/lavamusic/application.yml && \
touch /opt/lavamusic/application.yml

# Run as non-root user
RUN addgroup --gid 322 --system lavamusic && \
adduser --uid 322 --system lavamusic
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ services:
# Your lavalink password
- LAVALINK_AUTH=youshallnotpass
# Your lavalink name
- LAVALINK_NAME=Blacky'
- LAVALINK_NAME=LavaMusic
# Your lavalink secure (true or false)
- LAVALINK_SECURE=false
# database url
Expand Down
7 changes: 4 additions & 3 deletions src/commands/music/Replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ export default class Replay extends Command {
const player = client.queue.get(ctx.guild.id);
const embed = this.client.embed();

if (!player.current) {

if (!player.current?.info.isSeekable) {
return await ctx.sendMessage({
embeds: [embed.setColor(this.client.color.red).setDescription("There is no track currently playing")],
embeds: [embed.setColor(this.client.color.red).setDescription("Cannot replay this track as it is not seekable")],
});
}

player.seek(0);

return await ctx.sendMessage({
Expand Down
29 changes: 21 additions & 8 deletions src/commands/music/Seek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default class Seek extends Command {
slashCommand: true,
options: [
{
name: "time",
description: "The time to seek to",
name: "duration",
description: "The duration to seek to",
type: 3,
required: true,
},
Expand All @@ -38,19 +38,32 @@ export default class Seek extends Command {

public async run(client: Lavamusic, ctx: Context, args: string[]): Promise<any> {
const player = client.queue.get(ctx.guild.id);
const current = player.current.info;
const embed = this.client.embed();

const time = client.utils.parseTime(args[0]);
if (!time) {
const duration = client.utils.parseTime(args.join(" "));

if (!duration) {
return await ctx.sendMessage({
embeds: [embed.setColor(this.client.color.red).setDescription("Invalid time format.")],
embeds: [embed.setColor(this.client.color.red).setDescription("Invalid time format. Example: seek 1m, seek 1h 30m")],
});
}

player.seek(time);
if (!current.isSeekable) {
return await ctx.sendMessage({
embeds: [embed.setColor(this.client.color.red).setDescription("This track is not seekable")],
});
}

if (duration > current.length) {
return await ctx.sendMessage({
embeds: [embed.setColor(this.client.color.red).setDescription(`Cannot seek beyond the song duration of ${client.utils.formatTime(current.length)}`)],
});
}

player.seek(duration);

return await ctx.sendMessage({
embeds: [embed.setColor(this.client.color.main).setDescription(`Seeked to ${args[0]}`)],
embeds: [embed.setColor(this.client.color.main).setDescription(`Seeked to ${client.utils.formatTime(duration)}`)],
});
}
}
Expand Down

0 comments on commit 76c63a7

Please sign in to comment.