Answer the question
In order to leave comments, you need to log in
How to extract 2nd word of sentence in hearCommand?
B vk.updates.hear
used to extract words from a sentence. It doesn't come out like that. message.$match[1]
hearCommand
Answer the question
In order to leave comments, you need to log in
In the examples, hearCommand is a very simple wrapper around vk.updates.hear . In implementation, it works like this:
hearCommand('test', (context) => {});
// Аналогична данной запись
vk.updates.hear(
[
(text, { state }) => (
state.command === 'test'
),
'/test'
],
(context) => {}
);
hearCommand('test', /test (.+)/i, (context) => {});
// Аналогична данной запись
vk.updates.hear(
[
(text, { state }) => (
state.command === 'test'
),
/test (.+)/i
],
(context) => {}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question