Attempt to resolve usernames

This commit is contained in:
Tarrgon
2025-09-07 20:24:25 -04:00
parent a00f4a3830
commit c5868612cf
4 changed files with 20 additions and 16 deletions
+13
View File
@@ -0,0 +1,13 @@
import { Client, User } from 'discord.js';
export async function resolveUser(client: Client, value: string): Promise<User | null | undefined> {
let user: User | null | undefined = null;
try {
user = await client.users.fetch(value);
} catch (e) {
user = client.users.cache.find(u => u.username == value);
}
return user;
}
+3
View File
@@ -5,9 +5,12 @@ export * from './ban-events';
export * from './ban-utils';
export * from './channel-utils';
export * from './commands';
export * from './debug-utils';
export * from './discord-user-utils';
export * from './e621-utils';
export * from './event-log-utils';
export * from './file-utils';
export * from './github-user-utils';
export * from './interaction-utils';
export * from './message-utils';
export * from './ms-to-human';