add message util class

master
Matthew 2021-10-09 20:19:33 -04:00
parent 5e8a6c8837
commit 1422cdfc9a
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 10 additions and 0 deletions

10
src/util/MessageUtil.ts Normal file
View File

@ -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);
}
}