mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
feat(context.ts) Adding context class and getters and setters
This commit is contained in:
27
src/handler/context.ts
Normal file
27
src/handler/context.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user