N
N
NoFail332020-05-15 20:35:47
JavaScript
NoFail33, 2020-05-15 20:35:47

Why is the person not kicking?

Hello, I did a kick for the VK bot, but it does not kick. What should I do? And how can I make it possible to kick /kick, and not !kick

vk.updates.hear(/^(?:!kick)(\s?https\:\/\/vk\.com\/)?(id)?([0-9]+)?([^]+)?/i, (message) => { 
  let user = users.users[message.user];
  if(user.admin_level < 1) return;

  if(message.$match[4]) { 
    var domain = message.$match[4].split(" "); 
    vk.api.call("utils.resolveScreenName", { 
    screen_name: message.$match[4] 
  }).then((res) => { 
    new_user(res.object_id);
    if(users.users[res.object_id].admin_level == 2) return message.reply('Отказ'); 
    vk.api.call("messages.removeChatUser", {chat_id: message.chatId, user_id: res.object_id })
    .catch((error) => {return message.send(`Error.`);
    });  
    return  
    })  
  }else{
    if(!message.$match[3]) return message.reply("ID пользователя не указан"); 
    new_user(message.$match[3]);
    if(users.users[message.$match[3]].admin_level == 2) return message.reply('Отказ'); 
    vk.api.call("messages.removeChatUser", { chat_id: message.chatId, user_id: message.$match[3] }).
    catch((error) => {return message.send(`Error.`);}); 
    return  				
  } 
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NoFail33, 2020-05-16
@NoFail33

Correction in kick, I found how it kicks, but you need to enter the person's id, can you somehow do it so that it is @? Also to change from ! on / relevant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question