StreamLabs Points sync


#1

according to StreamLabs API docs they give full access to points in their API and you guys already have the donations syncing so I want to suggest syncing Phantombots points with streamlabs so those of us using this bot instead of others can take advantage of Streamlabs rewards system with the points. I know we can already Import via CVS files into streamlabs but this would make things alot better IMHO instead of having to import CVS files. the docs for the points via their api is here https://dev.streamlabs.com/v1.0/reference#points


Exchange Phantombot Currency for StreamElements Loyalty Points
#2

This is harder to do than syncing donations. Donations don’t update all the time, we pull the API every 30 seconds since it’s unlikely you’ll be getting them more often. Points on the other hand change all the time, let’s say you have a large channel, we need to pull hundreds, or more of users all the time. This puts a large stane on the bot and it’s performance. The bot would be harder on your cpu and use a lot more memory. We’d also need to update the points on streamlabs’ end each time a user plays a game, or their points changes on PhantomBot’s side. The only way I can see of doing this would be to only pull the points of a user when needed, saving all points in the database is basically impossible, for a small channel sure, it’s easy, but for larger ones it’s not simple. We’ve discussed this before in the team, there were mixed opinions, so I can’t say of this will be added or not.

Hope you understand!


#3

Yep I understand I have ran servers and program some languages myself, just don’t understand java lol hence the feature request. maybe if you all do do this make it clear it can be intense on the server resources for large channels or something so we can decide ourselves if we want to enable it. those of us on dedicated servers for the bot could probably handle it better IMO. here is an Idea maybe give an option of a time interval to sync them or maybe even update the points at the end of a stream? would still be better than having to manually do it… and those with the resources could just keep them in sync.


#4

How about a compromise? Instead of in sync, which is a resource hog, I would like to propose a system where folks can exchange bot points for StreamLabs Loyalty points. The caster can set a minimum and exchange rate. Also, add the ability to use the “add to all” API call from chat (so mods could reward with StreamLabs Loyalty points, for example).

By allowing the caster to set minimums you won’t have people (hopefully) spamming chat every time they earn 5 points (unless you want them to) and if your bot is set to provide points at a different rate you could make 2 or 3 or 4 or 10 PhantomBot points worth 1 StreamLabs point.

Think of it as:

!exchangepoints 100
@SomeUser received 100 StreamLabs Loyalty points in exchange for their 100 pointsNameHere, they now have 150 StreamLabs Loyalty points.

Or if you have it set to 2:1

!exchangepoints 100
@SomeUser received 50 StreamLabs Loyalty points in exchange for their 100 pointsNameHere, they now have 100 StreamLabs Loyalty points.

Finally, if you want to gift points to all in chat (that StreamLabs detects, this is their API call):

!slgiftall 50
Everyone received 50 StreamLabs Loyalty points!

Then people could take advantage of the StreamLabs rewards system with points earned in PhantomBot.

Thoughts?


#5

That could be a nice compromise honestly and would work for everyone that uses the bot really. I just know those of us that use Streamlabs but use Phantom bot instead of their bot needs a way to use the rewards system :slight_smile:


#6

Love this idea! We have been trying to find a way to utilize the point system in a manner that would benefit our viewers … Absolutely love phantombot and being able to truly edit the adventures and commands to our liking.
But, there are some things we like about streamlabs … like having a store to actually use the points :crazy_face:


#7

Awesome idea would love to see this


#8

Been working on it. API calls are done. Working on the script side. Also reaching out to StreamLabs development with some suggestions to see what they think.


#9

I do not use StreamLabs overlay or loyalty points so, I only assume this works based on their API documentation. Drops into scripts/systems. Let me know what errors it has. Requires PhantomBot 2.4.2 which does have the built-in StreamLabs API calls in the Core.

https://raw.githubusercontent.com/IllusionaryOne/PhantomBotTestScripts/master/custom/SLpointSystem.js

The language file:

https://raw.githubusercontent.com/IllusionaryOne/PhantomBotTestScripts/master/custom/systems-SLpointSystem.js

slexchange [points] - Exchange points for StreamLabs points
slgiveall [amount] - Give StreamLabs loyalty points to all in chat.
slexchangerate [amount] - Set how many points exchange per StreamLabs loyalty point.
slexchangemin [amount] - Set the minimum number of points that may be exchanged.

If someone that uses StreamLabs Loyalty Points tells me it works, I will look at adding to the new Panel and including with the official build.


#10

only two i have had a issue with is these two below but ill continue testing

and

[11-12-2018 @ 15:42:33.098 GMT] dakoda: !slexchangemin 10
[11-12-2018 @ 15:42:33.104 GMT] [ERROR] [init.js:317] (hook.call, command, ./systems/SLpointSystem.js) ReferenceError: "minExchange" is not defined.

Error with debugon

[11-12-2018 @ 15:46:57.849 GMT] dakoda: !slgiveall 22
[11-12-2018 @ 15:46:58.434 GMT] [DEBUG] [readJsonFromUrl()@TwitchAlertsAPIv1.java:135] TwitchAlertsAPIv1::readJsonFromUrl::Exception: A JSONObject text must begin with ‘{’ at 1 [character 2 line 1]
[11-12-2018 @ 15:46:58.443 GMT] [DEBUG] [onEvent()@ScriptEventManager.java:77] Dispatched event CommandEvent
[11-12-2018 @ 15:46:58.460 GMT] [DEBUG] [onEvent()@ScriptEventManager.java:77] Dispatched event IrcModerationEvent
[11-12-2018 @ 15:46:58.445 GMT] [CHAT] @Dakoda, Sorry, an error occurred talking to StreamLabs. Try again later.
[11-12-2018 @ 15:46:58.468 GMT] [DEBUG] [onEvent()@ScriptEventManager.java:77] Dispatched event IrcChannelMessageEvent
[11-12-2018 @ 15:46:58.470 GMT] [DEBUG] [onPrivMsg()@TwitchWSIRCParser.java:324] IRCv3 Tags: {user-type=, tmi-sent-ts=1542037617504, mod=0, subscriber=0, color=#FFFF00, turbo=0, user-id=133782556, flags=, badges=broadcaster/1, room-id=133782556, display-name=Dakoda, emotes=, id=a6bcf3fc-5d15-4a6f-b03d-fe820cd8f347}


#11

with the 1 error above you need to have

minimumExchange = parseInt(args[0]);
$.setIniDbNumber('SLpointsSettings', 'exchangeRate', minExchange);

as

minimumExchange = parseInt(args[0]);
$.setIniDbNumber('SLpointsSettings', 'exchangeRate', minimumExchange);

EDIT
AddToAllPointsAPI() in the core it should be &value not &points as shown below i got it working


#12

I’ve done:

            minimumExchange = parseInt(args[0]);
            $.setIniDbNumber('SLpointsSettings', 'minExchange', minimumExchange);
            $.say($.whisperPrefix(sender) + $.lang.get('slpointsystem.slexchangemin.success', minimumExchange));

I also had the wrong key in place.

I have updated the core PR 2071


#13

As posted on twitter, I like this. I can see a good use of this style of system with integration into multiple other platforms if needed. That way the viewer can pick what they want to do.


#14

I’m still getting the error “Sorry, an error occurred talking to StreamLabs. Try again later.” Do I need to be running the nightly build to get it to work? Also, as a suggestion, can the points be both deposited and withdrawn? I know it’s deposit only currently. If the commands was !slexchange dep and !slexchange wtd . Or + - . Some viewers I’ve talked to about the bot stuff was asking. :sunglasses:


#15

Nightly is required, there was a patch to the API calls that was identified by Dakoda.


#16

Wonderful. So many DM’d me a couple of days before this about it.


#17

Ah, ty. Is there a way we can have the user withdraw points from SL also if needed?