diff --git a/addons/twitch/twurple.js b/addons/twitch/twurple.js index fc7eca9..7485f3e 100644 --- a/addons/twitch/twurple.js +++ b/addons/twitch/twurple.js @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 } @@ -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 }, @@ -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 }, @@ -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 }, @@ -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 }, @@ -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, @@ -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), @@ -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), diff --git a/package.json b/package.json index 0e51eb0..026c3b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Scripts-Manager", - "version": "2.0.0", + "version": "2.0.1", "description": "A minimal Electron application", "main": "main.js", "scripts": { diff --git a/scripts/multi-actions/script.js b/scripts/multi-actions/script.js index 438b6b8..e1b3460 100644 --- a/scripts/multi-actions/script.js +++ b/scripts/multi-actions/script.js @@ -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); @@ -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) => { @@ -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(); } @@ -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(); } }, @@ -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); @@ -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(); } @@ -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),