2017-10-02 12:09:44 +03:30
|
|
|
|
'use strict';
|
|
|
|
|
|
2017-10-02 12:35:40 +03:30
|
|
|
|
// Bot
|
|
|
|
|
const bot = require('../../bot');
|
|
|
|
|
|
2017-10-02 12:09:44 +03:30
|
|
|
|
// DB
|
|
|
|
|
const { managesGroup } = require('../../stores/group');
|
|
|
|
|
|
|
|
|
|
const linkHandler = async ({ chat, replyWithHTML }) => {
|
2017-10-08 13:19:11 +03:30
|
|
|
|
const group = await managesGroup({ id: chat.id });
|
2017-10-02 12:09:44 +03:30
|
|
|
|
|
2017-10-02 12:35:40 +03:30
|
|
|
|
const { message_id } = await replyWithHTML(
|
2017-10-02 12:09:44 +03:30
|
|
|
|
'ℹ️ <b>Group\'s link:</b>\n\n' +
|
|
|
|
|
`<a href="${group.link}">${group.title}</a>`
|
|
|
|
|
);
|
2017-10-02 12:35:40 +03:30
|
|
|
|
return setTimeout(() =>
|
|
|
|
|
bot.telegram.deleteMessage(chat.id, message_id), 5 * 60 * 1000);
|
2017-10-02 12:09:44 +03:30
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = linkHandler;
|