diff --git a/handlers/commands/addCommand.js b/handlers/commands/addCommand.js index 24aa57b..a1d6084 100644 --- a/handlers/commands/addCommand.js +++ b/handlers/commands/addCommand.js @@ -81,6 +81,7 @@ const addCommandHandler = async (ctx) => { '/removecommand <name>' + ' - to remove a command.', Markup.keyboard([ [ `/addcommand -replace ${newCommand}` ] ]) + .selective() .oneTime() .resize() .extra(), diff --git a/handlers/commands/user.js b/handlers/commands/user.js index b73c246..517b35e 100644 --- a/handlers/commands/user.js +++ b/handlers/commands/user.js @@ -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`🚫 Ban reason:`, diff --git a/handlers/middlewares/index.js b/handlers/middlewares/index.js index ca22784..bd0480c 100644 --- a/handlers/middlewares/index.js +++ b/handlers/middlewares/index.js @@ -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'); diff --git a/utils/html.ts b/utils/html.ts index 4139f3a..47ed7c8 100644 --- a/utils/html.ts +++ b/utils/html.ts @@ -47,4 +47,4 @@ export class TgHtml { export const html = (raw: TemplateStringsArray, ...subs: Sub[]) => TgHtml.tag(raw, ...subs); -export const lrm = html`‎`; +export const lrm = "\u200E";