Discord bot - setting presence (SOLVED)

Hello, I am new to starting a discord bot project with the slash commands. I am trying to use some code from an old bot of mine to try and set the presence on my new bot. When launching, I get the console message and my bot goes online… status does not set.

The documentation I have been following:
Discord documentation

Here is my code below:

botpresence.cjs

const {
  Discord,
  Client,
  Intents,
  GatewayIntentBits,
  ActivityType,
} = require("discord.js");
const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildPresences,
    GatewayIntentBits.DirectMessages,
  ],
});

module.exports.namedCjsExport = function namedCjsExport() {
  client.once("ready", () => {
    client.user.setPresence("Watching Dev", { type: "WATCHING" });
    setInterval(() => {
      client.user.setPresence("Watching Dev", { type: "WATCHING" });
    }, 60000);
  });
};

console.log("Bot is online!");

client.login(
  "TOKEN"
);

app.js

import defaultCjsExport, { namedCjsExport } from './botpresence.cjs';
namedCjsExport()
import "dotenv/config";
import express from "express";
import { InteractionType, InteractionResponseType } from "discord-interactions";
import {
  VerifyDiscordRequest,
  getRandomEmoji,
  DiscordRequest,
} from "./utils.js";

const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.json({ verify: VerifyDiscordRequest(process.env.PUBLIC_KEY) }));


app.post("/interactions", async function (req, res) {
  const { type, id, data } = req.body;

  if (type === InteractionType.PING) {
    return res.send({ type: InteractionResponseType.PONG });
  }

  if (type === InteractionType.APPLICATION_COMMAND) {
    const { name } = data;

    if (name === "test") {
      return res.send({
        type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
        data: {
          content: "Finally online and responding     " + getRandomEmoji(),
        },
      });
    }

    if (name === "test2") {
      return res.send({
        type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
        data: {
          content: "Going in for a second command",
        },
      });
    }
  }
});

app.listen(PORT, () => {
  console.log("Listening on port", PORT);
});

Sorry realized code was wonky from some other awkward attempts. I just put it back to the closest I had gotten!

Looking for some help still pretty please :upside_down_face:

is all that cjs working with the import statement?

It appears so, I can’t see the bot online in the console and it is outside of the statement. It just doesn’t set the bot presence

is it worse now than when you made the original post? what changed since then specifically?

Honestly nothing changed to much, just didn’t look like a good flow and this code set up seemed the most clean with the most success.