#dev-chat

1 messages ยท Page 20 of 1

viral patrol
#

And delete this url

#

As somebody can play with your lamps

#

This channel is public accessible

sturdy socket
#

u right

#

welp

#

it doesnt seem to work

#

dm'd response

#

is it meant to be in the regex part

#

IT WORKS ๐Ÿ˜„

viral patrol
#

Ha. I love this channel. Today i created fortnite and lamps api ๐Ÿ˜‰

#

api calls*

sturdy socket
#

This is so cool ๐Ÿ˜„

#

now i can set a price and everything on it

viral patrol
#

Disco mode: $15

sturdy socket
#

and i think i know how to make it so people can spend more to run other commands now

#

YEAH

#

not for money but ๐Ÿ˜›

#

the currency

#

can do like !disco

#

and make it run the api page

#

or a new api page just with different setup for one of the other effects

#

omg this is so good

#

thankyou so much LX

#

๐Ÿ˜„

viral patrol
#

no problem mate

#

@static wigeon is it possible to get channel 'crappy php snippets' where we could share inventions? I updated spotify plugin and it is burried under tons of text

#

There is a channel for sfx

#

Also I made a "nice" (in my silly opinion) sub alert, and there's no place to share it

sturdy socket
#

so

#

its not erroring

#

ever

#

even if the string is invalid

#

on the hex

viral patrol
#

OK.

sturdy socket
viral patrol
#

Give me a error message

sturdy socket
#

my chat just broke it

viral patrol
#

an*

sturdy socket
#

it says success

#

i gotta change it back to print

viral patrol
#

Not like that

#

Give me error stack

#

I will remake it

sturdy socket
#

like swap back to print

#

so you get all the debug stuff

#

oh i know why

#

its cuase any response is success atm

viral patrol
#

Yup

#
<?php
$url='https://api.lifx.com/v1/lights/all/state';
$authToken = "API KEY";
$headers = array('Authorization: Bearer ' . $authToken);
if (isset($_GET['hex'])){
$data = array("power"=>"on","color" => '#'.$_GET['hex']);
}else if (isset($_GET['color'])){
$data = array("power"=>"on","color" => $_GET['color']);
}
else {
die('No color provided');
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($data));

$response = curl_exec($ch);

if (!$response) 
{
    die('error');
}
$status = json_decode($response,true);
if (isset($status['error'])) die ($status['error']);
else die ('Color set!');
}
sturdy socket
#

dreamweaver is saying unexpected exit

viral patrol
#

Ah...

sturdy socket
viral patrol
#

missing ")"

sturdy socket
#

ah

viral patrol
#

Does it work now with !color imaginary or !color red ?

sturdy socket
#

yeah it works with both color and hex

#

and both error correctly

#

could i make a store item run this

viral patrol
#

You can set up a price to call this command

sturdy socket
#

yeah

#

thats probably easiest

viral patrol
#

I am not sure if store items can run api calls

sturdy socket
#

was just thinking in the extension

#

@static wigeon can store items do api calls yet ๐Ÿค”

viral patrol
#

If you decide to do a store item:

  1. create a new item
  2. create a variation of redemption for that item
  3. add an api call in variation custom css
sturdy socket
#

nah

#

redemptions alerts doesnt have custom css

static wigeon
#

Store items can't do api calls, but you can hook into the websockets to get events when items are redeemed.

sturdy socket
#

ah yep

#

sticking to the chat command then LUL

viral patrol
#

Ah, neither variations nor custom js/css

sturdy socket
#

ye

viral patrol
#

But... You can assign "disco" to donations or subs

sturdy socket
#

yeah

#

already got a variation on my subs atm

#

and follows

#

where it strobes green

#

making me chroma

crimson hare
#

Hi mates! Do you know what is your API rate limit?

sturdy socket
#

quick ddos them Keepo

static wigeon
#

Well.

sturdy socket
#

ohhhh

static wigeon
#

Take everything with a grain of salt

crimson hare
#

@static wigeon Bless you, man

livid lotus
#

documentation ๐Ÿ‘€

static wigeon
#

@low sierra ๐Ÿ‘€

sturdy socket
#

D

#

O

#

C

#

U

#

M

#

E

#

N

#

T

#

A

#

T

#

I

#

O

#

N

viral patrol
static wigeon
#

If you wanna contribute documentation or code samples feel free

viral patrol
#

This one I saw too. I want to be a coder with helmet, so you can smash my head for coding php ๐Ÿ˜‰

sturdy socket
#

made a new command to power the lights on and off in the script

#

this gon bee good

viral patrol
#

IoT

sturdy socket
#

now to set it up so they can only use it while im live so they dont go waking me up

viral patrol
#

!temperature - will set up temperature in my room
!sprinkles - will turn sprinkles on
!window - will open/shut my window
!tesla - will send my car to provided gps coordinates (mainland only)
!nuke - will geolocate you and trigger nuke from nearest location to you - home delivery!

sturdy socket
#

hahahahaa

#

so many ideas now with API's

#

for stuff

livid lotus
#

@sturdy socket please send a clip when you use that shit on stream, we will tweet it

sturdy socket
#

the next time im live i will ๐Ÿ˜ข

#

so busy again

#

so much editing

#

then OPL starts again this friday and so much filming and editing

#

yo @viral patrol you got a twitter

#

i wanna chuck you a follow and tag you for helping me build that

viral patrol
#

I am European, we use pigeons directly here, without internet websites ๐Ÿ˜‰

sturdy socket
#

do pigeons know how to parse php ๐Ÿค”

viral patrol
#

You can tag streamelements instead of me ๐Ÿ˜‰ I don't collect internet points.

#

Your happines is way more worth than any heart/thumbup/+1 etc.

livid lotus
#

@viral patrol fucking love you man

#

happy that you are here

sturdy socket
#

can lx atleast get a code master role ๐Ÿ˜›

viral patrol
#

@livid lotus can I have #code-share channel ?

livid lotus
#

i dont see why not, ill talk to @low sierra he is in charge of these things

#

he can make you the master of such a channel

sturdy socket
#

lx if you ever want to host some PHP stuff for your stream

#

definately lemme know and i can setup you some stuff on my site

#

im assuming you already got a host tho seeing as you so knowledgeable

#

oh

#

actually

#

thats going in the ideas channel

#

idk how feasible it is

#

@viral patrol would putting php stuff on the SE site be too dangerous

#

for se

#

difficult to isolate the scripts

viral patrol
sturdy socket
#

yep

viral patrol
#

So yes, I kinda have my place to be

sturdy socket
#

im just using a mates spare server space

#

that hes hosting my esports website on

#

cause my actual site doesnt use much and im assuming the php doesnt either

#

but this has given me so many ideas for interacting with api's on different websites now

viral patrol
#

You got now my point of view.

sturdy socket
#

i knew how to do things

viral patrol
#

SE bot can do almost anything.

sturdy socket
#

just not how to connect them

#

the php scripting is how they connect

#

the missing chain in the link

#

and now i have no ideas ๐Ÿ˜›

viral patrol
#

If you make a good script, you can make a script which will send a postcard to provided address, you can order a pizza and so on...

sturdy socket
#

yeah

#

i need more stuff that the stream can interact with

#

oh

#

actually you might be able to help with this

#

im building something in unity to control camera position

#

chat > SEbot > my server > unity

#

๐Ÿค”

#

unity just runs in C#

viral patrol
#

SE doesnt work with XXX servers, I know You want to move camera to a special place for chat currency. I am sure about that! ๐Ÿ˜‰

sturdy socket
#

lul

#

i mean ive made it so my arrow keys can move the camera around in x,y and rotate it with other keys

#

can also do rudimentary scaling atm

#

still ironing out the bugs

#

if you press enter

#

its crashes ๐Ÿ˜„

#

its not rotating camera but just moving the flat image of the camera around

#

in 2d space

viral patrol
#

You can do it two ways:
gather data in unity from website:
download json file
check timestamp
if timestamp>saved_timestamp => move camera to a location

sturdy socket
#

im just thinking like

viral patrol
#

The other way is to create api endpoint on your computer and call it from bot/php script

sturdy socket
#

lul ye

viral patrol
#

But you need to have external IP address

sturdy socket
#

what i was thinking i would have to do

#

i think the redemption thing with the sockets would be the best thing atm

#

cause i think unity can do sockets

viral patrol
#

ah, and about that tweet - can you give me url to it, so I can take a look at final effect?

sturdy socket
#

ah

#

was just a screenshot of the chat

#

gonna make a clip from the next stream

#

my lighting / camera setup is modular cause i use a dslr that i also use for filming

#

so my webcam is currently on a tripod in the corner

viral patrol
#

@sturdy socket check this one

sturdy socket
#

OHH

#

new role @viral patrol

#

you a support hero now

viral patrol
#

I'm blue da ba dee da ba daa

grand wing
#

๐Ÿ˜„

sturdy socket
#

that looks promising

#

but i have no idea how that works

livid lotus
#

dude the level of your support is just insane, thanks a lot

sturdy socket
#

โค @viral patrol โค

#

with that tho im gonna crash

viral patrol
#

Nah mate. You gonna be just fine. Look at this like on a nightmare you want to end, not like opportunity

#

(this helps with my deadlines)

static wigeon
jolly frigate
#

@viral patrol Why was I tagged? ๐Ÿค”

viral patrol
#

Erm. Did I tag you? Can you provide me a timestamp? I am sure it was by mistake

jolly frigate
viral patrol
#

OMG. This is Discord's fault! I typed [at]Ter[Tab] and it autocompleted you. Sorry about that

jolly frigate
#

Ah it's alright i was curious cause i hardly know anything about the api haha

viral patrol
#

And you surprised me now, just made a few test with [at]random_letters to see, and sometimes it results strange...

floral fable
#

In my experience, sometimes the mouse cursor gets on a name, then tab complete picks the name the mouse if over. I do it with emotes all the time too

late forge
sturdy socket
#

a temp alternative

late forge
#

Is it mobile?

low sierra
#

This channel is meant for API-related discussion. Please feel free to carry on the discussion in #general-chat. I will say that StreamElements is not an RTMP service or streaming application but streamer tools. We recommend OBS studio and restream if you would like to do this.

sturdy socket
#

is there a way to trigger sound effects for certain users with chat commands?

green yarrow
#

No only with Store Redemption Items but not for certain users. You can make it only for subs or mods but mit specific users

sturdy socket
#

ah okay

nova parcel
#

hi so im getting an error

#

when trying to add points

#

relevant code

#
def addpoints(user, amount):
    r = requests.put('https://api.streamelements.com/kappa/v2/points/my_account_id/'+user+'/'+amount,
    headers = {"Authorization":jwt_token},
    )
    print(r.text)```
#
def gift(user_to, user_from, amount):
    negative_amount = amount * -1
    print(str(negative_amount))
    addpoints(user_to, amount)
    addpoints(user_from, str(negative_amount))```
#

it adds the points but doesnt take them away

honest bone
#

why not use our !givepoints command? pepoThink

nova parcel
#

well to be honest i didnt know that was a thing

#

i was making this for a friend

honest bone
#

who's the friend?

nova parcel
#

jakeoce

honest bone
#

You're honestly better off using the !givepoints command

nova parcel
#

alrighty

#

thanks

#

just out of curiosity and learning

#

why didnt it work?

honest bone
#

im not a developer, so i have no idea, i just could read the basics on what you're trying to do :p

nova parcel
#

ah gotcha

honest bone
#

im sure someone can answer you later tho

nova parcel
tight arch
#

i dont recognize that syntax

viral patrol
#

Python I think ๐Ÿ˜‰

unique nymph
#

it is Python

static wigeon
#

@honest bone PepeLaugh

nova parcel
#

I figured out what the problem was btw

viral patrol
#

@nova parcel so can you tell us, maybe somebody else will come to us later with the same issue and we will know, how to help them

nova parcel
#

oki sure

#

when i was trying to turn it into a negative number

#

i was multiplying a string by an integer

#

and it just returned nothing

#

so i got an error when trying to update points

#

soi turned the string into an integer first then multiplied it then turned it back into a string

#

str(int(amount) * -1)

unique nymph
#

is there any docs on the websocket connection?

static wigeon
#

What are you looking for?

unique nymph
#

just working through it tbh

#

although this is much more detailed then the api docs!

static wigeon
#

The new page is very much still WIP.

unique nymph
#

I have noticed, need help on that front?

static wigeon
#

For sure that'd be awesome ๐Ÿ˜ƒ

static wigeon
#

@unique nymph What's your github?

unique nymph
static wigeon
#

Gonna dm you an invite to our gitbook team.

unique nymph
#

Cool thanks

cold swift
#

Hello everybody !

Where is the code for "Follow" " Subscriber" " count " or " the name of guys to follow / subs " ! There are a code in css/js to modified this ?

cold swift
#

and how on my css / js the follow.subscriber is connect to my stream channnel ?

cold swift
#

@static wigeon hi

gray wigeon
#

Hiya, was wondering if there was any way to listen to chat messages via the socket API?

viral patrol
#

@gray wigeon there is easier way. Twitch uses IRC protocol, so you can run irssi/bitchx and so on to connect your channel

cold swift
#

someone see my message ?

#

Hello everybody !

Where is the code for "Follow" " Subscriber" " count " or " the name of guys to follow / subs " ! There are a code in css/js to modified this ?
and how on my css / js the follow.subscriber is connect to my stream channnel ?

swift hull
#

idk

low sierra
#

@kindred raven or @hushed hazel could you help out here? โคด Custom coding within the alertbox or event list widget

viral patrol
#

For alertbox - there is a pinned message @cold swift

cold swift
#

Is there possible to make my subs count session with appear and disapear like every 2 sec or ? i can only make it slide left to right on stream element ! someone can me send the code ? plz

viral patrol
#

If you want to use data from "Data" tab in overlay editor, you should create a "Custom Event List", go to the CSS editor and use code provided. For better readibility it is wrapped in HTML file. As you can see - each element has two divs: one for header (variable name - for better visibility) and one for data contained. So if you want to display JUST data for subscribers count, you should remove JS corresponding to displaying header ($("#hsubscriber-total").html("subscriber-total");) . Remember - this code can bring you a lot of work but also a full customizable display of each information. For example - you want to have a fancy 3D last sub? Just add some css to it. I assume SE staff will not be able to provide detailed help to it as it is not basic usage (this channel is for experienced users), but if you have somebody, who knows html/css/js, he/she will adjust this script to your needs. So, there's a link: https://pastebin.com/sDbxkEyG

#

@hushed hazel @livid lotus @cold swift โคด

livid lotus
viral patrol
#

This snippet has no "refreshing" but you can call it from onEventReceived

hushed hazel
#

@viral patrol im affraid you wont get the same data within the onEventReceived - youll have to assign obj.details to a public variable and then use it within the onEventReceived listener

viral patrol
#

Ohh, other obj is forwarded there

#

Right

hushed hazel
#

the object returned from the onEventReceived event is just that events data

#

๐Ÿ‘

#

good job on the list btw. sure will come in handy!

viral patrol
#

The way I've got this list as I am lazy: just wrote an ajax post request to nowhere, then checked "network tab" in dev tools. copied it to a file and iterated by php script ๐Ÿ˜‰

#

@hushed hazel offtopic: when are you streaming as I would like to take a live look at your stream ๐Ÿ˜‰

#

This autocompletion is killing me

#

Huh, obj passed to onEventReceived could be the same one that is on widget load, but in event Received function grabs just js const listener = obj.detail.listener; const data = obj.detail.event;

#

The best way is to create a function parseObject(obj) and forward full object from event listener and on widget load (so there is no duplicated code), as well there could be a lot more things (to update just one div instead of all of them).

hushed hazel
#

@viral patrol im doing Tue, Thu, Sun @ 8pm CEST

hushed hazel
#

@viral patrol maybe I misunderstood what youre trying to achieve, but this is what i meant with assigning the onWidgetLoad data to be used in the onEventReceived listener:

let loadData;

window.addEventListener('onWidgetLoad', function(obj) {
  loadData = obj.detail;
});

window.addEventListener('onEventReceived', function(obj) {
  $('.main-container').html(JSON.stringify(loadData, null, 2));
});
viral patrol
#

I didn't try to achieve anything @hushed hazel , i just realized, that this is the same object, but with event, there is also listener and event scopes.

violet grotto
#

when i trying doing the custon event list i cant make it so stay on there forever becuase it keeps disappearing after a few seconds

forest trench
#

He was giving the idea to use the HTML field as an option. I could write a minor tool for this, but to make it easiest, it would be best to make it have its own section like "text settings" is ... maybe Advanced Text ? This of course would also override aforementioned editor bar

#

Just point me in a direction and I should have it done fairly soon for ya! ๐Ÿ˜ƒ ... be sure to Tag me as I currently work grave shifts for my dayjob ๐Ÿ˜ƒ

kind beacon
#

hey guys

#

on custom css code for subscription alerts

#

i want to do an alert for gifted subs

#

which parameters do i have to work with

#

like username who got the gift - username who did the gift - number of months - number of gifts already done by gifter etc

#

cant find anything about it

#

right now {{amount}} trigers: gift

#

and {{name}} triggers a username (but i dont know if its the gifter or the sub )

finite heath
#

in the alertbox we use {sender} gifted {name} a subscription!

kind beacon
#

ok ill try {{sender}}

#

one sec

#

seems to work thx

finite heath
#

np ๐Ÿ˜ƒ

kind beacon
#

how can i get the latest donation info / latest sub info and latest cheer info for custom event list

floral fable
#

I think there is some details on this in the pinned messages

kind beacon
#

with this

#

window.addEventListener('onEventReceived', function(obj) {
const listener = obj.detail.listener;
const data = obj.detail.event;

if (listener === 'subscriber-latest') {
    username = event.name;
    text = 'x' + event.amount;
    ls = username + ' ' + text;
#

and this

#

window.addEventListener('onWidgetLoad', function(obj) {
const recents = obj.detail.recents.sort((a,b) => a.createdAt > b.createdAt);
userCurrency = obj.detail.currency;
for (var eventIndex in recents){
const event = recents[eventIndex];

  if (event.type === 'subscriber') {
   
    username = event.name;
    text = 'x' + event.amount;
    ls = username + ' ' + text;
#

i get undefined values

finite heath
#

i think @viral patrol or @hushed hazel might know the answer to this

viral patrol
#

HTML:

<div class="main-container"><p>Latest <span id="action-rotate"></span></p>
</div>

CSS:

p span {
  color: white;
  font-weight:bold;
  vertical-align: top;
}

JS:

let userCurrency;

var arr=['','','','',''];
  var counter=0;
var len = arr.length;
window.addEventListener('onEventReceived', function(obj) {
  const listener = obj.detail.listener;
    const data = obj.detail.event;
   if (listener === 'follower-latest') {
        arr[0]='Follower: '+data["name"];
    } else if (listener === 'subscriber-latest') {
        arr[1]='Subscriber: '+data["name"] + '('+data["amount"]+')';
    } else if (listener === 'host-latest') {
        arr[4]='Host: '+data["name"]+'('+data["amount"]+')';
    } else if (listener === 'cheer-latest') {
        arr[2]='Cheer: '+data["name"]+'('+data["amount"]+')';
    } else if (listener === 'tip-latest') {
      arr[3]='Donate: '+data["name"]+'('+data["amount"]+')';
    }
});

window.addEventListener('onWidgetLoad', function(obj) {
var data=obj["detail"]["session"]["data"];
  arr[0]='Follower: '+data["follower-latest"]["name"];
  arr[1]='Subscriber: '+data["subscriber-latest"]["name"] + '('+data["subscriber-latest"]["amount"]+')';
  arr[2]='Cheer: '+data["cheer-latest"]["name"]+'('+data["cheer-latest"]["amount"]+')';
  arr[3]='Donate: '+data["tip-latest"]["name"]+'('+data["tip-latest"]["amount"]+')';
  arr[4]='Host: '+data["host-latest"]["name"]+'('+data["tip-latest"]["name"]+')';

});

var i = 0, // Start Index
$el = $('#action-rotate'),
$temp = $('<span />');
$temp.hide().appendTo( $el.parent() ); // Setup Helper
(function loop() {
  var w = $temp.text( arr[i%=len] ).width(); // set text + get width
  $el.fadeTo(600,0).animate({width: w}, 300, function(){
    $el.text( arr[i++] ).fadeTo(600, 1);
  });
  setTimeout(loop, 3000);
}());
#

@kind beacon @rugged spindle โคด as you were interested in that

#

@kind beacon and about your code:

    const listener = obj.detail.listener;
    const data = obj.detail.event;

    if (listener === 'subscriber-latest') {
        username = event.name;
        text = 'x' + event.amount;
        ls = username + ' ' + text;

It should be data.name not event.name

kind beacon
#

omfg brainfail xD thx

viral patrol
#

Of course, you can change animation in loop function

sturdy steeple
#

Hello, can someone help me? i want activate a Keystroke for each event ? how is that possible? ๐Ÿ˜„

viral patrol
#

Keystroke on your computer for each event in stream?

#

It is possible if you push keystrokes to public API/server, then receive it by software running on your pc, then pressing buttons. So I think - some kind of API to handle requests, dekstop app to receive list of those reuests. I think - few days of work at least

sturdy steeple
#

hmmmmm XD

#

Just pressing 1 Hotkey on Keyboard would be possible?

viral patrol
#

Not without creating connection between your PC and SE events catcher. I know it would be easily monetized - donate $10 to instant granade throw. You are sneaking and then bam! $10 donate. However - few days of work at least.

#

For 2 people (1 for desktop site and 1 for API)

sturdy steeple
#

mhh ok

sturdy steeple
#

Whats that

#

i just want a script.. that press just the number "2" on the keyboard

#

someone followed -> press the number 2 on the keyboard

viral patrol
#

Oh. This is not related to your question, this is a widget share. As I wrote - you need somebody, who can write something like that for you as there is no solution for that.

sturdy steeple
#

Okay

viral patrol
remote rampart
#

dosent work.......................................................................................................................................................................................

inland warren
#

@hushed hazel Maybe you could help me, i'm looking for any documentation about custom HTML & CSS Alerts or maybe do you know the variable for text area on alerts please

livid lotus
#

@inland warren see the pinned msg

inland warren
#

Yup I saw but I succeed to did it differently

hushed hazel
#

@inland warren sorry about the late response, i was deep into work stuff - glad you figured it out tho!

inland warren
#

No problem, thanks @hushed hazel ๐Ÿ˜ƒ

inland warren
#

@viral patrol Do you know where can i found all value for the custom event list you gave me, for example, for the latest tip it's gonna be tip-latest but I would like to find others value like Top tipper etc...

indigo flume
#

Check the pinned msg for the variables @inland warren

#

wait its gone?

inland warren
#

I think

indigo flume
#

found it

inland warren
#

Thanks !

viral patrol
#

This is terrible to read

#

I unpinned it, so I could write it proper way

inland warren
#

nvm i pin it for me ๐Ÿ˜„

viral patrol
#

There you are. Something I am working on

inland warren
#

nice job ๐Ÿ˜‰

viral patrol
#

It is not complete yet, but you can get a lot of information from there

inland warren
#

yup i see

inland warren
#

Perfect, I succeed to did exactly what I wanted @viral patrol ๐Ÿ‘Œ

indigo flume
#

Don't mind me just pining that 'ish for later usage cohhEvil

viral patrol
#

OK. I think it seems to be complete now

floral fable
finite heath
#

great job @viral patrol !

viral patrol
#

Ty

cinder lintel
#

that is awesome

white flume
#

So i want to make a widget like "stream avatars" because we cant really sync stream avatars with stream elements.
Can i see who is watching with streamelements api (Dont see anything in the docs)

left flax
#

hi

viral patrol
#

!jwt

zenith folioBOT
left flax
#

perfect, thanks @viral patrol ๐Ÿ‘Œ

white flume
#

Anyone seen my message?

cinder lintel
#

@white flume what do you mean by "watching"

white flume
#

Once someone says something in chat they get added to a list with people that watch

cinder lintel
#

ahhh

#

got it

white flume
#

I think i can recreate it, but i just need something from the api that looks at people in chat

cinder lintel
#

I think you need to grab that info from twitch

#

as that is where we grab it

white flume
#

And the streamelement is mostly user calling for something

#

So youโ€™re saying i should use streamelements at all?

#

Shouldnโ€™t *

cinder lintel
#

I didn't say that, I am just saying if you want to watch for chat lists, you want to use twitch

#

there are some integrations you can use between the application and SE, but specifically the viewer lists, pull from twitch

white flume
#

Yea ok, but then i go directly to twitch api and not streamelements api right?

cinder lintel
#

for that part, yes

white flume
#

and probably cant get twitch api to the custom event widget

cinder lintel
#

you can

#

๐Ÿ˜‰

white flume
#

Just including?

cinder lintel
#

that widget can do just about anything, minus a few things that cause security issues

white flume
#

๐Ÿค”interesting

#

Ill check out twitch api then

#

Ty

#

Shit i dont speak json

cinder lintel
#

xd

#

that is always the fun part, parsing the json

white flume
#

You can converg it to a array right?

#

Just normal js array

#

๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ

#

Then you get json with chatters name

#

If you were interested lol

viral patrol
#

@white flume if you want it as object to iterate:

let viewers={};
$.get("http://tmi.twitch.tv/group/user/tygo1oo/chatters", function(data) {
    let obj = JSON.parse(data);
    viewers = obj.chatters;
});
white flume
#

@viral patrol this need jquery right?

viral patrol
#

Yes, but in "custom event list" jquery is included by default

white flume
#

Thats nice

#

Ok thx dude

white flume
#

@viral patrol i cant really find how to select the images from the media center on the website. Better way to get image in the custom even list is to get them external?

#

Internal would be better tho

viral patrol
#

Give me a second

#

Press insert image, then select image you want to use from your library. Now just click RMB on thumbnail on left to "Change image" and "Copy Image Address" from menu.

#

This is how I did get images urls I could use in my snippets

white flume
#

Were is the insert image button? I am really that blind? ๐Ÿ˜‚

#

But thx

viral patrol
#

Insert image as overlay element

#

Top menubar

white flume
#

๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ

#

Thank you @viral patrol

lavish spade
#

Can the Regular Expression component of a command be used to check the sender's name? Or only the body of their message?

low sierra
#

Message

fresh vigil
#

@viral patrol I'm trying to use your marquee build but I'm having trouble with it. I guess I really don't know how to insert it. I tried to go through widgets>custom event list and replace what's there with the code you posted but it doesn't seem to be working.

viral patrol
#

Gonna check it bit later as I am not home now

white flume
#

Why cant i send code

cinder lintel
#

you can, use the tilda "~" key

#

but not that symbole

#

lol

#

`

#

that one

#

three of those surrounding code puts it in a special box

#

its the link

low sierra
#

you're good now

#

go ahead

white flume
#

`var JSONItems = [];
$.getJSON( "http://tmi.twitch.tv/group/user/tygo1oo/chatters", function( data){
JSONItems = data;
viewers = JSONItems.chatters.moderators;

var i;
var display;
for (i = 0; i < viewers.length; i++) { 
    display += viewers[i] + "<br>";
    
    document.getElementById("test").innerHTML = display;
}

});`

#

looks weird ay

floral fable
#

if you use 3 back ticks it will do a code block

low sierra
#

^

white flume
#

`

#

``

#

i dont understand lol

low sierra
#

use 3 ` before and after

white flume
#

ahhh

#
$.getJSON( "http://tmi.twitch.tv/group/user/tygo1oo/chatters", function( data){
    JSONItems = data;
    viewers = JSONItems.chatters.moderators;
    
    var i;
    var display;
    for (i = 0; i < viewers.length; i++) { 
        display += viewers[i] + "<br>";
        
        document.getElementById("test").innerHTML = display;
    }
    
});```
cinder lintel
#

there you go ๐Ÿ˜ƒ

white flume
#

So why is this not working in custom event

#

Works in localhost

#

I only get the following : was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint

#

But it should work

cinder lintel
#

what happens when you put in https

white flume
#

Change url u mean?

#

Its just impossible in streamelements as a beginner programmer, i really cant test

cinder lintel
#

Yeah, change the url from http to https

white flume
#

Ill try ty

cinder lintel
#

just this: ``` var JSONItems = [];
$.getJSON( "https://tmi.twitch.tv/group/user/tygo1oo/chatters", function( data){
JSONItems = data;
viewers = JSONItems.chatters.moderators;

var i;
var display;
for (i = 0; i < viewers.length; i++) { 
    display += viewers[i] + "<br>";
    
    document.getElementById("test").innerHTML = display;
}

});```

#

idk if it will work, but worth a shot

white flume
#

Nah doesnt work

#

I probably have to use ajax

viral patrol
#

This is ajax

#

also no need to declare JSONItems on init, as it is overwritten within success of JSONitems

#

AND it should work, as there was protocol mismatch (accessing http while on https)

#

Sorry, my fingers wrote "and" in caps as it is custom from coding ๐Ÿ˜‰

white flume
#

@viral patrol i changed to https

#

Still doesnt work

#

Nothing is displaying

viral patrol
#

Erm, and your functions scope is wrong

#

Let me do that for you

#

brb

white flume
#

Wait what

cinder lintel
#

haha, magical programming stuff

viral patrol
#

Oh. Got it now. Do you have any webhosting which could do

<?php
header('Access-Control-Allow-Origin: *'); 
echo file_get_contents('https://tmi.twitch.tv/group/user/tygo1oo/chatters');

as there is no such header on twitch tmi endpoint which disallows your script to get data by AJAX call from there

#

And about function scope - it is wrong, it should be:

white flume
#

Ahh i have this in localhost. I thought it was in streamelements already

viral patrol
#
let viewers=[];
$.getJSON( "https://tmi.twitch.tv/group/user/tygo1oo/chatters", function( data){
    let JSONItems =data; //there is no need as you can direct call let viewers = data.chatters.moderators
    viewers = JSONItems.chatters.moderators;
    
    var i;
    var display;
    for (i = 0; i < viewers.length; i++) { 
        display += viewers[i] + "<br>";
        
      
    }
      document.getElementById("test").innerHTML = display;
});
#

document.getElementById("test").innerHTML = display; should be out of a loop

white flume
#

Lol

#

Youโ€™re right

viral patrol
#

And you were assigning string as array

white flume
#

The vars?

viral patrol
#

OOOo.

#

MB

#

IT is getJSON not .get

white flume
#

I did getjson ?

viral patrol
#

OK. So from beginning:

  1. you need serverside script which has header AllowOrigin: * (to AJAX calls work)
  2. there is no need to initialize JSONItems before calling .getJSON (as it should be initialized on method success)
  3. no need to use another variable to hold this data - putting whole data to JSONItems
white flume
#

Appreciate the help

#

I understand

viral patrol
#

Conclusion. You need serverside script, lets call it script.php with contents:

<?php
header('Access-Control-Allow-Origin: *'); 
echo file_get_contents('https://tmi.twitch.tv/group/user/tygo1oo/chatters');

then you need to call it instead of calling twitch by:

$.getJSON( "https://URL-TO-YOUR-DOMAIN/script.php", function( data){
   let viewers = data.chatters.moderators;
       let i,display;
    for (i = 0; i < viewers.length; i++) { 
        display += viewers[i] + "<br>";
    }
      document.getElementById("test").innerHTML = display;
});
#

No problem. Glad I could assist

white flume
#

Are you actual dev in streamelements?

viral patrol
#

I am not.

#

I just like to help people ๐Ÿ˜‰

cinder lintel
#

he is just awesome xD

white flume
#

^

#

Even learning him

#

From him*

cinder lintel
#

yes, its good having people willing to help ๐Ÿ˜ƒ

viral patrol
young saffron
#

is there anyone that might be willing to help me convert some code for a custom event list that i use in streamlabs in order for it to work in SE?

viral patrol
#

@fresh vigil just took a look at this snippet. By mistake there was a "CSS" section described as JS. Corrected it now

white flume
#

@viral patrol it actually works ;D

viral patrol
#

is trying to look surprised ;-)

white flume
#

result is this tho.
undefinedstreamelements
tygo1oo

#

But i'll try to fix it my self plz

cinder lintel
#

doesn't twitch API use the userID now? idk, but I think i remember hearing that at some point

viral patrol
#

Wanna hint?

white flume
#

@viral patrol yes

#

@cinder lintel probably

viral patrol
#

Tygo "undefined" comes as an item is not defined, maybe you could skip it somehow

#

@white flume โคด

cinder lintel
#

oooo, I get it

fresh vigil
#

thanks for the fix @viral patrol

white flume
#

@viral patrol skipping first [0] just skips the first viewers. It doesn't skip undefined

#

i think the undefined comes from somwhere else

#

@viral patrol let i is just giving back undefined

viral patrol
#
$.getJSON( "https://DOMAIN/viewers.php", function( data){
   let viewers = data.chatters.moderators;
         let i,display="";
    for (i = 0; i < viewers.length; i++) { 
        display += viewers[i] + "<br>";
    }
      $("#test").html(display);
});
white flume
#

hmm

viral patrol
#

display was undefined on start and you were updating it.

white flume
#

Ahh

#

i understand, i didnt know you had to define type

viral patrol
#

Imagine a question:
there is a bus
on first stop 5 people went in
on second stop 3 people went out and 2 went int
on third 1 person went in
how many people are on the bus?

#

You don't know, how many people were on the bus before first stop, always reset value of variables

white flume
#

good one

#

you smart

viral patrol
#

And I am sorry i pasted a code that caused troubles

#

Wasn't my intention, i wrote it on discord directly without checking it first

white flume
#

I only used the parts i need

viral patrol
#

But - there is always a lesson taken

white flume
#

๐Ÿ˜ƒ

#

No problem

#

Thanks for helping again

#

@viral patrol i think i learn more from you then school

viral patrol
#

No. You learn by yourself. Teacher or me are only to show you a way, it is all up to you if you take it.

white flume
#

๐Ÿค”

#

Wise man

white flume
#

@viral patrol you there?

#

@viral patrol any time helping me with debugging?

#

I have this code that makes divs move randomly. But it wont work when i trigger it inside the ajax request

#

(still same code as before)

#

already fixed it sorry

viral patrol
#

Np

white flume
viral patrol
#

Pretty nice

cinder lintel
#

they crash together, video stops

#

I thought for a second it died and waited for error xD

viral patrol
#

I expected explosion on collision

cinder lintel
#

big boom. big badda boom

white flume
#

Haha and this all in custom event list

#

Advanced movements coming soon

young saffron
#

ive been having trouble converting code for an eventlist i use in streamlabs to work in SE. is there anyone that might be willing to help out?

cinder lintel
#

@young saffron have you checked out the code manual that was put together? It is pinned, and might help you out a bit

young saffron
#

@cinder lintel ah ok ill take a look. my coding skills are limited so we'll see what happens

cinder lintel
#

that manual is VERY detailed, and awesome

young saffron
#

@cinder lintel yea looks pretty detailed. problem is when i paste in the html everything immediately disappears. i dont even see anyting in the manual that could help

pulsar willow
#

i am trying to call.... /points/{channel}/{user}/{amount} but getting a error 404

#

points/channel id/tads_gaming/ works without fail and shows me what i wanted

#

but adding a number to it 404 errors

viral patrol
#

Are you using PUT method on your call?

pulsar willow
#

ahhhh

#

my bad

#

i have started to write a Wordpress Plugin for SE as i use wordpress for my site and i am building a "stream Store" that people can use the "points" to buy desktop backgrounds etc

#

i think it will be quite cool if i get it right

viral patrol
#

I imagine WooCommerce Stream Elements currency payment gateway ๐Ÿ˜‰

pulsar willow
#

see i was thinking woocommerce but thats a bulky plugin and i dont think its needed for a "stream store"

#

only thing is i have never used PUT so just trying to find some info on it

viral patrol
#

Do you use cURL for calls?

#

if so:

<?
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
#

@pulsar willow โคด

pulsar willow
#

well i didnt want to but all info seams to point at curl

viral patrol
#

Huh... Give me a second

pulsar willow
#

i just have to enable it on localhost so i can code it locally

viral patrol
pulsar willow
#

Thanks will do in a sec

viral patrol
#

$request = $client->createRequest('PUT', '/path', ['body' => ['foo' => 'bar']]);

pulsar willow
#

ahhhh nice

#

thank you

viral patrol
#

This is for guzzlephp

#

This is amazing tool to be a base for API wrappers

pulsar willow
#

@viral patrol i think i might just use curl... but would you have a example code i could learn from... as for the points to add or take away points.

somber wigeon
#

hello, i need some help with event list CSS! i want to remove host from events.. but i dont knwo how ๐Ÿ˜ฆ i try everything.. but nothing ๐Ÿ˜›

viral patrol
#

Events are added in two places:

  1. on event received
  2. on widget load
    just comment AddEvent in if for hosts in both places would do the trick
#

Just like that

somber wigeon
#

thanks โ™ฅ

viral patrol
pulsar willow
#

yea i have been using that and i get... {"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"} @viral patrol

#
$url = "https://api.streamelements.com/kappa/v2/points/";
$data = array('channel' => $channelid, 'user' => $user, 'points' => $points); ```
viral patrol
#

Put it directly into URL and use PUT method

#
$url = 'https://api.streamelements.com/kappa/v2/points/' . $channelid . '/' . $user . '/'.$points;

@pulsar willow

pulsar willow
#

yea i have just done that but to send with curl you have to send http_build_query and that has to have a array

#

without using...
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query
i get the 401 message

pulsar willow
#

right time to stream so i will get back to it soon

viral patrol
#

401 - Unauthorized, probably no authentication header

pulsar willow
#

ok so i am receiving this... "message": "No authorization token was found"

viral patrol
#

So, you need to add it to haders

#
<?php
$authorization = "Authorization: Bearer JWTTOKEN";
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
pulsar willow
#

Thanks @viral patrol i am walking away for a bit.... i have never had to use any of this before and its abit overwelming tbh.... never used PUT or JWT <head hurts>

honest meteor
#

I created a countup timer, since only a countdown timer existed natively. Useful if you're trying to track progress of a current task.

JavaScript code you can add to a custom widget within SE:

var timerVar = setInterval(countTimer, 1000);
var totalSeconds = 0;

function countTimer() {
    ++totalSeconds;
    var hours = Math.floor(totalSeconds / 3600);
    var minutes = pad(Math.floor((totalSeconds - hours * 3600) / 60));
    var seconds = pad(totalSeconds - (hours * 3600 + minutes * 60));

    document.getElementById("timer").innerHTML = hours + "h " + minutes + "m " + seconds + "s";
}

function pad(val) {
    var valString = val + "";
    if (valString.length < 2) {
        return "0" + valString;
    } else {
        return valString;
    }
}

Then for the HTML you'd use:

<div id="timer"></div>

You can see an example of the output below.

cinder lintel
viral patrol
#

@honest meteor wanna a hint? ๐Ÿ˜‰

honest meteor
#

A hint? I'm just sharing what I created for myself, so others who might have a use can feel free to use it. ๐Ÿ˜ƒ

viral patrol
#

I get it as I do the same ๐Ÿ˜‰

swift zephyr
#

@civic harbor first: wrong channel, this is for developers. second - please check out #art-marketplace

low sierra
#

Sodapoppin's stream package was created by Nerd or Die. You may be able to hire them to do something for you. Contact them via twitter or their website.

north nest
#

@young crystal These guys can help

young crystal
#

hey in nightbot I can use $(touser) to make it when someone (mods) !command @user the reply @'s the user

#

it seems you only have $(user)

#

is that the case

viral patrol
#

@cobalt narwhal there are two variables $(user) which you can prepend with @, There is also $(sender) which will reply with a person who is using command. For example a command !watchtime - by default it will treat $(sender) as $(user) but when you add param !watchtime user A user will differ from sender. In that case response @$(sender), $(user) was watching my stream for $(user.time_online) will have response like @Vince, lx was watching my stream for 13 seconds

young crystal
#

@viral patrol thanks, do you guys have variables to execute a command? for example I have a !camera command and a !cam command and I would like the cam command to just say what the camera command is

low sierra
pulsar willow
#

at last i got my head round it

#

just using curl and PHP

#

so using
CURLOPT_POSTFIELDS => "{\n\t\"amount\":30\n}",
adds to a users points and you would think changing 30 to -30 would remove? but it does not it adds 30 again... how would i take 30 points away?

hollow verge
#

Hello, I'm wanting to pull the tips, subs, bits, from the api in real time any why of doing this ?

pulsar willow
#

My bad it is now working <User Error> like normal

hollow verge
#

@pulsar willow I have but am I limited to api calls ? thank you

cinder lintel
#

There is a websocket for getting live events, I'm just too pleb to know how

dark olive
#

Are there libraries available to work with the API from say, PHP, Python, JS...? ๐Ÿค”

#

Just wondering if they exist, if they do not, I might write a few

cinder lintel
#

None that have been posted in this discord

low sierra
desert matrix
#

awesome. thanks @low sierra

unique nymph
#

@pulsar willow I would heavily recommend using Guzzle over CURL... If you need help on that front hmu

mellow tiger
zenith folioBOT
mellow tiger
#

Thank you

#

Also, can I just pass the JWT key in the url or does it need to be as a header?

low sierra
#

Header

mellow tiger
#

Okay, and what does the name need to be?

low sierra
#

Bearer token

mellow tiger
#

token did not work. I still have error 401

low sierra
#

Sorry, replace that with your JWT

mellow tiger
#

This is what I used curl --header "token: {token}" https://api.streamelements.com/kappa/v2/bot/darkswordsmantv

#

Did you mean "bearer: {token}" ?

low sierra
#

I believe that will work yes but I only have limited knowledge when it comes to this stuff. I'm sure one of our devs or a community member with experience can help out when they're available.

mellow tiger
cinder lintel
#

Oauth is wip, not released. Im not familiar with the format you are using, but I can show what I used through Google scrips to pull from the api

mellow tiger
#

That would be great, thanks. I was just testing with curl to see what data/JSON structure I would get since the documentation is fairly vague

mellow tiger
#

It appears it's supposed to be curl --header "Authorization: Bearer {token}" https://api.streamelements.com/kappa/v2/bot/darkswordsmantv, though, so far, all of the urls I have tried have not worked for various reasons. ๐Ÿ™ƒ

Edit: channels/{channel} worked KappaPride

cinder lintel
#

hold on, I think i know what it is

#

xD

#

pardon my scatterbrain, otherwise I would have helped sooner, lol

mellow tiger
#

No worries. I'm no where near even a Junior developer, but I know if there's a will, there's a way. Lol

I'm wondering if loyalty/{channel} is broken. It returns 500

cinder lintel
#

what are you putting in for {channel}

mellow tiger
#

darkswordsmantv, my channel

#

https://api.streamelements.com/kappa/v2/loyalty/darkswordsmantv

cinder lintel
#

you need to use your accountID from your profile

#

in SE

mellow tiger
#

โค big thanks. Worked

cinder lintel
marble trail
#

hey im having trouble setting up a google api

#

im not the owner of the channel but he would like a google sort of command but the api wont work

marble trail
cunning inlet
#

Does the api allow us to pull information in regards to chatstats?

cinder lintel
wispy pivot
charred tundra
#

Am I to understand I can't just drop in {name}, etc. placeholders to custom CSS alerts in the HTML, I need to replace values myself with JavaScript? First tame making custom coded alerts, sorry for the newbie question. It's not currently being replaced automatically when I test it.

cinder lintel
#

There is a complete guide pinned @charred tundra

charred tundra
#

That's what I'm using

#

The placeholders aren't working as-is so I wanted to verify that's expected behavior

viral patrol
#

They should work - I just have a custom sub alert which has name in CSS field

#

content: '{{name}}\A {{amount}} months!';

#

So {{}} should do the trick

charred tundra
#

ah, double brackets

#

the guide may need to be updated

#

there we go, that did the trick. thanks!!

viral patrol
#

OK. Gonna update it then

#

Updated

#

Huh, and i found a typo

charred tundra
#

Awesome, thanks!!

charred pebble
#

I was sent here by the helpdesk team

#

I'm trying to use querystring/queryscape/queryencode/pathencode but none of them seems to work.

#
$(urlfetch https://example.com/${queryescape})
#

it doesnt replace

viral patrol
#

@charred pebble ${customapi.http://url/?param=${pathescape ${1:}}}

charred pebble
#

does it include spaces?

viral patrol
#

It htmlencodes all spaces to %20

charred pebble
#

k this is what i need

viral patrol
#

So for example !spotify Drunken Sailor will send a request http://playme.asong/script.php?song=Drunken%20Sailor

charred pebble
#

the documentation was really confusing

#

it says both queryscape and queryencode

#

also it doesnt submit if you type the comand without arguments

#

is the the desired behavior?

spark carbon
#

Good day.
I want to translate the command !accountage.
But i did not find a variable for the date the account was created.
Is it possible to help me somehow?

cinder lintel
#

you would need to find the twitch api that pulls that

low sierra
#

That requires a target user

#

!age terrabuck

viral patrol
#

Command Age Terrabuck responded with error: we don't check age for everything that is older than coal

spark carbon
#

Thank you.
I do not understand this at all, but i'm very interested. I could not understand why it did not work. But then i tried instead$(1), add $user, and everything worked.

#

Now I ask to help. How can I make a beautiful date?

  1. What is now.
  2. As I want.
viral patrol
#

Use https://decapi.me/twitch/accountage/ Instead of https://decapi.me/twitch/creation/

#

@spark carbon โคด

low sierra
#

"days" "years" etc. cannot be translated

#

I have a feeling that would be the next question

spark carbon
#

I did not understand how to use the parameter 'precision'.
I only have year and month.
I tried to write this parameter, but I can not.
How to write it correctly?
Now: $(customapi https://decapi.me/twitch/accountage/$(user))

viral patrol
spark carbon
#

Many thanks!

spark carbon
#

For translate command !givepoints
I not only need to translate the text, but the function of sending points is also needed. Is it possible to implement?

#

And so is the command !item

cinder lintel
#

default commands at this time are unable to be editted, and certain ones that have logic built in (those two you listed) can't be re-created any other way

autumn lark
#

@viral patrol GWfroggyBlobHappyPing Hey could you help me out

viral patrol
#

@autumn lark I will try. Just post your question and I will do my best to answer (but I am not always around ๐Ÿ˜‰ )

autumn lark
#

I'm a mod for SypherPK and tried using the earlier posted Fortnite API to make a command that shows the amount of wins he got in that day, and i'm getting close but yeah

#

It's reading the script, not executing it

viral patrol
#

Whoa. You have to download this script to your webhosting

autumn lark
#

I did what

#

I just uploaded it to my github

viral patrol
#

Not to github

autumn lark
#

Could host it locally but my pc is not always on

viral patrol
#

To a place where you have php parser

#

For example hosting account

autumn lark
#

Ehhhhhh effort

#

Okay fine

#

Did anyone else happen to host it?

viral patrol
autumn lark
#

Alright, I got the script to work, but would you happen to know if I can change the timezone to match him? @viral patrol

viral patrol
#

In one of first lines of PHP script just add:

date_default_timezone_set('Europe/Amsterdam');
``` or whatever a timezone you want to use
pulsar willow
#

i know this is not in the scope of SE but you are all great with PHP... i am trying to scrape the big top header image from my twitch page to display on my website... i have tried file_get_contents but page fails to load... have any of you any idea how i can do this?

autumn lark
#

I'm not great with PHP at all OMEGALUL

#

Also this doesn't seem to be working, i'm guessing it's just taking whatever the api provides? @viral patrol

#

I might just hit up the partybus team @viral patrol

#

So I don't bother you every time OMEGALUL

viral patrol
#

I am not sure about this piece of code as I don't remember what is timezone related there

#

But you're right, it seems just forwarding data from API

autumn lark
#

Yeah i've contacted them, i'll see what they say when they get back to me

white flume
#

Can i perform a task on discord through SE?

indigo flume
#

I though it should contain all the Custem Event list variables?

#

@white flume I don't think thats possible as both use different APIs. If you want a way to have a middle-man, do share with us.

viral patrol
#

Huh. Maybe something broke. Give me a second

#

It contains, but somehow it is not displaying anything below "Note:"

viral patrol
#

OMG... dillinger added "overflow:hidden" to "body" element

white flume
#

@indigo flume would be nice to add sombody to group through stream stats. But if thats impossible, no problem

indigo flume
#

I don't understand what you want to achieve

white flume
#

Would be good ay?

#

@viral patrol

#

Cant i do somethink like this through custom event?

#

Including part of discord api to layout

cinder lintel
#

I think you should be able to code something from the custom event list to discord, yes

viral patrol
#

@white flume you need to send request over REST API to discord endpoint

white flume
#

ok

potent ravine
#

Not sure weather to ask this here on in the other section, so I will ask in both. What data type does the point system use? Asking so I know what the max amount of points a user can have.

low sierra
#

@potent ravine
Our lead developer says:
"Use an INT. The value shouldn't ever be above Int32"

rugged spindle
#

Hey so a while ago @viral patrol helped me out with a custom widget and I'm having trouble changing the font. one section of it isn't changing

#

would anyone be able to help me with that?

floral fable
#

should be pretty simple, would just need to see the code

rugged spindle
#

html is:
<div class="main-container"><p>Last <span id="action-rotate"></span></p>
</div>

#

css:
p span {
color: white;
font-weight:bold;
vertical-align: top;
font-family: arial, sans-serif;
}

#

JS:
let userCurrency;

var arr=['','','','',''];
var counter=0;
var len = arr.length;
window.addEventListener('onEventReceived', function(obj) {
const listener = obj.detail.listener;
const data = obj.detail.event;
if (listener === 'follower-latest') {
arr[0]='Follower: '+data["name"];
} else if (listener === 'subscriber-latest') {
arr[1]='Subscriber: '+data["name"] + '('+data["amount"]+')';
} else if (listener === 'host-latest') {
arr[4]='Host: '+data["name"]+'('+data["amount"]+')';
} else if (listener === 'cheer-latest') {
arr[2]='Cheer: '+data["name"]+'('+data["amount"]+')';
} else if (listener === 'tip-latest') {
arr[3]='Donate: '+data["name"]+'('+data["amount"]+')';
}
});

window.addEventListener('onWidgetLoad', function(obj) {
var data=obj["detail"]["session"]["data"];
arr[0]='Follower: '+data["follower-latest"]["name"];
arr[1]='Subscriber: '+data["subscriber-latest"]["name"] + '('+data["subscriber-latest"]["amount"]+')';
arr[2]='Cheer: '+data["cheer-latest"]["name"]+'('+data["cheer-latest"]["amount"]+')';
arr[3]='Donate: '+data["tip-latest"]["name"]+'('+data["tip-latest"]["amount"]+')';
arr[4]='Host: '+data["host-latest"]["name"]+'('+data["tip-latest"]["name"]+')';

});

var i = 0, // Start Index
$el = $('#action-rotate'),
$temp = $('<span />');
$temp.hide().appendTo( $el.parent() ); // Setup Helper
(function loop() {
var w = $temp.text( arr[i%=len] ).width(); // set text + get width
$el.fadeTo(600,0).animate({width: w}, 300, function(){
$el.text( arr[i++] ).fadeTo(600, 1);
});
setTimeout(loop, 3000);
}());

floral fable
#

ok, lemme look into it

rugged spindle
#

thx

#

also should I be able to use any of the fonts that are in the regular widgets

floral fable
#

I was just going to ask what font you wanted to use

rugged spindle
#

I haven't decided just yet, should I do that now?

floral fable
#

you can easily replace the font at any point

rugged spindle
#

ok

floral fable
#

ok, so here is what I did

#

This will be the HTML. The top part is setting the font from google fonts (which are where the fonts in the overlay editor come from)

<link href="https://fonts.googleapis.com/css?family=Shrikhand" rel="stylesheet">
<div class="main-container"><p>Last <span id="action-rotate"></span></p>
</div>
rugged spindle
#

okay so do I add that to what's already there for html or completely replace it?

floral fable
#

And this will be the CSS, where we set the font globally at the top, and then can change it on a widget level as well. As you see we set the font color in the top to black, but have it as white in the container for the data. You can control this further like size and other styles

* {
    font-family: 'Shrikhand', cursive;
    color: white;
    font-size: 23px;
    overflow: hidden;
}

p span {
  vertical-align: top;
}
#

This would replace the existing code, I just used this font because it was a noticeable change

rugged spindle
#

okay

#

1 sec

floral fable
#

On the google fonts page, when you select a font, you can easily get the HTM and CSS from there and just replace in the code

rugged spindle
#

can you make that a hyper link? also is there an easy way to make it so that the Last is white along with the rest of it

floral fable
#

The fonts page is just https://fonts.google.com/ once you find one you want, you just click select this font, then a grey bar will appear, and that will have the code for any selected font

#

I also modified the CSS above, it will now make all of the font white

#

The top section I added controls the font on a global level, you can also add font style and parameters into the p span as that is the container for the events. There is no separate container for the word Last so anything you set on a global level will control it. Hope this makes sense/helps

rugged spindle
#

okay

#

I think I can get it from here, I'll dm if I run into another problem

#

thanks

floral fable
#

No problem SEheartbeat

rugged spindle
#

@floral fable okay one more question

#

how can I force it to show all on one line

#

it looks like it has something to do with the "vertical-align: top;" line in the css

floral fable
#

if its not on a single line, you can either change the font size smaller, or rezise the widget box

#

changing the font itself, or the size can cause it to not look right in the widget, and resizing it should fix that

rugged spindle
#

I tried resizing the widget box and it didn't change anything

floral fable
#

how does yours look right now?

rugged spindle
#

sometimes it does it sometimes it doesn't

#

nvm I think it's just because I resized it while it was already showing it

floral fable
#

yeah, it should reload after the resize, otherwise if it is acting funky, you can try making a new event list widget, you defiantly want the vertical align in there, if you change it or remove it, it might start doing some funky stuff when it cycles through the events

rugged spindle
#

okay, thanks again

floral fable
#

yeah, no problem cooldoge

rugged spindle
#

@floral fable one more question thats totally unrelated

#

if you're still there

floral fable
#

whats up

rugged spindle
#

@viral patrol also said it was possible to get SE to show your current song playing on spotify

#

would you wanna help me do it?

floral fable
#

Thats not something I am going to be able to help with. The way I understand that was done, you will have to host your own PHP script that will be used to call the Spotify API's. Once lx is around and sees your ping, he will be able to give much more detail into that

rugged spindle
#

kk

#

I got the other thing looking exactly how I want it so thanks again for that

floral fable
viral patrol
#

@rugged spindle if you want spotify bot command you need PHP hosting with SSL (as Stream Elements is over SSL) + a script I can provide you

rugged spindle
#

pm please

#

@viral patrol

mighty remnant
#

Hey. I have been trying for a very long time to make an instant notification of a new follower, like a twitchalert and like your bot. How do you get instant information about a new follower? If I use api twitch tv/kraken/channels/CHANNEL/follows then there is a delay of 20 seconds before updating, which does not suit me. If you do not want to disclose secrets, then tell me, can this information be obtained from you?

viral patrol
#

You can make event listener in overlay editor to push actions to your endpoint

pulsar willow
#

As @floral fable suggested, moving this here.

I added the Last Events Rotator posted in #widget-share and want to change the color of the label part (like "Latest Follower:") to a different color and make the name itself white. I can't figure out how to do this cause with how the rotator works currently, the last half of the label (So "Follower:" in the example) can't be a different color than the name. https://i.imgur.com/aU4MynJ.png

It would require splitting the event type label (like Follower) into a separate span from the event content (like name) but I know 0 JS so I have 0 idea how to split it.

viral patrol
#

If you want to have same style for both elements, just remove "span" from original code in CSS. Like that:

#

@pulsar willow โคด

honest bone
#

no no @viral patrol
He wants "Latest Follower", "Latest Donation" etc... to be the same colour, but the variables to be a different colour

viral patrol
#

Ach. OK. Gimme a sec

honest bone
#

"Latest Follower" in pink, and "Username" in white type of thing ๐Ÿ˜ƒ

viral patrol
pulsar willow
#

It works doyNice Thanks

strange wind
#

Hey! To get the current sub points, is that a specific SE API or does Twitch allow me to get that data as well?

viral patrol
#

I think you can just iterate over https://api.twitch.tv/kraken/channels/[CHANNEL_ID]/subscriptions and sum sub_plan

finite heath
#

we do have a total subscriber points widget

#

meaning theres a way to get it on our api

#

probably needs the jwt

spark carbon
#

Good day!
Can i somehow automate the purchase of a subject for points and Kappagen?
The viewer buys the item 'Kappagen' and automatically the widget works.

viral patrol
#

You can create two commands:
!item with response {redeem item}
!kappaitem for kappagen generation (with an alias item) and hide it
Change price of those commands (so people won't use !kappaitem nor !item just to show kappagen free of charge)

#

@spark carbon โคด

#

There is other way - create custom event list event listener and if there's item redemption, trigger call to API to invoke kappagen, but this requires more work.

spark carbon
#

Chat bot writes in the chat '!kappagen', but nothing happens.
I did not quite understand. How to give chat bot the privilege of a command '!kappagen'?

finite heath
#

the bot doesn't see its own lines, so you can't get 1 command to trigger another

spark carbon
#

I got confused.
I did everything that wrote @viral patrol , but nothing works.
Maybe i made a mistake somewhere.

green yarrow
#

if I read this correctly you want that people can trigger kappagen, but that it should cost points? @spark carbon

viral patrol
#

Command item
bot response: {redeem item]
Command kappagen
command alias: item

#

So command !item will run two things:

  1. item redemption
  2. Kappagen event
spark carbon
#

Excuse me. It seems very simple, but i really do not understand where i was wrong.

viral patrol
#

There is comand kappagen in default commands

#

just add alias to it

spark carbon
#

Now everything works, thanks.@viral patrol

viral patrol
#

No problem mate.

#

But remember, somebody without points will trigger kappagen

#

but won't redeem an item

spark carbon
#

@viral patrol I created the item in the store.
Let's say: A lot of emotes. Command !buy kappa
But the bot does not buy it. I want the notification to work after the purchase on the stream.
How can this be done?

green yarrow
#

okay... last time now...
Why doese it need to be a Store item?

#

whats the point?
If you want that the command cost loyalty points why not make it so the command cost something?

viral patrol
#

Wait. So you basically wanted to allow people to trigger kappagen for a price?

green yarrow
#

its fairly easy to make that in the command settings of !kappagen

viral patrol
#

I thought you wanted "buy an item AND trigger kappagen". For example "Buy a porsche and trigger kappagen show"

spark carbon
#

The viewer opens the store, and sees there everything that is available.

green yarrow
#

but kappagen isnt a Item and it will be super hard to trigger that since the bot doesnt trigger its own command

spark carbon
#

I can just point out there's such a team.
But I wanted to automate this.
As with music, you buy - it immediately turns on.
I realized that it would not work out with Kappagen.

green yarrow
#

you can make a store Item showing that Kappagen excists and show people how to use it and this will cost points

#

no one know immediately how to use SongRequests and thats also not a Store item I guesse?
make a informing Command like
!Commands
-Kappagen :200 points - Unlesh emotes on screen
-SongRequest: 50 Points - Use !SR Youtube URL to que music
-Test Command:40 Points - What ever this should do

ETC

Or put it into your pannels or something I think this will be easier for you to configurate

spark carbon
#

I understood you perfectly.
But i noticed how the purchase of items with audio was realized.
You buy - immediately the music plays. + Widget that shows who bought and what.
In the case of Kappagen, this will not work.
If the viewer goes to 'streamelements.com/vvv/store' then he simply can click on the buy button, this simplifies the whole process a little.
For me, this is a small problem, I just wanted to simplify it a bit.
Thank you all for helping once again.

young saffron
#

@viral patrol i wasa wondering if you might be able to answer a question regarding the wheel of fortune alert you created?

viral patrol
#

I think I can do that in 12 hours as I have BBQ now

gusty turret
#

BBQ? what are you? murican? xd @viral patrol

mortal wagon
#

How can i fix this URL to work for me im moving from phantom bot to SE and this API is causing issues

$(customapi (encodeurl https://api.thetwitchapi.site/define?term=(echo)))
viral patrol
#

European actually. But not everyone is aware of grilling instead of BBQ

#

Chris try to provide pathencode on term with param instead of encode URL

mortal wagon
#

im a noob... speak baby please

viral patrol
#

I am on my phone so this is hard to type

#

Gonna try copy paste

#

Something like that

mortal wagon
#

hmmm let me try

#

it

indigo flume
#

@round rampart How about you stop that!

viral patrol
#

Ch

mortal wagon
#

ris Kappa

viral patrol
#

@mortal wagon as I told. I am on my phone so it may be wrong

#

Search this channel for pathescape to get proper syntax

mortal wagon
#

LUL

indigo flume
#

moVe* the : behind the 1?

viral patrol
#

From search results

mortal wagon
viral patrol
#

Check my last paste

#

Different brackets and a spacing

mortal wagon
#

so that ?

viral patrol
mortal wagon
#

RIP

#

same responce

viral patrol
#

Ah and opening bracket

indigo flume
#

${customapi https://api.thetwitchapi.site/define?param=${{pathescape ${1:}}}

#

Let me help you...like so?

#

I see one too many brackets cohhDerp

viral patrol
#

TY KeiZar

mortal wagon
#

bad request @indigo flume

indigo flume
#

${customapi https://api.thetwitchapi.site/define?param=${pathescape ${1:}}

viral patrol
#

I hate typing code on phone

indigo flume
#

You can still use double ` right?

mortal wagon
indigo flume
#

${customapi.https://api.thetwitchapi.site/define?param=${pathescape ${1:}}

#

missing dot and I'm not sure why so many brackets

viral patrol
#

Change Param to term in code

indigo flume
#

${customapi.https://api.thetwitchapi.site/define?term=${pathescape ${1:}

viral patrol
mortal wagon
#

Nope

#

๐Ÿ˜ฆ

#

Same responce

#

^ like that

indigo flume
#

why so many brackets at the end KiwiConfused

viral patrol
#

Ok. Gonna get out of bed to my pc

mortal wagon
#

but the new code

viral patrol
#

@indigo flume so many brackets, because each opening bracket has to have closing one

indigo flume
#

${customapi.https://api.thetwitchapi.site/define?term=${{pathescape ${1:}}}

#

I know that for each opening you need a closing, but it doesn't make sense to me to have 2 opening at term=${{pathescape ${1:}}}

#

well if you are back on your PC(sorry for getting you out of bed DekuBang ), then Chris is saved

#

peace out DAB

viral patrol
#

${customapi.https://api.thetwitchapi.site/define?term=${pathescape ${1:}}}

#

Here you are

#

so back to bed ๐Ÿ˜‰

indigo flume
#

I can't count cohhFail

#

I just stretched discord a bit and saw my own mistake with the brackets GunR cohhDerp

viral patrol
#

KeiZar look on second character of response ;)

indigo flume
#

Ignore me, I had discord squished so the entire thing was on 2 rows and I could not follow the start and ending brackets properly GunR cohhDerp

viral patrol
#

@mortal wagon is it ok? I tested it but I want to have confirmation

mortal wagon
#

1sec

#

WE DID IT

young saffron
#

@viral patrol im free whenever so feel free to DM me or in here when you are ready

charred tundra
#

Is it just me or do CSS animations for custom alerts show inconsistently in the editor? Sometimes there's a lag between elements, other times no. But so far the tests in actual OBS seem okay.

#

I just don't want to kill myself trying to perfect it if this isn't going to be an issue live

floral fable
#

It is not just you, I have seen this before as well, I find it best to test the CSS for alerts in OBS

charred tundra
#

Thanks Kite, good to confirm!! Will continue to do so then ๐Ÿ˜ƒ

foggy fulcrum
#

I'm wondering if anyone can point me in the direction of using the SE api for the sub wheel of fortune points widget from #widget-share ....as I'd like the points to be added automatically.

Also, ever have issue's with the animation/points not firing off properly in OBS??

#

part in question:

4* ADVANCED USERS ONLY: If you want points to be automatically added, paste URL to your endpoint of SE API (ADCANCED USERS ONLY)
*/
let URL_TO_SCRIPT = ''; //Set value of this to your API man-in-the-middle if you want points to be added automatically. Request sent is GET URL_TO_SCRIPT?name=SUB_NAME&prize=PRIZE
#

@viral patrol โฌ† i saw you were taking questions on it yesterday, sorry if it was rude to tag you

wet bramble
#

I have a "is anyone here" question. Anyone here great at working the chat bots to change color when certain text is posted? Thank you.

viral patrol
#

hi. You need a webhost account with PHP and SSL ( can be let's encrypt). Or local Apache server might work as well (as browser don't trigger protocol mismatch on localhost calls)

#

@foggy fulcrum

foggy fulcrum
#

@viral patrol ok so it's nothing that just calls to the SE API on its own, it relies on a script in between.... Don't know that much about coding so likely won't happen anytime soon lol

Thanks for the response at least :)

viral patrol
#

Script in the middle is to not paste jwt token in overlay

stable wind
#

About the /points/{channel}/{user}/{amount} Endpoint:
Do I see it correctly, that the API will not throw an error, if I deduct more than a user owns?

Wouldn't it make much more sense to throw an 400 Bad Request?

raw gazelle
#

is there an api endpoint to add custom notifications for a stream?

cinder lintel
#

I am going to answer yes to that, because I know there is one, but I don't know what it is xD

#

mainly because 1upcoin integrated alerts into our system through the api

raw gazelle
#

hmm. maybe through /tips endpoint?

mild current
#

Hi, can anyone help me out with something?

I'm creating a "movie credits" type custom event list, and I'm trying to put data in the credits, but I'm unsure of a few things:

  • Is there a list somewhere that displays the variables that streamelements uses for javascript?

  • Is there a way to make it so that duplicate supporters do not appear?

cinder lintel
#

for the first, there is a pinned message with that information. for the second, that would be something you set up programatically

mild current
#

Ah I see it, thank you

nova hedge
#

Is there any documention/endpoints with getting an OAuth token with redirect URi's and the whole nine?

#

As well as getting a
client_key or clientid and secret

cinder lintel
#

not at this time, as I do not believe that oauth has been implemented yet, just planned

nova hedge
#

Uhhh, that sucks. I'm the president of Lumia Twitch and we've been tweeting with Streamelements for the past month or two. Now that we promised to finally implement Stream Elements into Lumia i'm just being told it can't be done at the time being?

cinder lintel
#

There is a JWT authorization key that is used in the API, which other systems have used to integrate with our system. But as far as I know (and I will ask to make sure), oauth isn't possible yet

nova hedge
#

Yeah I guess we could point the users to manually get the JWT Token, but we really want to avoid manual things like that

#

It just opens up a lot more issues that could happen and will be directed to us. Please @ me when you get a response about the oauth

lost holly
#

Does anyone have an api for doing simple math? i want to do the following equation: 150-$(channel.followers)

viral patrol
#

@lost holly Bot response ${customapi.http://api.mathjs.org/v4/?expr=150-${channel.followers}} should do the trick

cinder lintel
#

you would have to use the API (in the channel header)

cinder lintel
#

in the api docs

viral patrol
#

You can do it two ways:

  • connect to api and refresh state of latest event - as SE API has no push
  • create JS code to push every single event to your endpoint. for example pushing to http://localhost/newEvent/ with post params:
type=> sub,
amount=>3,
user=>MrBean,
message=>Great time mate,
tier=>2
#

But there is no ready to go solution for that, maybe converting alerts to SE environment would be easier?

lost holly
#

@viral patrol thank you so much

low sierra
#

@viral patrol thanks for the math API! That can be very useful ๐Ÿ˜ƒ

mild cipher
#

Is there any way to send test events to the SE socket? I tried emulating events from the overlay editor but it doesn't go through. (I'm guessing it's only specific to the overlay link). Replaying the event from the dashboard doesn't seem to send anything either.

Triggering an event in chat like a redemption works fine, but it's a bit harder to test things like subs/resubs/cheers/tips.

mortal wagon
#

Anyone up for some fun converting a SL Events list to SE ๐Ÿ˜› (im a noob and still learning).

quartz gull
#

Maybe a noob question but when using custom CSS and testing the event on for example follower {name} in the html doesnt get replaced by the name of the testsubject. Should I use some other variable?

honest bone
#

{{name}} i think @quartz gull

quartz gull
#

awesome, that works ๐Ÿ˜ƒ

quartz gull
#

another question, can you link to a remote .css file instead of having to edit the css at every alert (for easier updates in the future)?

livid lotus
#

@viral patrol do you know?

viral patrol
#

You can. Check pinned message for details

quartz gull
#

cool ty

round pier
#

Can anyone help me my chat commands is replying the same message like if i set points its not mentioning the user name when asked in live but its saying only user

viral patrol
#

Bot response should be like @${user} has ${user.points} ${pointsname}

bleak willow
#

Been having words with Scalper About the possibility of Editing watch time Scalper thinks there is a way through the API, as he saw something about it a month or so ago Anyway of doing such thing? ๐Ÿค”

jaunty lintel
#

I'm having an issue using the API to pick a winner of a contest. I'm getting the correct "Created" response, but the winner is not being chosen

#

Nevermind, Camel Case strikes again (winnerId not winnerID)

woven field
#

Hi, can i ask for some help in javascript here ? or maybe not ? ๐Ÿ˜ƒ

viral patrol
#

Of course you can

mortal wagon
#

Anyone available for hire who does HTML & CSS ??

dusk trench
#

hey guys whats the escape character to use parenthesis without them being recognized as an arg? im trying to go to a math api and use a log function but the command does not like the () on either side of my argument

viral patrol
#

Oh... Wonderful...

#

${customapi.http://api.mathjs.org/v4/?expr=${pathescape ${1:}}}

#

Fixed

dusk trench
#

${customapi.twitch.center/customapi/math?expr= log( ${1}/${user.points} ) / log(2) } is my command

#

i need the parenthesis around the log

bleak willow
#

Would you happen to know the answer to my question @viral patrol ?

warm lark
#

Help, i cannot find the message pertaining to bit boss custom coding.

cinder lintel
#

What happens when you search this: from: lx#9027 in: #developers-api boss

warm lark
#

Who me?

cinder lintel
#

yeah

warm lark
#

I don't know how to search

cinder lintel
warm lark
#

I get 28 pages worth of results