mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
Turn this into a function
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user