From 7072b3a6d4eccc293c801bdfd8b823016973beb8 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 9 Jun 2020 18:50:42 +0200 Subject: [PATCH] stuff --- Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js | 2 +- Plugins/CreationDate/CreationDate.plugin.js | 2 +- Plugins/JoinedAtDate/JoinedAtDate.plugin.js | 4 ++-- Plugins/LastMessageDate/LastMessageDate.plugin.js | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js b/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js index 28fb9cd128..c7c046f1da 100644 --- a/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js +++ b/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js @@ -308,7 +308,7 @@ var CompleteTimestamps = (_ => { } getTimestamp (languageId, time) { - let timeobj = time ? time : new Date(); + let timeobj = time || new Date(); if (typeof time == "string") timeobj = new Date(time); if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time)); if (timeobj.toString() == "Invalid Date") return; diff --git a/Plugins/CreationDate/CreationDate.plugin.js b/Plugins/CreationDate/CreationDate.plugin.js index 5bf070ae22..15be4265b1 100644 --- a/Plugins/CreationDate/CreationDate.plugin.js +++ b/Plugins/CreationDate/CreationDate.plugin.js @@ -269,7 +269,7 @@ var CreationDate = (_ => { } getTimestamp (languageId, time) { - let timeobj = time ? time : new Date(); + let timeobj = time || new Date(); if (typeof time == "string") timeobj = new Date(time); if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time)); if (timeobj.toString() == "Invalid Date") return; diff --git a/Plugins/JoinedAtDate/JoinedAtDate.plugin.js b/Plugins/JoinedAtDate/JoinedAtDate.plugin.js index 93f5c7f8dd..bd9a029258 100644 --- a/Plugins/JoinedAtDate/JoinedAtDate.plugin.js +++ b/Plugins/JoinedAtDate/JoinedAtDate.plugin.js @@ -279,12 +279,12 @@ var JoinedAtDate = (_ => { else if (!loadedUsers[guildId][user.id]) requestedUsers[guildId][user.id].push(instance); else children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, { className: "joinedAtDate " + BDFDB.disCN.textrow, - children: this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(languages[formats.joinedAtDateLang].id, loadedUsers[guildId][user.id])) + children: this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(languages[choices.joinedAtDateLang].id, loadedUsers[guildId][user.id])) })); } getTimestamp (languageId, time) { - let timeobj = time ? time : new Date(); + let timeobj = time || new Date(); if (typeof time == "string") timeobj = new Date(time); if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time)); if (timeobj.toString() == "Invalid Date") return; diff --git a/Plugins/LastMessageDate/LastMessageDate.plugin.js b/Plugins/LastMessageDate/LastMessageDate.plugin.js index ad939ccd7b..6b947112c6 100644 --- a/Plugins/LastMessageDate/LastMessageDate.plugin.js +++ b/Plugins/LastMessageDate/LastMessageDate.plugin.js @@ -277,14 +277,14 @@ var LastMessageDate = (_ => { injectDate (instance, children, index, user) { if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000") return; let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId(); - let isguild = !!guildId; + let isGuild = !!guildId; guildId = guildId || BDFDB.LibraryModules.LastChannelStore.getChannelId(); if (!guildId) return; if (!loadedUsers[guildId]) loadedUsers[guildId] = {}; if (!requestedUsers[guildId]) requestedUsers[guildId] = {}; if (!BDFDB.ArrayUtils.is(requestedUsers[guildId][user.id])) { requestedUsers[guildId][user.id] = [instance]; - BDFDB.LibraryModules.APIUtils.get((isguild ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(guildId) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(guildId)) + "?author_id=" + user.id).then(result => { + BDFDB.LibraryModules.APIUtils.get((isGuild ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(guildId) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(guildId)) + "?author_id=" + user.id).then(result => { if (typeof result.body.retry_after != "number") { if (result.body.messages && Array.isArray(result.body.messages[0])) { for (let message of result.body.messages[0]) if (message.hit && message.author.id == user.id) { @@ -303,12 +303,12 @@ var LastMessageDate = (_ => { else if (loadedUsers[guildId][user.id] === undefined) requestedUsers[guildId][user.id].push(instance); else children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, { className: "lastMessageDate " + BDFDB.disCN.textrow, - children: this.labels.lastmessage_text.replace("{{time}}", loadedUsers[guildId][user.id] ? this.getTimestamp(languages[formats.lastMessageDateLang].id, loadedUsers[guildId][user.id]) : "---") + children: this.labels.lastmessage_text.replace("{{time}}", loadedUsers[guildId][user.id] ? this.getTimestamp(languages[choices.lastMessageDateLang].id, loadedUsers[guildId][user.id]) : "---") })); } getTimestamp (languageId, time) { - let timeobj = time ? time : new Date(); + let timeobj = time || new Date(); if (typeof time == "string") timeobj = new Date(time); if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time)); if (timeobj.toString() == "Invalid Date") return;