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);
|
||||
|
||||
await interaction.respond(
|
||||
filtered.map(choice => ({ name: choice.name, value: choice.name }))
|
||||
);
|
||||
try {
|
||||
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 (availableNodes.length === 1) {
|
||||
await joinNode(nodeIo, interaction, availableNodes[0].id, system, channelToJoin);
|
||||
}
|
||||
}
|
||||
|
||||
// If there are more than one available, prompt the user for their selected node
|
||||
else {
|
||||
@@ -79,8 +84,8 @@ export async function execute(nodeIo, interaction) {
|
||||
await joinNode(nodeIo, interaction, selectedNode, system, channelToJoin);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
log.ERROR(err);
|
||||
await interaction.editReply({ content: `An error occurred: ${err.message}`, ephemeral: true });
|
||||
|
||||
Reference in New Issue
Block a user