Handle join auto complete error and update formatting
This commit is contained in:
@@ -32,9 +32,14 @@ export async function autocomplete(nodeIo, interaction) {
|
|||||||
|
|
||||||
log.DEBUG(focusedValue, choices, filtered);
|
log.DEBUG(focusedValue, choices, filtered);
|
||||||
|
|
||||||
await interaction.respond(
|
try {
|
||||||
filtered.map(choice => ({ name: choice.name, value: choice.name }))
|
await interaction.respond(
|
||||||
);
|
filtered.map(choice => ({ name: choice.name, value: choice.name }))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
log.WARN("Autocomplete interaction failure", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +76,7 @@ export async function execute(nodeIo, interaction) {
|
|||||||
// If there is one available node, request that node join
|
// If there is one available node, request that node join
|
||||||
if (availableNodes.length === 1) {
|
if (availableNodes.length === 1) {
|
||||||
await joinNode(nodeIo, interaction, availableNodes[0].id, system, channelToJoin);
|
await joinNode(nodeIo, interaction, availableNodes[0].id, system, channelToJoin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are more than one available, prompt the user for their selected node
|
// If there are more than one available, prompt the user for their selected node
|
||||||
else {
|
else {
|
||||||
@@ -79,8 +84,8 @@ export async function execute(nodeIo, interaction) {
|
|||||||
await joinNode(nodeIo, interaction, selectedNode, system, channelToJoin);
|
await joinNode(nodeIo, interaction, selectedNode, system, channelToJoin);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (err) {
|
catch (err) {
|
||||||
log.ERROR(err);
|
log.ERROR(err);
|
||||||
await interaction.editReply({ content: `An error occurred: ${err.message}`, ephemeral: true });
|
await interaction.editReply({ content: `An error occurred: ${err.message}`, ephemeral: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user