Difference between revisions of "Bot Playground/Commands/listGroups"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Returns a list of the Second Life groups the bot is member of.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.listGroups(...")
 
 
(One intermediate revision by the same user not shown)
Line 25: Line 25:
 
See "Examples" section below for details.
 
See "Examples" section below for details.
  
 +
'''Important:''' groups list order is always random.
  
 
{{API Variables Table End}}
 
{{API Variables Table End}}
Line 47: Line 48:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Output:
 +
 +
<pre>
 +
022df06c-b616-d400-fd94-8ccc523c5ae2: Get Paid in Second Life
 +
9590cad7-3b63-88d6-0d06-d75b04698ec1: PicMe Poses
 +
0ec6f039-1a39-339c-3c68-e31ed2dc703f: Earn2Life.com Discount Shops
 +
</pre>
  
 
=== Random Group Tag Activator ===
 
=== Random Group Tag Activator ===

Latest revision as of 18:57, 13 July 2016

Returns a list of the Second Life groups the bot is member of.

Bot.listGroups().then(function(result) { ... });

Reference

This command accepts the following parameters:

Variable Required Description


Input:
-- none --
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed
groups The object which contains all groups. Format:
{
  "uuid-1": "group-name-1",
  "uuid-2": "group-name-2",
  ...
}

See "Examples" section below for details.

Important: groups list order is always random.

Examples

List all groups

Print all bot groups:

Bot.listGroups()
.then(function(result) {
	var list = "";
	
	for(var k in result.groups) {
		list = list + k + ": " + result.groups[k] + "\n";
	}
	
	console.log(list);
	
	exit();
});

Output:

022df06c-b616-d400-fd94-8ccc523c5ae2: Get Paid in Second Life
9590cad7-3b63-88d6-0d06-d75b04698ec1: PicMe Poses
0ec6f039-1a39-339c-3c68-e31ed2dc703f: Earn2Life.com Discount Shops

Random Group Tag Activator

See this example here.