Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const evk = require('easyvk');
- evk({
- username: "USERNAME",
- password: "PASSWORD",
- session_file: __dirname + "/my-session",
- }).then(async (vk) => {
- let {connection} = await vk.longpoll.connect();
- let {client} = await vk.http.loginByForm();
- connection.on("message", (msg) => {
- msg = {
- id: msg[0],
- out: msg[2] & 2,
- text: msg[5],
- peer_id: msg[3]
- }
- if (msg.peer_id > 2000000000) {
- return botProcessReply(msg);
- }
- });
- async function botProcessReply (msg) {
- let commandMatched = msg.text.toLowerCase().match(/^добавить\s(.*)/);
- if (commandMatched && Number(commandMatched[1]) > 0) {
- client.addBotToConf({
- group_id: commandMatched[1],
- peer_id: msg.peer_id
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement