mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 06:05:22 +00:00
Added support for plugins
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"master": 123456789, // master admin ID as a number or username as astring.
|
"master": 123456789, // master admin ID as a number or username as astring.
|
||||||
"token": "", // bot token.
|
"token": "", // bot token.
|
||||||
|
"plugins": [], // list of plugin names to be loaded
|
||||||
"numberOfWarnsToBan": 3, // Number of warns that will get someone banned.
|
"numberOfWarnsToBan": 3, // Number of warns that will get someone banned.
|
||||||
"groupsInlineKeyboard": [], // [[inlineButton]] -> inline keyboard to be added to reply to /groups
|
"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.
|
"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(
|
bot.use(
|
||||||
require('./handlers/middlewares'),
|
require('./handlers/middlewares'),
|
||||||
require('./handlers/messages'),
|
require('./handlers/messages'),
|
||||||
|
require('./plugins'),
|
||||||
require('./handlers/commands'),
|
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);
|
Reference in New Issue
Block a user