-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from RainyXeon/dev
Weekly patch
- Loading branch information
Showing
49 changed files
with
689 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { ApplicationCommandOptionType, EmbedBuilder } from "discord.js"; | ||
import { Manager } from "../../manager.js"; | ||
import { Accessableby, Command } from "../../structures/Command.js"; | ||
import { CommandHandler } from "../../structures/CommandHandler.js"; | ||
import { RainlinkPlayer } from "../../rainlink/main.js"; | ||
|
||
// Main code | ||
export default class implements Command { | ||
public name = ["skipto"]; | ||
public description = "Skip to a specific position"; | ||
public category = "Music"; | ||
public accessableby = Accessableby.Member; | ||
public usage = ""; | ||
public aliases = ["sk"]; | ||
public lavalink = true; | ||
public options = [ | ||
{ | ||
name: "position", | ||
description: "The position of the song", | ||
type: ApplicationCommandOptionType.Number, | ||
required: true, | ||
}, | ||
]; | ||
public playerCheck = true; | ||
public usingInteraction = true; | ||
public sameVoiceCheck = true; | ||
public permissions = []; | ||
|
||
public async execute(client: Manager, handler: CommandHandler) { | ||
await handler.deferReply(); | ||
const player = client.rainlink.players.get(handler.guild!.id) as RainlinkPlayer; | ||
|
||
const getPosition = Number(handler.args[0]); | ||
|
||
if (!handler.args[0] || isNaN(getPosition) || getPosition < 0) | ||
return handler.editReply({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setDescription(`${client.getString(handler.language, "error", "number_invalid")}`) | ||
.setColor(client.color), | ||
], | ||
}); | ||
|
||
if (player.queue.size == 0 || getPosition >= player.queue.length) { | ||
const skipped = new EmbedBuilder() | ||
.setDescription(`${client.getString(handler.language, "command.music", "skip_notfound")}`) | ||
.setColor(client.color); | ||
|
||
handler.editReply({ content: " ", embeds: [skipped] }); | ||
} else { | ||
const cuttedQueue = player.queue.splice(0, getPosition); | ||
const nowCurrentTrack = cuttedQueue.splice(-1)[0]; | ||
player.queue.previous.push(...cuttedQueue); | ||
player.queue.current ? player.queue.previous.unshift(player.queue.current) : true; | ||
await player.play(nowCurrentTrack); | ||
player.queue.shift(); | ||
const skipped = new EmbedBuilder() | ||
.setDescription(`${client.getString(handler.language, "command.music", "skip_msg")}`) | ||
.setColor(client.color); | ||
handler.editReply({ content: " ", embeds: [skipped] }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.