2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-30 21:55:17 +00:00
This commit is contained in:
Wojciech Pawlik
2020-06-29 13:49:41 +02:00
parent 3d751b7704
commit e54719ad11
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>' + '/removecommand <code>&lt;name&gt;</code>' +
' - to remove a command.', ' - to remove a command.',
Markup.keyboard([ [ `/addcommand -replace ${newCommand}` ] ]) Markup.keyboard([ [ `/addcommand -replace ${newCommand}` ] ])
.selective()
.oneTime() .oneTime()
.resize() .resize()
.extra(), .extra(),

View File

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

View File

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

View File

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