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

Commit

Permalink
v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Arubinu committed Feb 22, 2023
1 parent 70c0fa6 commit 1c1dfa6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
27 changes: 16 additions & 11 deletions addons/twitch/twurple.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,12 +1289,17 @@ async function get(type, msg, message, user, merge) {
}
}

let date = msg.date ? msg.date : (msg.redemptionDate ? msg.redemptionDate : new Date());
if (typeof date === 'string') {
date = new Date(date);
}

return Object.assign({
id: msg.id || msg.targetMessageId,
type: (is_command ? 'Command' : type),
date: (msg.date ? msg.date : (msg.redemptionDate ? msg.redemptionDate : (new Date()).toISOString())),
type: is_command ? 'Command' : type,
date,
channel: Object.assign({}, channel),
flags: (msg.userInfo
flags: msg.userInfo
? {
broadcaster: msg.userInfo.isBroadcaster,
founder: msg.userInfo.isFounder,
Expand All @@ -1303,19 +1308,19 @@ async function get(type, msg, message, user, merge) {
vip: msg.userInfo.isVip,
follower: ((msg.userInfo && msg.userInfo.userId) ? !!(await methods.checkFollow(false, msg.userId)) : false)
}
: null),
: null,
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 || (msg.userDisplayName ? msg.userDisplayName.toLowerCase() : null)))),
display: (msg.userInfo ? msg.userInfo.displayName : (msg.userDisplayName ? msg.userDisplayName : null))
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 || (msg.userDisplayName ? msg.userDisplayName.toLowerCase() : null))),
display: msg.userInfo ? msg.userInfo.displayName : (msg.userDisplayName ? msg.userDisplayName : null)
},
color: (msg.userInfo ? msg.userInfo.color : null),
message: (is_command ? message.substr(1) : message),
color: msg.userInfo ? msg.userInfo.color : null,
message: is_command ? message.substr(1) : message,
isCheer: msg.isCheer,
isHighlight: msg.isHighlight,
isRedemption: msg.isRedemption,
badges: (msg.userInfo ? { list: msg.userInfo.badges, info: msg.userInfo.badgeInfo } : null),
badges: msg.userInfo ? { list: msg.userInfo.badges, info: msg.userInfo.badgeInfo } : null,
emotes: { list: emotes, offsets: msg.emoteOffsets },
bits: msg.bits,
reward: {
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.1",
"version": "2.0.2",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions scripts/multi-actions/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ const functions = {
return file_path;
},
date_to_vars: (date, prefix, type, module_name, next_data) => {
if (typeof date === 'string') {
date = new Date(date);
}

set_variable(`${prefix ? (prefix + ':') : ''}date`, date.toString(), type, module_name, next_data);
set_variable(`${prefix ? (prefix + ':') : ''}date:locale`, date.toLocaleDateString(), type, module_name, next_data);
set_variable(`${prefix ? (prefix + ':') : ''}date:year`, date.getFullYear(), type, module_name, next_data);
Expand Down

0 comments on commit 1c1dfa6

Please sign in to comment.