diff --git a/discord/embed.js b/discord/embed.js index e04b9c4a..ebff9a98 100644 --- a/discord/embed.js +++ b/discord/embed.js @@ -126,8 +126,7 @@ export const renderOffers = async (shop, interaction, valorantUser, VPemoji, oth // show notice if there is one if(config.notice) { // users shouldn't see the same notice twice - const user = getUser(interaction.user.id); - if(user.lastNoticeSeen !== config.notice) { + if(valorantUser.lastNoticeSeen !== config.notice) { // the notice can either be just a simple string, or a raw JSON embed data object if(typeof config.notice === "string") { @@ -136,8 +135,8 @@ export const renderOffers = async (shop, interaction, valorantUser, VPemoji, oth } else embeds.push(EmbedBuilder.from(config.notice).toJSON()); - user.lastNoticeSeen = config.notice; - saveUser(user); + valorantUser.lastNoticeSeen = config.notice; + saveUser(valorantUser); } } diff --git a/valorant/accountSwitcher.js b/valorant/accountSwitcher.js index d68aea4a..a43590d0 100644 --- a/valorant/accountSwitcher.js +++ b/valorant/accountSwitcher.js @@ -69,9 +69,18 @@ export const addUser = (user) => { let foundDuplicate = false; for(let i = 0; i < userJson.accounts.length; i++) { if(userJson.accounts[i].puuid === user.puuid) { - user.alerts = removeDupeAlerts(user.alerts.concat(userJson.accounts[i].alerts)); + const oldUser = userJson.accounts[i]; + + // merge the accounts userJson.accounts[i] = user; userJson.currentAccount = i + 1; + + // copy over data from old account + user.alerts = removeDupeAlerts(user.alerts.concat(userJson.accounts[i].alerts)); + user.lastFetchedData = oldUser.lastFetchedData; + user.lastNoticeSeen = oldUser.lastNoticeSeen; + user.lastSawEasterEgg = oldUser.lastSawEasterEgg; + foundDuplicate = true; } }