Files
DRB-CnC/Client/discord-bot/commands/leave.js
Logan Cusano e5d885cc3e Logging Update
- Changed to uniform logging with the 'debug' module
- Updated all apps
2022-12-11 21:11:29 -05:00

18 lines
694 B
JavaScript

import {getVoiceConnection} from "@discordjs/voice";
import {replyToInteraction} from "../utilities/messageHandler.js";
// Debug
//import debugBuilder from "../utilities/moduleDebugBuilder.js";
//const log = new debugBuilder("bot", "leave");
/**
* If in a voice channel for the specified guild, leave
*
* @param interaction Message interaction from discord
*/
export default async function leave(interaction){
const guildId = interaction.guild.id;
const voiceConnection = getVoiceConnection(guildId);
if (!voiceConnection) return replyToInteraction(interaction, "Not in a voice channel.");
voiceConnection.destroy();
return replyToInteraction(interaction, `Goodbye`);
}