2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-23 18:38:05 +00:00
Thomas Rory Gummerson 758b924436
Type ctx
2020-03-13 22:00:30 +01:00

21 lines
483 B
JavaScript

'use strict';
const { updateGroup } = require('../../stores/group');
/** @param { import('../../typings/context').ExtendedContext } ctx */
module.exports = async (ctx, next) => {
if (!ctx.state.isMaster) return next();
const { id, username, title } = ctx.chat;
try {
const link = username
? `https://t.me/${username.toLowerCase()}`
: await ctx.exportChatInviteLink();
return updateGroup({ id, link, title });
} catch (err) {
return ctx.reply(String(err));
}
};