jellyfin-discord-bot/server/helper/sendFailureDM.ts
mightypanders 66f843b399
All checks were successful
Compile the repository / compile (pull_request) Successful in 1m12s
format more files
2023-06-24 21:09:56 +02:00

13 lines
543 B
TypeScript

import { CustomError, errorCodes } from "../interfaces"
import { ExtendedClient } from "../structures/client"
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)
}