mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-23 18:38:05 +00:00
21 lines
483 B
JavaScript
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));
|
|
}
|
|
};
|