From 707840bc76a493bf1e81f226e54647b51fde506a Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Fri, 4 Mar 2022 00:48:11 -0600 Subject: [PATCH] feat(context.ts) Adding context class and getters and setters --- src/handler/context.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/handler/context.ts diff --git a/src/handler/context.ts b/src/handler/context.ts new file mode 100644 index 0000000..170b050 --- /dev/null +++ b/src/handler/context.ts @@ -0,0 +1,27 @@ +import type { + CommandInteraction, + Message +} from 'discord.js'; +import { None, Option } from 'ts-results'; + +export class Context { + private msg: Option = None; + private interac: Option = None; + + constructor(message : Option, interaction: Option ) { + 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; + } +}