2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-09-03 07:35:17 +00:00

Used new quietLink instead of link in /staff

1. It doesn't mention admins
2. It's more reliable (inline mentiones sometimes don't work)
This commit is contained in:
GingerPlusPlus
2017-10-22 17:33:21 +02:00
parent 0d52ff3e76
commit b0075f2065
2 changed files with 10 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
// Utils
const { link } = require('../../utils/tg');
const { quietLink } = require('../../utils/tg');
// DB
const { getAdmins } = require('../../stores/user');
@@ -9,12 +9,13 @@ const { getAdmins } = require('../../stores/user');
const staffHandler = async ctx => {
const admins = await getAdmins();
const links = admins.map(link);
const links = admins.map(quietLink);
const list = links.map(s => `${s}`).join('\n');
return ctx.replyWithHTML(`<b>Admins in the network:</b>\n\n${list}`, {
disable_notification: true,
disable_web_page_preview: true,
});
};

View File

@@ -6,6 +6,11 @@ const escapeHtml = s => s
const link = ({ id, first_name }) =>
`<a href="tg://user?id=${id}">${escapeHtml(first_name)}</a>`;
const quietLink = (user) =>
user.username
? `<a href="t.me/${user.username}">${escapeHtml(user.first_name)}</a>`
: link(user);
/**
* @param {number} ms
* Deletes messages after (ms) milliseconds
@@ -19,5 +24,6 @@ const deleteAfter = ms => ctx =>
module.exports = {
deleteAfter,
escapeHtml,
link
link,
quietLink,
};