Skip to main content

💬 Session CustomId Codec

The SessionCustomIdCodec is the object responsible for encoding and decoding sessions custom ids. That is, custom ids that refer to sessions. With this object you can easily create components that will update sessions when they are used. It's stored by a SessionManager, and you can get it via SessionManager#getCustomIdCodec().

👷 Creation

You can create a session custom ID codec by either:

  • Extending DefaultSessionCustomIdCodec from @framework (recommended).
  • Implementing the SessionCustomIdCodec interface from @core.
import { DefaultSessionCustomIdCodec } from '@nyx-discord/framework';

class MySessionCustomIdCodec extends DefaultSessionCustomIdCodec {
// ...
}

const myCodec = new MySessionCustomIdCodec();

const myBot = Bot.create((bot) => ({
sessions: DefaultSessionManager.create(bot, { customIdCodec: myCodec }),
}));