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...") |
m (Gg moved page Bot Playground/Setting and revoking group roles to Bot Playground/Examples/Setting and revoking group roles) |
||
(2 intermediate revisions by the same user not shown) | |||
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"> | ||
Line 35: | Line 35: | ||
}, 1000); | }, 1000); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | {{NavMenu}} |
Latest revision as of 08:15, 1 November 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);