Created
April 2, 2017 08:08
-
-
Save nguyenphucbao68/6fb2257043fc9954673c3c2cc3ecfddc to your computer and use it in GitHub Desktop.
Function Kick Member From Group
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kickmem(info){ | |
var link = JSON.parse(JSON.stringify(info)); | |
fetch("LINK CỦA BẠN/?link=" + link.linkUrl).then(function(res){ | |
return res.json() | |
}).then(function(ress){ | |
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { | |
chrome.tabs.sendMessage(tabs[0].id, {jack: 'KickMember', idUser: ress.fbid}, function(res) { //giao tiếp giữa 2 môi trường Extension của Chrome | |
if(res.kicked == 1){ //Nếu kick thành công - hiện thông báo | |
chrome.tabs.sendMessage(tabs[0].id, {jack: 'AlertKickSuccess'}); | |
}else{ // Kick không thành công - hiện thông báo gì đó | |
chrome.tabs.sendMessage(tabs[0].id, {jack: 'AlertKickFailure'}); | |
} | |
}) | |
}) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment