2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-30 05:37:59 +00:00
This commit is contained in:
Wojciech Pawlik 2020-06-29 13:49:41 +02:00
parent 3d751b7704
commit e54719ad11
No known key found for this signature in database
GPG Key ID: 7D763FCB7B36ADB5
4 changed files with 11 additions and 4 deletions

View File

@ -81,6 +81,7 @@ const addCommandHandler = async (ctx) => {
'/removecommand <code>&lt;name&gt;</code>' +
' - to remove a command.',
Markup.keyboard([ [ `/addcommand -replace ${newCommand}` ] ])
.selective()
.oneTime()
.resize()
.extra(),

View File

@ -2,6 +2,7 @@
'use strict';
// Utils
const { inspect } = require('util');
const { displayUser, scheduleDeletion } = require('../../utils/tg');
const { html, lrm, TgHtml } = require('../../utils/html');
const { isMaster, isWarnNotExpired } = require('../../utils/config');
@ -21,7 +22,7 @@ const formatEntry = async (entry, defaultVal) => {
if (!entry || !entry.by_id) return html`${defaultVal}`;
const { first_name } = await getUser({ id: entry.by_id }) || {};
if (!first_name) return html`${lrm}${entry.reason} (${formatDate(entry.date)})`;
return html`${lrm};${entry.reason} (${first_name}, ${formatDate(entry.date)})`;
return html`${lrm}${entry.reason} (${first_name}, ${formatDate(entry.date)})`;
};
const formatWarn = async (warn, i) =>
@ -56,7 +57,7 @@ const getWarnsHandler = async ({ from, message, replyWithHTML }) => {
).then(scheduleDeletion());
}
const { targets } = parse(message);
const { flags, targets } = parse(message);
if (targets.length > 1) {
return replyWithHTML(
@ -74,6 +75,12 @@ const getWarnsHandler = async ({ from, message, replyWithHTML }) => {
).then(scheduleDeletion());
}
if (flags.has('raw') && from.status === 'admin') {
return replyWithHTML(
TgHtml.pre(inspect(theUser)),
).then(scheduleDeletion());
}
const header = html`${title(theUser)} ${displayUser(theUser)}`;
const banReason = optional(
html`🚫 <b>Ban reason:</b>`,

View File

@ -14,7 +14,6 @@ const { deleteJoinsAfter = '2 minutes' } = require('../../utils/config').config;
const addedToGroupHandler = require('./addedToGroup');
const antibotHandler = require('./antibot');
const antifloodHandler = require('./antiflood');
const checkLinksHandler = require('./checkLinks');
const commandButtons = require('./commandButtons');
const kickBannedHandler = require('./kickBanned');

View File

@ -47,4 +47,4 @@ export class TgHtml {
export const html = (raw: TemplateStringsArray, ...subs: Sub[]) =>
TgHtml.tag(raw, ...subs);
export const lrm = html`&#8206;`;
export const lrm = "\u200E";