Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Arubinu committed Feb 22, 2023
1 parent a8cb8b7 commit 70c0fa6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 42 deletions.
48 changes: 16 additions & 32 deletions addons/twitch/twurple.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('Follow', null, null, null, {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
},
Expand All @@ -586,28 +586,12 @@ async function connect(clientId, accessToken, callback) {
}));
});

// Subscribes to events that represent a user subscribing to a channel.
ws_listeners.ChannelSubscription = await ws_listener.subscribeToChannelSubscriptionEvents(channel.id, async e => {
callback(await get('Subscription', null, null, null, {
user: {
id: e.userId,
type: '',
name: e.userName,
display: e.userDisplayName
},
data: {
tier: e.tier,
isGift: e.isGift
}
}));
});

// Subscribes to events that represent a user gifting a subscription to a channel to someone else.
ws_listeners.ChannelSubscriptionGift = await ws_listener.subscribeToChannelSubscriptionGiftEvents(channel.id, async e => {
callback(await get('SubscriptionGift', null, null, null, {
user: {
id: e.gifterId,
type: '',
type: undefined,
name: e.gifterName,
display: e.gifterDisplayName
},
Expand All @@ -625,7 +609,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('SubscriptionMessage', null, null, null, {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
},
Expand All @@ -644,7 +628,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('SubscriptionEnd', null, null, null, {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
},
Expand All @@ -660,7 +644,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('Cheer', null, null, null, {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
},
Expand Down Expand Up @@ -712,7 +696,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('CharityDonation', null, null, null, {
user: {
id: e.donorId,
type: '',
type: undefined,
name: e.donorName,
display: e.donorDisplayName
},
Expand Down Expand Up @@ -747,7 +731,7 @@ async function connect(clientId, accessToken, callback) {
let obj = {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
},
Expand Down Expand Up @@ -777,7 +761,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('Unban', null, null, null, {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
},
Expand Down Expand Up @@ -813,7 +797,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('ModeratorRemove', null, null, null, {
user: {
id: e.userId,
type: '',
type: undefined,
name: e.userName,
display: e.userDisplayName
}
Expand All @@ -825,7 +809,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('RaidFrom', null, null, null, {
user: {
id: e.raidingBroadcasterId,
type: '',
type: undefined,
name: e.raidingBroadcasterName,
display: e.raidingBroadcasterDisplayName
},
Expand All @@ -840,7 +824,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('RaidTo', null, null, null, {
user: {
id: e.raidedBroadcasterId,
type: '',
type: undefined,
name: e.raidedBroadcasterName,
display: e.raidedBroadcasterDisplayName
},
Expand Down Expand Up @@ -924,7 +908,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('RedemptionAdd', null, null, null, {
user: {
id: e.raidedBroadcasterId,
type: '',
type: undefined,
name: e.raidedBroadcasterName,
display: e.raidedBroadcasterDisplayName
},
Expand All @@ -945,7 +929,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('RedemptionUpdate', null, null, null, {
user: {
id: e.raidedBroadcasterId,
type: '',
type: undefined,
name: e.raidedBroadcasterName,
display: e.raidedBroadcasterDisplayName
},
Expand Down Expand Up @@ -1166,7 +1150,7 @@ async function connect(clientId, accessToken, callback) {
callback(await get('UserUpdate', null, null, null, {
user: {
id: e.raidedBroadcasterId,
type: '',
type: undefined,
name: e.raidedBroadcasterName,
display: e.raidedBroadcasterDisplayName,
description: e.userDescription,
Expand Down Expand Up @@ -1306,7 +1290,7 @@ async function get(type, msg, message, user, merge) {
}

return Object.assign({
id: msg.id,
id: msg.id || msg.targetMessageId,
type: (is_command ? 'Command' : type),
date: (msg.date ? msg.date : (msg.redemptionDate ? msg.redemptionDate : (new Date()).toISOString())),
channel: Object.assign({}, channel),
Expand All @@ -1323,7 +1307,7 @@ async function get(type, msg, message, user, merge) {
user: { // type: mod, global_mod, admin, staff
id: (msg.userInfo ? msg.userInfo.userId : (msg.userId ? msg.userId : null)),
type: (msg.userInfo ? msg.userInfo.userType : null),
name: (msg.userInfo ? msg.userInfo.userName : (msg.userName ? msg.userName : (user || null))),
name: (msg.userInfo ? msg.userInfo.userName : (msg.userName ? msg.userName : (user || (msg.userDisplayName ? msg.userDisplayName.toLowerCase() : null)))),
display: (msg.userInfo ? msg.userInfo.displayName : (msg.userDisplayName ? msg.userDisplayName : null))
},
color: (msg.userInfo ? msg.userInfo.color : null),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Scripts-Manager",
"version": "2.0.0",
"version": "2.0.1",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
Expand Down
16 changes: 7 additions & 9 deletions scripts/multi-actions/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const functions = {

if (check) {
set_variable('twitch:message:id', receive.data.id, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:message:date', receive.data.date, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:message:type', receive.data.type, VARIABLE_TYPE.NEXT, module_name, next_data);
functions.date_to_vars(receive.data.date, 'twitch:message', VARIABLE_TYPE.NEXT, module_name, next_data);

for (const key in receive.data.user) {
set_variable(`twitch:user:${key}`, receive.data.user[key], VARIABLE_TYPE.NEXT, module_name, next_data);
Expand Down Expand Up @@ -1067,6 +1067,11 @@ const actions = {
}, type, type.toLowerCase(), (type === 'command'));
},
'outputs-twitch-follow': (module_name, receive, data, next_data, next) => functions.twitch_compare(module_name, receive, data, next_data, () => {
set_variable(['twitch:all:user:id', 'twitch:follow:user:id'], receive.data.data.userId, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable(['twitch:all:user:name', 'twitch:follow:user:name'], receive.data.data.displayName.toLowerCase(), VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable(['twitch:all:user:display', 'twitch:follow:user:display'], receive.data.data.displayName, VARIABLE_TYPE.NEXT, module_name, next_data);
functions.date_to_vars(receive.data.data.followDate, 'twitch:follow', VARIABLE_TYPE.NEXT, module_name, next_data);

next();
}, 'Follow', 'message', true),
'outputs-twitch-followers-only': (module_name, receive, data, next_data, next) => {
Expand Down Expand Up @@ -1102,7 +1107,6 @@ const actions = {
set_variable('twitch:gift-paid-upgrade:original:id', receive.data.upgrade.info.gifterUserId, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:gift-paid-upgrade:original:name', receive.data.upgrade.info.gifter, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:gift-paid-upgrade:original:display', receive.data.upgrade.info.gifterDisplayName, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:gift-paid-upgrade:plan:id', receive.data.upgrade.info.plan, VARIABLE_TYPE.NEXT, module_name, next_data);

next();
}
Expand Down Expand Up @@ -1253,9 +1257,6 @@ const actions = {
},
'outputs-twitch-raid-cancel': (module_name, receive, data, next_data, next) => {
if (receive.id === 'twitch' && receive.name === 'RaidCancel') {
set_variable('twitch:raid:channel', '', VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:raid:count', 0, VARIABLE_TYPE.NEXT, module_name, next_data);

next();
}
},
Expand All @@ -1282,9 +1283,7 @@ const actions = {
set_variable(['twitch:all:user:id', 'twitch:redemption:user:id'], receive.data.user.id, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable(['twitch:all:user:name', 'twitch:redemption:user:name'], receive.data.user.name.toLowerCase(), VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable(['twitch:all:user:display', 'twitch:redemption:user:display'], receive.data.user.display, VARIABLE_TYPE.NEXT, module_name, next_data);

set_variable('twitch:redemption:id', receive.data.reward.id, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:redemption:status', receive.data.reward.status, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:redemption:title', receive.data.reward.title, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:redemption:prompt', receive.data.reward.prompt, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:redemption:cost', receive.data.reward.cost, VARIABLE_TYPE.NEXT, module_name, next_data);
Expand All @@ -1307,7 +1306,6 @@ const actions = {
set_variable('twitch:reward:count', receive.data.reward.info.count, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:reward:domain', receive.data.reward.info.domain, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:reward:shared', receive.data.reward.info.gifterGiftCount, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:reward:trigger', receive.data.reward.info.triggerType, VARIABLE_TYPE.NEXT, module_name, next_data);

next();
}
Expand All @@ -1316,8 +1314,8 @@ const actions = {
set_variable(['twitch:all:user:id', 'twitch:ritual:user:id'], receive.data.user.id, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable(['twitch:all:user:name', 'twitch:ritual:user:name'], receive.data.user.name, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable(['twitch:all:user:display', 'twitch:ritual:user:display'], receive.data.user.display, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:ritual:name', receive.data.ritual.info.ritualName, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:ritual:message', receive.data.ritual.info.message, VARIABLE_TYPE.NEXT, module_name, next_data);
set_variable('twitch:ritual:ritual', receive.data.ritual.info.ritualName, VARIABLE_TYPE.NEXT, module_name, next_data);

next();
}, 'Ritual', 'user', true, () => receive.data.ritual.user),
Expand Down

0 comments on commit 70c0fa6

Please sign in to comment.