Need Help fixing Site

Can someone please help me fix this issue:

    85| <div style="padding: 35px 20px 20px 35px">
    86| <div class="row">
 >> 87|   <% topBots.forEach(theBot => { if (!bot.users.get(theBot.id)) bot.users.get(theBot.id) = { presence: { status: "offline" }, username: theBot.name  } %>
    88|     <%- include("blocks/card.ejs", { theBot, bot }); %>
    89|   <% }); %>
    90| </div>

Invalid left-hand side in assignment
    at topBots.forEach.theBot (/app/dashboard/templates/index.ejs:55:77)
    at Array.forEach (<anonymous>)
    at eval (/app/dashboard/templates/index.ejs:55:16)
    at index (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/ejs/3.0.1/node_modules/ejs/lib/ejs.js:656:17)
    at tryHandleCache (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/ejs/3.0.1/node_modules/ejs/lib/ejs.js:254:36)
    at View.exports.renderFile [as engine] (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/ejs/3.0.1/node_modules/ejs/lib/ejs.js:459:10)
    at View.render (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/view.js:135:8)
    at tryRender (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:640:10)
    at Function.render (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/rbd/pnpm-volume/c0be50ae-1897-4b8f-8e9f-3102ab309c6b/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/response.js:1012:7)
    at renderTemplate (/app/dashboard/index.js:93:9)
    at app.get (/app/dashboard/index.js:191:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)```

I tried looking into it but couldn't fix it.
topBots.forEach(theBot => {
            if (!bot.users.get(theBot.id)) bot.users.get(theBot.id) = {
                presence: {
                    status: "offline"
                },
                username: theBot.name
            }

I don’t understand what’s going on in this code. What is this supposed to display?

 at Array.forEach (<anonymous>)

Does your forEach iterator work correctly?

Do you want an invite? I can show you.

You could send screenshots of the expected output

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.