Skip to content

[TypeScript] How to get command from context? #1952

Answered by MKRhere
hashfi-motion asked this question in Q&A
Discussion options

You must be logged in to vote

Also realise bot.action(/.*/, _before) will NOT have ctx.command. It's probably better you extract the common logic out of _before, then call it like so:

bot.command(/.*/, ctx => {
  return commonHandler(ctx.command, ...);
});

bot.action(/.*/, ctx => {
	return commonHandler(ctx.match, ...);
});

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@hashfi-motion
Comment options

@MKRhere
Comment options

@MKRhere
Comment options

Answer selected by hashfi-motion
@hashfi-motion
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants