Skip to content

Commit

Permalink
update play command
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet committed Aug 1, 2024
1 parent 80ad284 commit b627583
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit b627583

Please sign in to comment.