Added bots methods

This commit is contained in:
Richard Davey 2018-08-07 04:32:26 +01:00
parent 9399f32de0
commit 80dcb601c7

View file

@ -73,6 +73,7 @@ var FacebookInstantGamesPlugin = new Class({
this.playerID = null;
this.playerName = null;
this.playerPhotoURL = null;
this.playerCanSubscribeBot = false;
this.paymentsReady = false;
this.catalog = [];
@ -336,6 +337,41 @@ var FacebookInstantGamesPlugin = new Class({
return this;
},
canSubscribeBot: function ()
{
if (this.supportedAPIs.playerCanSubscribeBotAsync)
{
var _this = this;
FBInstant.player.canSubscribeBotAsync().then(function ()
{
_this.playerCanSubscribeBot = true;
_this.emit('cansubscribebot');
});
}
return this;
},
subscribeBot: function ()
{
if (this.playerCanSubscribeBot)
{
var _this = this;
FBInstant.player.subscribeBotAsync().then(function ()
{
_this.emit('subscribebot');
}).catch(function ()
{
_this.emit('subscribebotfailed');
});
}
return this;
},
getData: function (keys)
{
if (!this.checkAPI('playerGetDataAsync'))