mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-29 13:17:56 +00:00
Changed default config file format from json to js
Put all the documentation as jsdoc in example.config.js. Leaving `numberOfWarnsToBan` without extra documentation, IMO it's obvious what it does and what's the expected type. Leaving documenting `excludeLinks` up to @poeti8, I don't know how it works.
This commit is contained in:
parent
6adac05442
commit
dd5b01f73e
74
CONFIG.md
74
CONFIG.md
@ -1,74 +0,0 @@
|
||||
# config.json format
|
||||
|
||||
This document describes the field in config.json.
|
||||
|
||||
Create config.json by running:
|
||||
|
||||
`cp example.config.json config.json`
|
||||
|
||||
in the project folder, then edit it.
|
||||
|
||||
## "master"
|
||||
|
||||
`number|string`
|
||||
|
||||
Master admin ID as a number or username as a string.
|
||||
|
||||
## "token"
|
||||
|
||||
`string`
|
||||
|
||||
Telegram Bot token obtained from [https://t.me/BotFather](@BotFather).
|
||||
|
||||
## "plugins"
|
||||
|
||||
`[string]`
|
||||
|
||||
List of plugin names to be loaded.
|
||||
|
||||
## "deleteCommands"
|
||||
|
||||
`string`
|
||||
|
||||
Which messages with commands should be deleted?
|
||||
|
||||
Options:
|
||||
|
||||
* "all"
|
||||
* "own" (default) - leave commands meant for other bots
|
||||
* "none"
|
||||
|
||||
## "numberOfWarnsToBan"
|
||||
|
||||
`number`
|
||||
|
||||
Number of warns that will get someone banned.
|
||||
|
||||
## "groupsInlineKeyboard"
|
||||
|
||||
`[[inlineButton]]`
|
||||
|
||||
inline keyboard to be added to reply to /groups.
|
||||
|
||||
## "warnInlineKeyboard"
|
||||
|
||||
`[[inlineButton]]`
|
||||
|
||||
Inline keyboard to be added to warn message.
|
||||
|
||||
## "excludedChannels"
|
||||
|
||||
`[string]`
|
||||
|
||||
List of channels that you want to be excluded from automatic warns.
|
||||
|
||||
Use `"*"` to disable.
|
||||
|
||||
## "excludedGroups"
|
||||
|
||||
`[string]`
|
||||
|
||||
List of groups that you want to be excluded from automatic warns.
|
||||
|
||||
Use `"*"` to disable.
|
||||
|
@ -14,7 +14,7 @@ You need [Node.js](https://nodejs.org/) (> 8.1) to run this bot.
|
||||
1. Create a bot via [@BotFather](https://t.me/BotFather) and grab a **token**.
|
||||
2. Clone this repository or [download zip](https://github.com/TheDevs-Network/the-guard-bot/archive/master.zip).
|
||||
3. Install dependencies via `npm install`.
|
||||
4. Copy `config.example.json` to `config.json`, fill it properly and remove comments.
|
||||
4. Copy `example.config.js` to `config.js` and edit it.
|
||||
5. Start the bot via `npm start`.
|
||||
|
||||
Now you can add the bot as **administrator** to your groups.
|
||||
|
71
example.config.js
Normal file
71
example.config.js
Normal file
@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* Create `config.js` by running `cp example.config.js config.js`
|
||||
* in the project folder, then edit it.
|
||||
*
|
||||
* Config file in JSON format (`config.json`) is also supported.
|
||||
* For backwards compatibility, and because why not, it needs no extra code.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* @type {!( number | string )}
|
||||
* ID (number) or username (string) of master,
|
||||
* the person who can promote and demote admins,
|
||||
* and add the bot to groups.
|
||||
*/
|
||||
master: 123456789,
|
||||
|
||||
/**
|
||||
* @type {!string}
|
||||
* Telegram Bot token obtained from https://t.me/BotFather.
|
||||
*/
|
||||
token: '',
|
||||
|
||||
|
||||
/**
|
||||
* @type {( 'all' | 'own' | 'none' )}
|
||||
* Which messages with commands should be deleted?
|
||||
* Defaults to 'own' -- don't delete commands meant for other bots.
|
||||
*/
|
||||
deleteCommands: 'own', // eslint-disable-line sort-keys
|
||||
|
||||
/**
|
||||
* @type {( number | string | false )}
|
||||
* Timeout before removing join and leave messages.
|
||||
* String to be parsed by https://npmjs.com/millisecond,
|
||||
* or number of milliseconds.
|
||||
* Pass 0 to remove immediately.
|
||||
* Pass false to never remove.
|
||||
*/
|
||||
deleteJoinsAfter: '2 minutes',
|
||||
|
||||
excludeLinks: [],
|
||||
|
||||
/**
|
||||
* @type {InlineKeyboardMarkup}
|
||||
* Inline keyboard to be added to reply to /groups.
|
||||
* We use it to display button opening our webpage.
|
||||
*/
|
||||
groupsInlineKeyboard: [],
|
||||
|
||||
numberOfWarnsToBan: 3,
|
||||
|
||||
/**
|
||||
* @type {string[]}
|
||||
* List of plugin names to be loaded.
|
||||
* See Readme in plugins directory for more details.
|
||||
*/
|
||||
plugins: [],
|
||||
|
||||
/**
|
||||
* @type {InlineKeyboardMarkup}
|
||||
* Inline keyboard to be added to warn message.
|
||||
* We use it to display button showing our rules.
|
||||
*/
|
||||
warnInlineKeyboard: [],
|
||||
};
|
||||
|
||||
Object.freeze(module.exports);
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"master": 123456789,
|
||||
"token": "",
|
||||
"plugins": [],
|
||||
"deleteCommands": "own",
|
||||
"deleteJoinsAfter": "2 minutes",
|
||||
"numberOfWarnsToBan": 3,
|
||||
"groupsInlineKeyboard": [],
|
||||
"warnInlineKeyboard": [],
|
||||
"excludeLinks": []
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user