diff --git a/src/util/MessageUtil.ts b/src/util/MessageUtil.ts new file mode 100644 index 0000000..e5785f9 --- /dev/null +++ b/src/util/MessageUtil.ts @@ -0,0 +1,10 @@ +import type { MessageContent } from 'eris'; +import type { Client } from '../class'; + +export default class MessageUtil { + static async sendDirectMessage(content: MessageContent, userID: string, client: Client) { + const dmChannel = await client.getDMChannel(userID); + if (!dmChannel) throw new Error(`DM Channel for user ${userID} doesn't exist.`); + return dmChannel.createMessage(content); + } +}