The parsed arguments that your Command received when called
The user that triggered the Command
The Client instance your Command is registered with
The command this context is for
The Discord.js Message that triggered the Command
Utility function to get the channel the context message was sent in while allowing the passing of a channel type parameter to clean up channel typecasting (which can be a bother and often looks bad).
Consider the following:
const authorPerms: Readonly<Permissions> = (ctx.message.channel as TextChannel)
.permissionsFor?.(ctx.message.author) ?? new Permissions();
compared to:
const authorPerms: Readonly<Permissions> = ctx
.channel<TextChannel>()
.permissionsFor?.(ctx.message.author) ?? new Permissions();
Doesn't the second implementation look much cleaner? I sure think so! What? Function call overhead? Perf? What are those??
Generated using TypeDoc
Represents the context in which a Command is called