Skip to content

Commit

Permalink
Merge pull request #25 from RainyXeon/dev
Browse files Browse the repository at this point in the history
v4.2.0
  • Loading branch information
RainyXeon authored Dec 31, 2023
2 parents 5459d0a + 9dc147f commit a397853
Show file tree
Hide file tree
Showing 58 changed files with 631 additions and 2,257 deletions.
2 changes: 2 additions & 0 deletions src/@types/Interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type NoAutoInteraction =
| ButtonInteraction
| ModalSubmitInteraction;

export type ReplyOnlyInteraction = CommandInteraction | ButtonInteraction;

export type AutocompleteInteractionChoices = {
name: string;
value: string;
Expand Down
45 changes: 0 additions & 45 deletions src/assets/radioLink.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { EmbedBuilder, Message } from "discord.js";

// Main code
export default class implements PrefixCommand {
name = "clear";
name = "clearqueue";
description = "Clear song in queue!";
category = "Music";
usage = "";
aliases = [];
aliases = ["clear", "cq"];
accessableby = Accessableby.Member;
lavalink = true;

Expand Down
19 changes: 13 additions & 6 deletions src/commands/prefix/Music/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from "discord.js";
import { Manager } from "../../../manager.js";
import { Accessableby, PrefixCommand } from "../../../@types/Command.js";
import { StartQueueDuration } from "../../../structures/QueueDuration.js";
import { ConvertTime } from "../../../structures/ConvertTime.js";

// Main code
export default class implements PrefixCommand {
Expand Down Expand Up @@ -37,7 +39,7 @@ export default class implements PrefixCommand {
embeds: [
new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "play_loading", {
`${client.i18n.get(language, "music", "file_loading", {
result: file.name,
})}`
)
Expand All @@ -46,10 +48,7 @@ export default class implements PrefixCommand {
});

const { channel } = message.member!.voice;
if (
!channel ||
message.member!.voice.channel !== message.guild!.members.me!.voice.channel
)
if (!channel)
return msg.edit({
embeds: [
new EmbedBuilder()
Expand Down Expand Up @@ -112,6 +111,8 @@ export default class implements PrefixCommand {
for (let track of tracks) player.queue.add(track);
else player.play(tracks[0]);

const TotalDuration = new StartQueueDuration().parse(tracks);

await message.delete();

if (result.type === "PLAYLIST") {
Expand All @@ -120,7 +121,9 @@ export default class implements PrefixCommand {
`${client.i18n.get(language, "music", "play_playlist", {
title: file.name,
url: file.url,
length: String(tracks.length),
duration: new ConvertTime().parse(TotalDuration),
songs: String(tracks.length),
request: String(tracks[0].requester),
})}`
)
.setColor(client.color);
Expand All @@ -132,6 +135,8 @@ export default class implements PrefixCommand {
`${client.i18n.get(language, "music", "play_track", {
title: file.name,
url: file.url,
duration: new ConvertTime().parse(tracks[0].length as number),
request: String(tracks[0].requester),
})}`
)
.setColor(client.color);
Expand All @@ -142,6 +147,8 @@ export default class implements PrefixCommand {
`${client.i18n.get(language, "music", "play_result", {
title: file.name,
url: file.url,
duration: new ConvertTime().parse(tracks[0].length as number),
request: String(tracks[0].requester),
})}`
);
msg.edit({ content: " ", embeds: [embed] });
Expand Down
89 changes: 22 additions & 67 deletions src/commands/prefix/Music/Forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const fastForwardNum = 10;
// Main code
export default class implements PrefixCommand {
name = "forward";
description = "Forward timestamp in the song!";
description = "Forward timestamp in the song! (10s)";
category = "Music";
usage = "<seconds>";
usage = "";
aliases = [];
lavalink = true;
accessableby = Accessableby.Member;
Expand All @@ -21,8 +21,6 @@ export default class implements PrefixCommand {
language: string,
prefix: string
) {
const value = args[0];

const msg = await message.reply({
embeds: [
new EmbedBuilder()
Expand Down Expand Up @@ -61,80 +59,37 @@ export default class implements PrefixCommand {

const song = player.queue.current;
const song_position = player.shoukaku.position;
const CurrentDuration = new FormatDuration().parse(song_position);
const CurrentDuration = new FormatDuration().parse(
song_position + fastForwardNum * 1000
);

if (value && !isNaN(+value)) {
if (song_position + Number(value) * 1000 < song!.length!) {
player.send({
guildId: message.guild!.id,
playerOptions: {
position: song_position + Number(value) * 1000,
},
});
if (song_position + fastForwardNum * 1000 < song!.length!) {
player.send({
guildId: message.guild!.id,
playerOptions: {
position: song_position + fastForwardNum * 1000,
},
});

const forward1 = new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "forward_msg", {
duration: CurrentDuration,
})}`
)
.setColor(client.color);
const forward2 = new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "forward_msg", {
duration: CurrentDuration,
})}`
)
.setColor(client.color);

msg.edit({ content: " ", embeds: [forward1] });
} else {
return msg.edit({
embeds: [
new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "forward_beyond")}`
)
.setColor(client.color),
],
});
}
} else if (value && isNaN(+value)) {
msg.edit({ content: " ", embeds: [forward2] });
} else {
return msg.edit({
embeds: [
new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "forward_invalid", {
prefix: prefix,
})}`
`${client.i18n.get(language, "music", "forward_beyond")}`
)
.setColor(client.color),
],
});
}

if (!value) {
if (song_position + fastForwardNum * 1000 < song!.length!) {
player["send"]({
guildId: message.guild!.id,
playerOptions: {
position: song_position + fastForwardNum * 1000,
},
});

const forward2 = new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "forward_msg", {
duration: CurrentDuration,
})}`
)
.setColor(client.color);

msg.edit({ content: " ", embeds: [forward2] });
} else {
return msg.edit({
embeds: [
new EmbedBuilder()
.setDescription(
`${client.i18n.get(language, "music", "forward_beyond")}`
)
.setColor(client.color),
],
});
}
}
}
}
2 changes: 1 addition & 1 deletion src/commands/prefix/Music/Join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class implements PrefixCommand {
description = "Make the bot join the voice channel.";
category = "Music";
usage = "";
aliases = [];
aliases = ["j"];
lavalink = true;
accessableby = Accessableby.Member;

Expand Down
110 changes: 0 additions & 110 deletions src/commands/prefix/Music/Lofi.ts

This file was deleted.

Loading

0 comments on commit a397853

Please sign in to comment.