Skip to content

Commit 617cb63

Browse files
committed
added leave voice command
1 parent 94ad16f commit 617cb63

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This is a basic music bot that also has the ability to listen to voice commands.
5050
- **Voice commands**:
5151
- **Important**: to enable the voice commands. You have to execute the command `toggle-speech` first!
5252
- All voice commands start with `music`
53-
- There are: `play, pause, resume, skip, shuffle, list`
53+
- There are: `play, pause, resume, skip, shuffle, list, leave`
5454
- For example: `music play <some song>`
5555

5656
## Voice Transcriber

discord-player.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class MusicPlayer {
5656
this.DISCORD_CHAR_LIMIT = 1950;
5757

5858
this.transcriber = new Transcriber(this.config.witAi);
59-
this.voiceParser = new VoiceParser(["play", "pause", "resume", "skip", "shuffle", "list"]);
59+
this.voiceParser = new VoiceParser(["play", "pause", "resume", "skip", "shuffle", "list", "leave"]);
6060

6161
this.geniusClient = new Genius.Client(this.config.geniusToken);
6262

@@ -383,6 +383,11 @@ class MusicPlayer {
383383
if (messages[i]) this.textChannel.send({ content: messages[i] });
384384
}
385385
break;
386+
case "leave":
387+
var left = this.leave();
388+
if (left) return this.textChannel.send({ content: "Left the voice channel" });
389+
this.textChannel.send({ content: "I'm not connected to a voice channel..." });
390+
break;
386391
default:
387392
console.warn("Suspicios case. Query: ", cmd);
388393
break;

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async function execute(name, interaction) {
115115
interaction.editReply({ content: "Joined." });
116116
break;
117117
case "leave":
118-
await interaction.deferReply();
118+
await interaction.deferReply();
119119
var left = musicPlayer.leave(interaction);
120120
if (left) {
121121
return interaction.editReply({ content: "Left the voice channel" });

0 commit comments

Comments
 (0)