mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-28 04:37:52 +00:00
22 lines
524 B
JavaScript
22 lines
524 B
JavaScript
'use strict';
|
||
|
||
// Utils
|
||
const { scheduleDeletion } = require('../../utils/tg');
|
||
|
||
// DB
|
||
const { managesGroup } = require('../../stores/group');
|
||
|
||
/** @param { import('../../typings/context').ExtendedContext } ctx */
|
||
const linkHandler = async ({ chat, replyWithHTML }, next) => {
|
||
if (chat.type === 'private') {
|
||
return next();
|
||
}
|
||
|
||
const group = await managesGroup({ id: chat.id });
|
||
|
||
return replyWithHTML(group.link || '️ℹ️ <b>No link to this group</b>')
|
||
.then(scheduleDeletion());
|
||
};
|
||
|
||
module.exports = linkHandler;
|