2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-24 02:47:48 +00:00

22 lines
524 B
JavaScript
Raw Normal View History

2017-10-02 12:09:44 +03:30
'use strict';
// Utils
const { scheduleDeletion } = require('../../utils/tg');
2017-10-02 12:09:44 +03:30
// DB
const { managesGroup } = require('../../stores/group');
2020-03-10 22:10:48 +01:00
/** @param { import('../../typings/context').ExtendedContext } ctx */
2018-02-17 22:19:00 +01:00
const linkHandler = async ({ chat, replyWithHTML }, next) => {
if (chat.type === 'private') {
return next();
}
const group = await managesGroup({ id: chat.id });
2017-10-02 12:09:44 +03:30
2019-04-06 21:01:35 +02:00
return replyWithHTML(group.link || ' <b>No link to this group</b>')
.then(scheduleDeletion());
2017-10-02 12:09:44 +03:30
};
module.exports = linkHandler;