Update the example/ping command

- Added the auto complete function commented out
- Added JSDoc and comments for clarity
This commit is contained in:
Logan Cusano
2024-02-18 20:06:08 -05:00
parent 42784f1852
commit e431db1337

View File

@@ -1,16 +1,35 @@
import { SlashCommandBuilder } from 'discord.js';
// Exporting data property
// Exporting data property that contains the command structure for discord including any params
export const data = new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with your input!');
// Exporting other properties
export const example = "/ping";
export const deferInitialReply = false;
export const example = "/ping"; // An example of how the command would be run in discord chat, this will be used for the help command
export const deferInitialReply = false; // If we the initial reply in discord should be deferred. This gives extra time to respond, however the method of replying is different.
// Exporting execute function
export async function execute(nodeIo, interaction) {
/**
* Function to give the user auto-reply suggestions
* @param {any} nodeIo The nodeIO server for manipulation of sockets
* @param {any} interaction The interaction object
*/
/*
export async function autocomplete(nodeIo, interaction) {
const focusedValue = interaction.options.getFocused();
const choices = [];
const filtered = choices.filter(choice => choice.name.startsWith(focusedValue));
console.log(focusedValue, choices, filtered);
await interaction.respond(filtered);
}
*/
/**
* The function to run when the command is called by a discord user
* @param {any} nodeIo The nodeIO server for manipulation of sockets
* @param {any} interaction The interaction object
*/
export const execute = async (nodeIo, interaction) => {
try {
const sockets = await nodeIo.allSockets();
console.log("All open sockets: ",sockets);