diff --git a/config.example.json b/config.example.json index 3e58c17..c4b5e99 100644 --- a/config.example.json +++ b/config.example.json @@ -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": [], diff --git a/handlers/commands/warn.js b/handlers/commands/warn.js index 5be2626..1993048 100644 --- a/handlers/commands/warn.js +++ b/handlers/commands/warn.js @@ -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)} warned ${link(userToWarn)} for:` + `\n\n${reason} (${warnCount.length}/${numberOfWarnsToBan})`, - replyOptions + { parse_mode: 'HTML', reply_markup } ); } catch (e) { // we don't expect an error diff --git a/handlers/messages/removeLinks.js b/handlers/messages/removeLinks.js index 741ac81..ed66328 100644 --- a/handlers/messages/removeLinks.js +++ b/handlers/messages/removeLinks.js @@ -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)} got warned! (${warnCount.length}/3)` + `\n\nReason: ${reason}`, - replyOptions + { parse_mode: 'HTML', reply_markup } )); } else { promises.push(bot.telegram.kickChatMember(chat.id, user.id));