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

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Retrieves the current bot's L$ balance.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.getMoney(function(result) { cons...")
 
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.getMoney(function(result) {
+
Bot.getBalance(function(result) {
 
   console.log("I have L$" + result.balance);
 
   console.log("I have L$" + result.balance);
 
});
 
});
Line 11: Line 11:
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.getMoney()
+
Bot.getBalance()
 
   .then(function(result) {
 
   .then(function(result) {
 
     console.log("I have L$" + result.balance);
 
     console.log("I have L$" + result.balance);
Line 27: Line 27:
 
{{API Variables Table End}}
 
{{API Variables Table End}}
  
== Error messages ==
+
== Examples ==
  
For a comprehensive balance management script check the Examples section.
+
For a comprehensive balance management script check the [[Bot_Playground/Examples/Working_with_bot_money_balance|code in Examples section]].
 +
 
 +
== See also ==
 +
 
 +
* [[Bot_Playground/Commands/giveMoney|giveMoney()]]
  
 
{{NavMenu}}
 
{{NavMenu}}
 
__NOTOC__
 
__NOTOC__

Latest revision as of 06:29, 2 November 2016

Retrieves the current bot's L$ balance.

Bot.getBalance(function(result) {
  console.log("I have L$" + result.balance);
});

or using a Promise:

Bot.getBalance()
  .then(function(result) {
    console.log("I have L$" + result.balance);
  });


Reference

This command accepts the following parameters:

Variable Required Description


getBalance:
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed

Examples

For a comprehensive balance management script check the code in Examples section.

See also