sync from github
This commit is contained in:
14
js/modules/streamlabs/images/logo-streamlabs.svg
Normal file
14
js/modules/streamlabs/images/logo-streamlabs.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 800 800">
|
||||
<!-- Generator: Adobe Illustrator 29.0.0, SVG Export Plug-In . SVG Version: 2.1.0 Build 186) -->
|
||||
<defs>
|
||||
<style>
|
||||
.st0 {
|
||||
fill: #fff;
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path class="st0" d="M239.1,449.1c0-62.2,0-93.2,12.1-117,10.6-20.9,27.6-37.9,48.5-48.5,23.7-12.1,54.8-12.1,117-12.1h88.8c62.2,0,93.2,0,117,12.1,20.9,10.6,37.9,27.6,48.5,48.5,12.1,23.7,12.1,54.8,12.1,117v25.4c0,62.2,0,93.2-12.1,117-10.6,20.9-27.6,37.9-48.5,48.5-23.7,12.1-54.8,12.1-117,12.1h-164.9c-35.5,0-53.3,0-66.8-6.9-11.9-6.1-21.6-15.8-27.7-27.7-6.9-13.6-6.9-31.3-6.9-66.8v-101.5ZM397.6,461.8c0-17.5,14.2-31.7,31.7-31.7s31.7,14.2,31.7,31.7v63.4c0,17.5-14.2,31.7-31.7,31.7s-31.7-14.2-31.7-31.7v-63.4ZM556.1,430.1c-17.5,0-31.7,14.2-31.7,31.7v63.4c0,17.5,14.2,31.7,31.7,31.7s31.7-14.2,31.7-31.7v-63.4c0-17.5-14.2-31.7-31.7-31.7Z"/>
|
||||
<path class="st0" d="M349.8,175.7c2.2,17.4-10.2,33.2-27.6,35.4-9.6,1.2-17.3,2.8-24.1,4.9-54.7,17-97.6,59.9-114.6,114.6-2.1,6.8-3.7,14.5-4.9,24.1-2.2,17.4-18,29.7-35.4,27.6-17.4-2.2-29.7-18-27.6-35.4,1.6-12.5,3.8-24,7.3-35.1,23.2-74.6,81.7-133,156.3-156.3,11.1-3.5,22.6-5.8,35.1-7.3,17.4-2.2,33.2,10.2,35.4,27.6Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
3
js/modules/streamlabs/module.css
Normal file
3
js/modules/streamlabs/module.css
Normal file
@@ -0,0 +1,3 @@
|
||||
#chat .event.streamlabs .message {
|
||||
background: rgba(128,245,210,0.75);
|
||||
}
|
59
js/modules/streamlabs/module.js
Normal file
59
js/modules/streamlabs/module.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/* ---------------------------- */
|
||||
/* STREAMLABS MODULE VARIABLES */
|
||||
/* ---------------------------- */
|
||||
|
||||
const showStreamlabs = getURLParam("showStreamlabs", true);
|
||||
|
||||
const showStreamlabsDonations = getURLParam("showStreamlabsDonations", true);
|
||||
|
||||
const streamlabsHandlers = {
|
||||
'Streamlabs.Donation' : (response) => {
|
||||
streamLabsEventMessage(response.data);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
if (showStreamlabs) {
|
||||
registerPlatformHandlersToStreamerBot(streamlabsHandlers, '[Streamlabs]');
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function streamLabsEventMessage(data) {
|
||||
|
||||
if (showStreamlabsDonations == false) return;
|
||||
|
||||
const template = eventTemplate;
|
||||
const clone = template.content.cloneNode(true);
|
||||
const messageId = createRandomString(40);
|
||||
const userId = createRandomString(40);
|
||||
|
||||
const {
|
||||
header,
|
||||
platform,
|
||||
user,
|
||||
action,
|
||||
value,
|
||||
'actual-message': message
|
||||
} = Object.fromEntries(
|
||||
[...clone.querySelectorAll('[class]')]
|
||||
.map(el => [el.className, el])
|
||||
);
|
||||
|
||||
const classes = ['streamlabs', 'donation'];
|
||||
|
||||
header.remove();
|
||||
|
||||
|
||||
var money = formatCurrency(data.amount,data.currency);
|
||||
|
||||
user.innerHTML = `<strong>${data.from}</strong>`;
|
||||
action.innerHTML = ` donated `;
|
||||
value.innerHTML = `<strong>${money}</strong>`;
|
||||
|
||||
if (data.message) { message.innerHTML = `${data.message}`; }
|
||||
else { message.remove(); }
|
||||
|
||||
|
||||
addEventItem('streamlabs', clone, classes, userId, messageId);
|
||||
}
|
Reference in New Issue
Block a user