From ef13a1e38232ed97ca3c3cb7be9cc77a69afdaee Mon Sep 17 00:00:00 2001 From: Techbot121 Date: Tue, 11 Jun 2024 21:21:20 +0200 Subject: [PATCH] fix wrong max length --- .../discord/modules/commands/developer/Ban.ts | 2 +- .../discord/modules/commands/developer/Gserv.ts | 11 +++++++---- .../discord/modules/commands/developer/Kick.ts | 2 +- .../discord/modules/commands/developer/Lua.ts | 2 +- .../discord/modules/commands/developer/RefreshLua.ts | 2 +- .../discord/modules/commands/developer/UnBan.ts | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/services/discord/modules/commands/developer/Ban.ts b/app/services/discord/modules/commands/developer/Ban.ts index 94bfd216..b962d877 100644 --- a/app/services/discord/modules/commands/developer/Ban.ts +++ b/app/services/discord/modules/commands/developer/Ban.ts @@ -131,7 +131,7 @@ export const SlashBanCommand: SlashCommand = { name: "server", description: "The server to run the command on", choices: servers - .filter(s => s.ssh) + .filter(s => !!s.ssh) .map(s => { return { name: s.name, value: s.id }; }), diff --git a/app/services/discord/modules/commands/developer/Gserv.ts b/app/services/discord/modules/commands/developer/Gserv.ts index 18121eb8..1bd2775a 100644 --- a/app/services/discord/modules/commands/developer/Gserv.ts +++ b/app/services/discord/modules/commands/developer/Gserv.ts @@ -131,9 +131,9 @@ export const SlashGservCommand: SlashCommand = { custom_id: "gserv_server", placeholder: "Choose a server.", min_values: 1, - max_values: servers.length, + max_values: servers.filter(s => !!s.ssh).length, options: servers - .filter(s => s.ssh) + .filter(s => !!s.ssh) .map( server => { @@ -212,12 +212,15 @@ export const SlashGservCommand: SlashCommand = { }) .catch(err => result.update(`something went wrong!\`\`\`\n${err}\`\`\``)); } catch (err) { + console.error(err); await ctx.editReply(JSON.stringify(err)); } - } catch { + } catch (err) { + console.error(err); await ctx.deleteReply(); } - } catch { + } catch (err) { + console.error(err); await ctx.deleteReply(); } }, diff --git a/app/services/discord/modules/commands/developer/Kick.ts b/app/services/discord/modules/commands/developer/Kick.ts index b35a269f..4177a40e 100644 --- a/app/services/discord/modules/commands/developer/Kick.ts +++ b/app/services/discord/modules/commands/developer/Kick.ts @@ -14,7 +14,7 @@ export const SlashKickCommand: SlashCommand = { name: "server", description: "The server to run the command on", choices: servers - .filter(s => s.ssh) + .filter(s => !!s.ssh) .map(s => { return { name: s.name, value: s.id }; }), diff --git a/app/services/discord/modules/commands/developer/Lua.ts b/app/services/discord/modules/commands/developer/Lua.ts index 7bf339fa..64e14ffc 100644 --- a/app/services/discord/modules/commands/developer/Lua.ts +++ b/app/services/discord/modules/commands/developer/Lua.ts @@ -22,7 +22,7 @@ export const SlashLuaCommand: SlashCommand = { name: "server", description: "The server to run the code on", choices: servers - .filter(s => s.ssh) + .filter(s => !!s.ssh) .map(s => { return { name: s.name, value: s.id }; }), diff --git a/app/services/discord/modules/commands/developer/RefreshLua.ts b/app/services/discord/modules/commands/developer/RefreshLua.ts index 0aebba55..7e62d287 100644 --- a/app/services/discord/modules/commands/developer/RefreshLua.ts +++ b/app/services/discord/modules/commands/developer/RefreshLua.ts @@ -20,7 +20,7 @@ export const SlashRefreshLuaCommand: SlashCommand = { name: "server", description: "The server to run the command on", choices: servers - .filter(s => s.ssh) + .filter(s => !!s.ssh) .map(s => { return { name: s.name, value: s.id }; }), diff --git a/app/services/discord/modules/commands/developer/UnBan.ts b/app/services/discord/modules/commands/developer/UnBan.ts index dd001747..e2d621d2 100644 --- a/app/services/discord/modules/commands/developer/UnBan.ts +++ b/app/services/discord/modules/commands/developer/UnBan.ts @@ -27,7 +27,7 @@ export const SlashUnBanCommand: SlashCommand = { name: "server", description: "The server to run the command on", choices: servers - .filter(s => s.ssh) + .filter(s => !!s.ssh) .map(s => { return { name: s.name, value: s.id }; }),