const GROUP_ID = SOME_GROUP_ID;
const mentionPattern = new RegExp(
String.raw`^(?:\[-${GROUP_ID}\|[^\]]+\])(?:[\s.,\'\"!?\-+]+|$)`,
'i'
);
vk.updates.on('message', (context, next) => {
if (context.isChat && !mentionPattern.test(context.text)) {
return;
}
if (context.text) {
context.text = context.text.replace(mentionPattern, '');
}
return next();
});