Attempt to resolve usernames
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user