Skip to content

Commit

Permalink
Fix admin queue list (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklhut authored Dec 31, 2023
1 parent c514e47 commit c321b7b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/commands/admin/queue/list.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -48,10 +48,15 @@ const command: Command = {
const position = queueData.getPosition(e.discord_id) + 1;
const joined_at = `<t:${Math.round((+e.joinedAt) / 1000)}:f>`;
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}` : ""),
Expand Down

0 comments on commit c321b7b

Please sign in to comment.