send dm on failure to parse
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
mightypanders
2022-05-05 21:39:53 +02:00
parent 9ae406dfb3
commit f8afee69bd
3 changed files with 21 additions and 13 deletions

View File

@ -0,0 +1,12 @@
import { client } from "../.."
import { CustomError, errorCodes } from "../interfaces"
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)
}