Skip to content

Extending CommandContext

You may have encountered a situation when you want to receive custom data within Seyfert CommmandContext.

This is possible within Seyfert all you need to do is setting the context option when defining Seyfert’s client, which expects the data you want to add to the context to be returned in the first parameter callback of a function predefined by Seyfert called extendContext.

1
import { Client, extendContext } from 'seyfert';
2
3
const context = extendContext((interaction) => {
4
//here you can handle your custom context with the interaction/message of your command
5
6
return {
7
myCoolProp: 'seyfert>>'
8
}
9
})
10
11
const client = new Client({ context });