-
Notifications
You must be signed in to change notification settings - Fork 163
Plugins
Martin edited this page Sep 18, 2023
·
6 revisions
Plugins let you extend the bot with new functionality without touching the source code of the bot.
To use a plugin, put it in the /plugins directory and add its name
to plugins
array in config.js
.
If plugins
is undefined, no plugins are loaded.
However, this behaviour may change, don't rely on it.
If you want no plugins to be loaded, explicitly set it to an empty array.
A plugin is basically "requirable"
(TS or JS file, or directory with index.js
)
which exports a valid Telegraf handler
(usually function or Composer
instance).
Plugins are similar to [micro-bot] bots.
'use strict';
const { Composer } = require('telegraf');
module.exports = Composer.command('ping', (ctx, next) =>
ctx.reply('Pong!'));
See the the-guard-bot-plugins repository for examples
Need help with The Guard? Join our Support Chat.