Skip to content

Extending CommandContext

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

This is possible in 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.

import { Client, extendContext } from 'seyfert';
const context = extendContext((interaction) => {
//here you can handle your custom context with the interaction/message of your command
return {
myCoolProp: 'seyfert>>'
}
})
const client = new Client({ context });