feat(context.ts) Adding context class and getters and setters

This commit is contained in:
Jacob Nguyen
2022-03-04 00:48:11 -06:00
parent 3b8a7f3cbc
commit 707840bc76

27
src/handler/context.ts Normal file
View File

@@ -0,0 +1,27 @@
import type {
CommandInteraction,
Message
} from 'discord.js';
import { None, Option } from 'ts-results';
export class Context {
private msg: Option<Message> = None;
private interac: Option<CommandInteraction> = None;
constructor(message : Option<Message>, interaction: Option<CommandInteraction> ) {
this.msg = message;
this.interac = interaction
}
get messageUnchecked() {
return this.msg.unwrap();
}
get interactionUnchecked() {
return this.interac.unwrap();
}
get message() {
return this.msg;
}
get interaction() {
return this.interac;
}
}