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