fix failure dm

This commit is contained in:
mightypanders 2023-04-16 02:02:22 +02:00
parent f5be22fb6f
commit ddefd2ef2a

View File

@ -1,12 +1,12 @@
import { client } from "../.."
import { CustomError, errorCodes } from "../interfaces"
import { ExtendedClient } from "../structures/client"
export async function sendFailureDM(creatorMessage: string, creatorId?: string): Promise<void> {
if (!creatorId) throw new CustomError('No creator ID present', errorCodes.no_creator_id)
const creator = await client.users.fetch(creatorId)
console.log(`Creator ${JSON.stringify(creator)}`)
if (creator)
if (!creator.dmChannel)
await creator.createDM()
await creator.dmChannel?.send(creatorMessage)
export async function sendFailureDM(creatorMessage: string, client: ExtendedClient, creatorId?: string): Promise<void> {
if (!creatorId) throw new CustomError('No creator ID present', errorCodes.no_creator_id)
const creator = await client.users.fetch(creatorId)
console.log(`Creator ${JSON.stringify(creator)}`)
if (creator)
if (!creator.dmChannel)
await creator.createDM()
await creator.dmChannel?.send(creatorMessage)
}