From 3d59a4840d0f5edb65b23544cc9b97b7d743e856 Mon Sep 17 00:00:00 2001 From: JamesJJT Date: Thu, 11 Apr 2024 17:54:37 -0700 Subject: [PATCH] Fall back to display name matching for /hubsupport searches --- lib/commands/hubsupport.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/commands/hubsupport.js b/lib/commands/hubsupport.js index 614a8c590..3f53566a1 100644 --- a/lib/commands/hubsupport.js +++ b/lib/commands/hubsupport.js @@ -38,17 +38,14 @@ export default { .setAutocomplete(true) ), async execute (interaction) { - let value = interaction.options.getString('name') + const value = interaction.options.getString('name') if (!value) { return interaction.followUp('Support for hub plugins should be directed to the author of the plugin.\nYou can find the support link by searching for the plugin in the Plugin Hub panel and clicking the `?` button on the plugin, or by right-clicking the plugin in the plugin panel and clicking the `Support` menu option.') } - // Replace spaces with dashes to fix an issue with spaces not returning anything - value = value.replace(/\s+/g, '-') - const manifest = await fetchManifest() - const plugin = manifest.display.find(p => p.internalName === value) + const plugin = manifest.display.find(p => p.internalName === replaceSpaceWithDash(value) || p.displayName.toLowerCase() === value.toLowerCase()) if (plugin) { return interaction.followUp(`Get support for the **${plugin.displayName}** Plugin Hub plugin here: .\nYou can also find the support link by searching for the plugin in the Plugin Hub panel and clicking the \`?\` button on the plugin, or by right-clicking the plugin in the plugin panel and clicking the \`Support\` menu option.`)