mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-30 05:37:59 +00:00
Added support for plugins
This commit is contained in:
parent
f08de28edd
commit
d98ba68cb7
@ -1,6 +1,7 @@
|
||||
{
|
||||
"master": 123456789, // master admin ID as a number or username as astring.
|
||||
"token": "", // bot token.
|
||||
"plugins": [], // list of plugin names to be loaded
|
||||
"numberOfWarnsToBan": 3, // Number of warns that will get someone banned.
|
||||
"groupsInlineKeyboard": [], // [[inlineButton]] -> inline keyboard to be added to reply to /groups
|
||||
"excludedChannels": [], // [String] -> list of channels usernames to be excluded from warnings, use "*" to disable this feature.
|
||||
|
1
index.js
1
index.js
@ -16,6 +16,7 @@ bot.telegram.getMe().then((botInfo) => {
|
||||
bot.use(
|
||||
require('./handlers/middlewares'),
|
||||
require('./handlers/messages'),
|
||||
require('./plugins'),
|
||||
require('./handlers/commands'),
|
||||
);
|
||||
|
||||
|
5
plugins/.gitignore
vendored
Normal file
5
plugins/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Ignore everything...
|
||||
*
|
||||
# except this file and index
|
||||
!.gitignore
|
||||
!index.js
|
10
plugins/index.js
Normal file
10
plugins/index.js
Normal file
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { compose } = require('telegraf');
|
||||
|
||||
const config = require('../config.json');
|
||||
const names = config.plugins || [];
|
||||
|
||||
const plugins = names.map(name => `./${name}`).map(require);
|
||||
|
||||
module.exports = compose(plugins);
|
Loading…
x
Reference in New Issue
Block a user