Guide
Create a Plugin
Create a Plugin
Make a custom plugin
-
Install
@buttercatbot/core
and optionally@buttercatbot/logger
-
Create a new function of type
Plugin
import { Plugin } from '@buttercatbot/core'; export const myPlugin: Plugin = { name: 'My Cool Plugin', };
-
Optionally set up the logger
import { getLogger } from '@buttercatbot/logger'; const log = getLogger({ name: 'my-cool-plugin' });
-
Add whichever events you want to listen to
import { Plugin } from '@buttercatbot/core'; import { getLogger } from '@buttercatbot/logger'; const log = getLogger({ name: 'my-cool-plugin' }); export const myPlugin: Plugin = { name: 'My Cool Plugin', init: () => { log.info('My Cool Plugin has been initialized!'); }, onMessage: (args: MessageArgs) => { log.info(`${args.userState.username} sent ${args.message}`); }, };
-
You're done! You can now add whatever functionality you want to your plugin and publish it (or just keep it to yourself).