Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/oasis/packages/framework/classes/Context.ts>Context

An object oriented Discordeno framework
Latest
class Context
implements ContextFunctions
import { Context } from "https://deno.land/x/oasis@2.1.0/packages/framework/classes/Context.ts";

The Oasis Context class

Constructors

new
Context(
prefix: string,
bot: T,
message?: Message,
interaction?: Interaction,
)

Type Parameters

optional
T extends Bot = Bot

Properties

readonly
bot: T

The bot can be modified with a middleware before passing it to the Context class So Context.bot is generic but readonly

readonly
optional
channelId: bigint

The channel the command has been triggered on

readonly
optional
guildId: bigint

The guild the command has been triggered on

readonly
optional
interactionContext: InteractionContext
readonly
isBot: boolean

If the one who ran the command is a bot

readonly
optional
messageContext: MessageContext

The options handler with utility methods

readonly
prefix: string
readonly
rawOptions: OasisCommandInteractionOption[]

The raw options from the interaction

readonly
optional
userId: bigint

Whoever ran the command

Methods

Defer the reply, returns nothing

getCommandName(force: true): string

get the name of the command that has been triggered

getCommandName(force?: boolean): string | undefined

Responds to the user

respondPrivately(data: CreateCommand & { time?: number; })

Responds privately to the user