Turn this into a function

This commit is contained in:
Tarrgon
2026-07-06 21:48:52 -04:00
parent a67adb1e6c
commit 99d38c6fbd
7 changed files with 20 additions and 44 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
import { Client, Guild, User } from 'discord.js';
import { Client, Guild, MessageMentions, User } from 'discord.js';
import { Database, PrivateHelpTicketStatus } from '../shared/Database';
export async function resolveUser(client: Client, value: string, guild: Guild | null = null): Promise<User | null | undefined> {
@@ -27,6 +27,12 @@ export async function resolveUser(client: Client, value: string, guild: Guild |
return user;
}
export function getIdFromInput(input: string): string {
const matches = new RegExp(MessageMentions.UsersPattern).exec(input);
return matches ? matches.groups!.id : input;
}
export async function canOpenPrivateHelpTicket(id: string): Promise<boolean> {
const latestTicket = await Database.getLatestPrivateHelpTicketBy(id);