Update the example/ping command
- Added the auto complete function commented out - Added JSDoc and comments for clarity
This commit is contained in:
@@ -1,16 +1,35 @@
|
|||||||
import { SlashCommandBuilder } from 'discord.js';
|
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()
|
export const data = new SlashCommandBuilder()
|
||||||
.setName('ping')
|
.setName('ping')
|
||||||
.setDescription('Replies with your input!');
|
.setDescription('Replies with your input!');
|
||||||
|
|
||||||
// Exporting other properties
|
// Exporting other properties
|
||||||
export const example = "/ping";
|
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;
|
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 {
|
try {
|
||||||
const sockets = await nodeIo.allSockets();
|
const sockets = await nodeIo.allSockets();
|
||||||
console.log("All open sockets: ",sockets);
|
console.log("All open sockets: ",sockets);
|
||||||
|
|||||||
Reference in New Issue
Block a user