import { Message, MessageContent, FileContent } from 'eris'; import { Client } from '.'; export default class CmdContext { public client: Client; public message: Message; public args?: string[]; constructor(message: Message, args?: string[]) { this.message = message; this.args = args; } public async uniCreateMessage(content: MessageContent, file?: FileContent | FileContent[]) { if ([2, 3].includes(this.message.channel.type)) { const channel = await this.client.getDMChannel(this.message.author.id); if (!channel) throw new Error(`Unable to fetch DM channel for '${this.message.author.id}'.`); return channel.createMessage(content, file); } return this.message.channel.createMessage(content, file); } }