Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update play command #655

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/commands/music/Play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,21 @@ export default class Play extends Command {
switch (res.loadType) {
case LoadType.ERROR:
ctx.editMessage({
content: "",
embeds: [embed.setColor(this.client.color.red).setDescription(ctx.locale("cmd.play.errors.search_error"))],
});
break;
case LoadType.EMPTY:
ctx.editMessage({
content: "",
embeds: [embed.setColor(this.client.color.red).setDescription(ctx.locale("cmd.play.errors.no_results"))],
});
break;
case LoadType.TRACK: {
const track = player.buildTrack(res.data, ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -77,6 +80,7 @@ export default class Play extends Command {
player.queue.push(track);
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand All @@ -88,6 +92,7 @@ export default class Play extends Command {
case LoadType.PLAYLIST: {
if (res.data.tracks.length > client.config.maxPlaylistSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -100,6 +105,7 @@ export default class Play extends Command {
const pl = player.buildTrack(track, ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -112,6 +118,7 @@ export default class Play extends Command {
}
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand All @@ -124,6 +131,7 @@ export default class Play extends Command {
const track1 = player.buildTrack(res.data[0], ctx.author);
if (player.queue.length > client.config.maxQueueSize)
return await ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.red)
Expand All @@ -133,6 +141,7 @@ export default class Play extends Command {
player.queue.push(track1);
await player.isPlaying();
ctx.editMessage({
content: "",
embeds: [
embed
.setColor(this.client.color.main)
Expand Down