Difference between revisions of "Bot Playground/Examples/Setting and revoking group roles"
From SmartBots Developers Docs
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} This script demonstrates how to set and revoke the group roles (see setGroupRole and Bot_Playgroun...") |
|||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
− | This script demonstrates how to set and revoke the group roles (see [[Bot_Playground/Commands/setGroupRole|setGroupRole]] and [[Bot_Playground/Commands/revokeGroupRole|revokeGroupRole]] functions. | + | This script demonstrates how to set and revoke the group roles (see [[Bot_Playground/Commands/setGroupRole|setGroupRole]] and [[Bot_Playground/Commands/revokeGroupRole|revokeGroupRole]] functions). |
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> |
Revision as of 21:10, 31 October 2016
This script demonstrates how to set and revoke the group roles (see setGroupRole and revokeGroupRole functions).
var operation = "SET"; // SET or REVOKE
var AVATAR = "042536ca-dc19-45ef-bd3c-2f3c829d4e56";
var GROUP = "6c9ecdd2-dcd8-384d-00bc-57a5dc3e7396";
var ROLE = "ff37ff6a-595f-eff4-6ae2-6a5ec9ade464";
var promise;
console.log("The goal is to " + operation + " the group role");
switch(operation) {
case "SET":
promise = Bot.setGroupRole(AVATAR, GROUP, ROLE);
break;
case "REVOKE":
promise = Bot.revokeGroupRole(AVATAR, GROUP, ROLE);
break;
}
promise.then(function(result) {
console.log("Command result: " + JSON.stringify(result));
});
// Gracefully exit. We don't need to run anymore.
setTimeout(function() {
exit();
}, 1000);