From c321b7b17fdb2a7043c4fc8bd2d1a8556ed6f4ab Mon Sep 17 00:00:00 2001 From: niklhut <49069026+niklhut@users.noreply.github.com> Date: Sun, 31 Dec 2023 01:07:09 +0100 Subject: [PATCH] Fix admin queue list (#49) --- src/commands/admin/queue/list.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/commands/admin/queue/list.ts b/src/commands/admin/queue/list.ts index 59e1fa5..513ca38 100644 --- a/src/commands/admin/queue/list.ts +++ b/src/commands/admin/queue/list.ts @@ -1,4 +1,4 @@ -import { ApplicationCommandOptionType, EmbedField, Message } from "discord.js"; +import { ApplicationCommandOptionType, EmbedField, GuildMember, Message } from "discord.js"; import { Command } from "../../../../typings"; import { GuildModel } from "../../../models/guilds"; @@ -48,10 +48,15 @@ const command: Command = { const position = queueData.getPosition(e.discord_id) + 1; const joined_at = ``; const intent = e.intent; - const member = await g.members.fetch(e.discord_id); + let member: GuildMember | null; + try { + member = await g.members.fetch(e.discord_id); + } catch (error) { + member = null; + } fields.push({ - name: member.displayName, value: - `-Mention: ${member}` + name: member?.displayName ?? "unknown", value: + `-Mention: ${member ?? "unknown"}` + `\n-Position: ${position}` + `\n-joined at: ${joined_at}` + (intent ? `\n-intent: ${intent}` : ""),