Skip to content

Commit

Permalink
🛠️ fix: optimize async/await, improved formatting, renamed restart co…
Browse files Browse the repository at this point in the history
…mmand to replay
  • Loading branch information
LakhindarPal committed Jun 12, 2024
1 parent aac9e17 commit 0519494
Show file tree
Hide file tree
Showing 18 changed files with 226 additions and 109 deletions.
140 changes: 103 additions & 37 deletions COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,179 +2,245 @@

## Music Commands

## /volume
### `/volume`

Adjust the volume of the music player.
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| level | The volume level to set (0-100). | false | Number | |

## /swap
---

### `/swap`

Swap the position of two songs in the queue
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| first | The position of the first song | true | Number | |
| second | The position of the second song | true | Number | |

## /stop
---

### `/stop`

Stop the playback.

## /skipto
---

### `/skipto`

Skip to the given song, removing others on the way
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| position | The position of the song to skip to | true | Number | |

## /skip
---

### `/skip`

Skip to the next song

## /shuffle
---

### `/shuffle`

Toggle shuffle mode for this queue.

## /seek
---

### `/seek`

Seek to a specific timestamp in the current track.
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| timestamp | The timestamp to seek to (in seconds). | true | Number | |

## /resume
---

### `/resume`

Resume the playback

## /restart
---

### `/replay`

Replay the current song from the beginning

Restart the current song
---

## /repeat status
### `/repeat status`

Show the current repeat mode.

## /repeat off
---

### `/repeat off`

Disable repeat mode.

## /repeat queue
---

### `/repeat queue`

Repeat the entire queue.

## /repeat song
---

### `/repeat song`

Repeat the current song.

## /repeat autoplay
---

### `/repeat autoplay`

Automatically play related songs based on your queue.

## /remove
---

### `/remove`

Remove a song from the queue
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| position | The position of the song to remove | true | Number | |

## /queue
---

### `/queue`

Show the songs in the queue.
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| page | The page number of the queue | false | Number | |

## /play
---

### `/play`

Play a song or playlist from url or name
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| query | The name or url of the song, you want to play. | true | String | |

## /pause
---

### `/pause`

Pause the playback

## /now
---

### `/now`

Show the current playing song

## /move
---

### `/move`

Move a song in the queue
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| from | The current position of the song | true | Number | |
| to | The new position to move to | true | Number | |

## /lyrics
---

### `/lyrics`

Get lyrics for a song.
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| query | The title of the song to get lyrics for. | false | String | |

## /jump
---

### `/jump`

Jump to specific song on the queue without removing others
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| position | The position of the song to jump to | true | Number | |

## /filters clear
---

Remove all applied filters.
### `/filters clear`

## /filters show
Remove all applied audio filters.

Show all applied filters.
---

## /filters toggle
### `/filters status`

Enable or disable a specific filter.
Show the status of all audio filters.

---

### `/filters toggle`

Enable or disable a specific audio filter.
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| name | The name of the filter to toggle. | true | String | Bassboost, Chorus, Compressor, Dim, Earrape, Expander, Fadein, Flanger, Gate, Haas, Karaoke, Lofi, Mcompand, Mono, Nightcore, Normalizer, Phaser, Pulsator, Reverse, Softlimiter, Subboost, Surrounding, Treble, Vaporwave, Vibrato |

## /clear
---

### `/clear`

Clear songs from the queue, history, or all.
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| type | Select the type of songs to clear. | true | String | Queue, History, All |

## /back
---

### `/back`

Go back to the previous song

---

## Misc Commands

## /uptime
### `/uptime`

Show how long the bot has been up

## /support
---

### `/support`

Join the support server and get some help

## /ping
---

### `/ping`

Ping? Pong!

## /invite
---

### `/invite`

Invite the bot to your server

## /info
---

### `/info`

Show info about the bot

---

## Dev Commands

## /eval
### `/eval`

Execute a piece of javascript code
| Name | Description | Required | Type | Choices |
|------|-------------|----------|------|---------|
| code | The code to execute | true | String | |

---
8 changes: 4 additions & 4 deletions src/commands/dev/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export const data = {
};

export async function execute(interaction) {
await interaction.deferReply({ ephemeral: true });

const code = interaction.options.getString("code", true);

// Security check to prevent execution of potentially harmful code
const classified = ["env", "token", "config", "secret", "process"];
if (classified.some((item) => code.toLowerCase().includes(item))) {
return interaction.reply({
ephemeral: true,
return interaction.editReply({
embeds: [
ErrorEmbed(
"This operation is cancelled because it may include secrets."
Expand Down Expand Up @@ -65,8 +66,7 @@ export async function execute(interaction) {
color: error ? Colors.Red : Colors.Green,
};

return interaction.reply({
ephemeral: true,
return interaction.editReply({
embeds: [headerEmbed, codeEmbed, resultEmbed],
});
}
1 change: 1 addition & 0 deletions src/commands/misc/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const data = {

export function execute(interaction) {
const inviteLink = `https://discord.com/api/oauth2/authorize?client_id=${interaction.client.user.id}&permissions=281424481600&scope=bot%20applications.commands`;

const button = new ButtonBuilder()
.setLabel("Click to add the bot to your server.")
.setStyle(ButtonStyle.Link)
Expand Down
4 changes: 3 additions & 1 deletion src/commands/music/back.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ export async function execute(interaction) {
embeds: [ErrorEmbed("There is no previous song to go back to.")],
});

await interaction.deferReply();

await history.previous();

return await interaction.reply({
return interaction.editReply({
embeds: [SuccessEmbed("Went back to the previous song.")],
});
}
Loading

0 comments on commit 0519494

Please sign in to comment.