balance_changed

From SmartBots Developers Docs
Bot PlaygroundEvents
Revision as of 12:50, 1 July 2016 by Phil (Talk | contribs) (Created page with "{{DISPLAYTITLE:balance_changed}} <onlyinclude>Fires when bot receives or payd money</onlyinclude> <syntaxhighlight lang="javascript"> Bot.on("balance_changed", function(event...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Fires when bot receives or payd money

Bot.on("balance_changed", function(event) { ... });

Reference

This event comes with the following event object:

Variable Required Description
Output:
name The name of the event in this case balance_changed
amount The amount which was paid or received.
direction The direction of the money flow, can be INCOMING or OUTGOING
source The UUID of the money sender
destination The UUID of the money receiver
balance The current balance after the payment
trx_type The transaction type

Example

Bot.on("balance_changed", function(event) {
	console.log("Balance changed, my new balance is: " + event.balance);
});

console.log("Bot is listening to payments");