N
N
NoFail332020-05-18 00:11:20
JavaScript
NoFail33, 2020-05-18 00:11:20

How to make a kick through @ in a bot?

Hello, how to make the kick was through @?

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question