mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 06:05:22 +00:00
Added configurable inline keyboard in warn messages
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
|
||||
"deleteCommands": "own", // which messages with commands should be deleted?
|
||||
// valid options: "all", "own" (leave commands meant for other bots, this is the default), "none".
|
||||
|
||||
|
||||
"numberOfWarnsToBan": 3, // 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
|
||||
|
||||
// [String] -> list of channels or groups links/usernames that you want to be excluded from warnings
|
||||
// use "*" to disable this feature.
|
||||
"excludedChannels": [],
|
||||
|
@@ -5,7 +5,11 @@ const { link, scheduleDeletion } = require('../../utils/tg');
|
||||
const { logError } = require('../../utils/log');
|
||||
|
||||
// Config
|
||||
const { numberOfWarnsToBan } = require('../../config.json');
|
||||
const {
|
||||
numberOfWarnsToBan,
|
||||
warnsInlineKeyboard,
|
||||
} = require('../../config.json');
|
||||
const reply_markup = { inline_keyboard: warnsInlineKeyboard };
|
||||
|
||||
// Bot
|
||||
const bot = require('../../bot');
|
||||
@@ -61,7 +65,7 @@ const warnHandler = async ({ message, chat, reply, me, state }) => {
|
||||
await reply(
|
||||
`⚠️ ${link(user)} <b>warned</b> ${link(userToWarn)} <b>for:</b>` +
|
||||
`\n\n${reason} (${warnCount.length}/${numberOfWarnsToBan})`,
|
||||
replyOptions
|
||||
{ parse_mode: 'HTML', reply_markup }
|
||||
);
|
||||
} catch (e) {
|
||||
// we don't expect an error
|
||||
|
@@ -8,8 +8,11 @@ const { logError } = require('../../utils/log');
|
||||
const {
|
||||
excludedChannels,
|
||||
excludedGroups,
|
||||
numberOfWarnsToBan
|
||||
numberOfWarnsToBan,
|
||||
warnsInlineKeyboard,
|
||||
} = require('../../config.json');
|
||||
const reply_markup = { inline_keyboard: warnsInlineKeyboard };
|
||||
|
||||
|
||||
// Bot
|
||||
const bot = require('../../bot');
|
||||
@@ -120,7 +123,7 @@ const removeLinks = async ({ message, chat, reply, state }, next) => {
|
||||
promises.push(reply(
|
||||
`⚠️ ${link(user)} <b>got warned!</b> (${warnCount.length}/3)` +
|
||||
`\n\nReason: ${reason}`,
|
||||
replyOptions
|
||||
{ parse_mode: 'HTML', reply_markup }
|
||||
));
|
||||
} else {
|
||||
promises.push(bot.telegram.kickChatMember(chat.id, user.id));
|
||||
|
Reference in New Issue
Block a user