Skip to content

Commit

Permalink
Merge pull request #554 from AikooNee/main
Browse files Browse the repository at this point in the history
Added Replay cmd
  • Loading branch information
appujet authored May 17, 2024
2 parents 2a2c8dd + 014ece7 commit 0469531
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/commands/music/Replay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Command, Context, Lavamusic } from '../../structures/index.js';

export default class Replay extends Command {
constructor(client: Lavamusic) {
super(client, {
name: 'replay',
description: {
content: 'Replays the current track',
examples: ['replay'],
usage: 'replay',
},
category: 'music',
aliases: ['rp'],
cooldown: 3,
args: false,
player: {
voice: true,
dj: false,
active: true,
djPerm: null,
},
permissions: {
dev: false,
client: ['SendMessages', 'ViewChannel'],
user: [],
},
slashCommand: true,
});
}

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

if (!player.current) {
return await ctx.sendMessage({
embeds: [
embed
.setColor(this.client.color.red)
.setDescription('There is no track currently playing'),
],
});
}

player.seek(0);

return await ctx.sendMessage({
embeds: [
embed
.setColor(this.client.color.main)
.setDescription('Replaying the current track'),
],
});
}
}

/**
* Project: lavamusic
* Author: Appu
* Company: Coders
* Copyright (c) 2024. All rights reserved.
* 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
*/

0 comments on commit 0469531

Please sign in to comment.