Use resolveUser with whois

This commit is contained in:
Tarrgon
2025-09-12 08:32:59 -04:00
parent 8940c3d652
commit aa08477e9b
2 changed files with 10 additions and 7 deletions
+8 -5
View File
@@ -1,15 +1,18 @@
import { CommandInteraction, MessageFlags } from 'discord.js';
import { config } from '../config';
import { Database } from '../shared/Database';
import { getE621Alts } from './alt-utils';
import { resolveUser } from './discord-user-utils';
export async function handleWhoIsInteraction(interaction: CommandInteraction, idToUse: string, ephemeral = false) {
export async function handleWhoIsInteraction(interaction: CommandInteraction, valueToUse: string, ephemeral = false) {
if (ephemeral) await interaction.deferReply({ flags: [MessageFlags.Ephemeral] });
else await interaction.deferReply();
if (!interaction.guild) return interaction.editReply('This command must be used in a server');
const content = await getE621Alts(idToUse, interaction.guild!);
const user = await resolveUser(interaction.client, valueToUse, interaction.guild);
interaction.editReply(`<@${idToUse}>'s e621 and discord account(s):\n${content}`);
if (!user) return interaction.editReply('User not found.');
const content = await getE621Alts(user.id, interaction.guild!);
interaction.editReply(`<@${user.id}>'s e621 and discord account(s):\n${content}`);
}