This code is not running on sapphire

--Carlos👑2/19/2023
const { Listener } = require("@sapphire/framework");
const { ActivityType } = require("discord.js");
const ms = require("ms");

class ReadyListener extends Listener {
  run(client) {
    console.log(`${client.user.tag} is online!`);

    let statuses = [
      { name: `status name 1`, type: ActivityType.Watching },
      { name: `status name 2`, type: ActivityType.Listening },
    ];

    let currentStatus = 0;

    setInterval(() => {
      client.user.setPresence({
        activities: [statuses[currentStatus]],
      });

      currentStatus = (currentStatus + 1) % statuses.length;
    }, ms("13"));
  }
}

module.exports = {
  ReadyListener,
};
AOAnswer Overflow2/19/2023
Kkyra2/19/2023
I don't think the pieces loader really loads properties from module.exports, only exports.* and module.exports
Kkyra2/19/2023
Try module.exports = ReadyListener; or exports.ReadyListener = ReadyListener;
Kkyra2/19/2023
Alternatively, if you can make the switch to ESM, you'll be able to do export class ReadyListener ..., which may look less boilerplate-y
Solution
--Carlos👑2/20/2023
figured it out, to anyone else that has this problem just add async before the run and also add this code before the async run(client) {} part

  constructor(context, options) {
    super(context, {
      ...options,
      once: true,
    });
  }


there was also missing s in ms() (below currentStatus = (currentStatus + 1) % statuses.length;)
AOAnswer Overflow2/20/2023
FFavna2/20/2023
async doesnt matter if the function doesnt await anything. You should learn what async actually does before you add it to any place willy nilly.

Adding the constructor is purely optional, though you would want to run the ready listener only once so it's a good addition nonetheless.

the syntax error however is an issue because when JS encounters a syntax error it will simply not execute the code
FFavna2/20/2023
we do support this export syntax.