Answer the question
In order to leave comments, you need to log in
How to make the bot react to @ or *?
How to make the bot respond to @ or *?
Answer the question
In order to leave comments, you need to log in
An example is given using "vk-io". The implementation was available somewhere on this site, found, tested. Works.
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();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question