43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
// Debug
|
|
const { DebugBuilder } = require("../utilities/debugBuilder.js");
|
|
const log = new DebugBuilder("client-bot", "status");
|
|
// Modules
|
|
const {getVoiceConnection} = require("@discordjs/voice");
|
|
// Utilities
|
|
const {replyToInteraction} = require("../utilities/messageHandler.js");
|
|
const { SlashCommandBuilder } = require('discord.js');
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('status')
|
|
.setDescription('Check the status of the bot'),
|
|
example: "status",
|
|
isPrivileged: false,
|
|
async execute(interaction) {
|
|
await this.status({ interaction: interaction });
|
|
}
|
|
}
|
|
|
|
|
|
exports.status = async function status({interaction= undefined, guildID= undefined, callback = undefined}) {
|
|
//if (!interaction && !guildID) // Need error of sorts
|
|
if (interaction){
|
|
guildID = interaction.guild.id;
|
|
}
|
|
const voiceConnection = getVoiceConnection(guildID);
|
|
|
|
const statusObj = {
|
|
"guildID": guildID, "voiceConnection": voiceConnection
|
|
}
|
|
|
|
//log.DEBUG('Status Object: ', statusObj);
|
|
|
|
// get the status and return it accordingly (message reply / module)
|
|
|
|
if (interaction) {
|
|
return replyToInteraction(interaction, "Pong! I have Aids and now you do too!");
|
|
}
|
|
else {
|
|
callback(statusObj);
|
|
}
|
|
} |