#Cannot find module

1 messages · Page 1 of 1 (latest)

warm reef
#

Hey I am new to discord.js and I want to set the ActivityTypes Enum corresponding to a key in my json file. This does not work, but anyways I get the following error when trying to run may script:

script.js

const token = require("./token.json")
const settings = require("./settings.json")

const {Client, Intents} = require("discord.js");
const {ActivityTypes} = require("discord.js/typings/enums");

const bot = new Client({intents: [new Intents(32767)]});

bot.once("ready", ()=>{
    console.log(`Logged in as ${bot.user.tag}`)
    bot.user.setActivity(settings.bot.activity.name,{type: ActivityTypes.PLAYING})
})


bot.login(token.id);

Error

[nodemon] restarting due to changes...
[nodemon] starting `node src/main.js`
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'discord.js/typings/enums'

If I use "PLAYING" instead of ActivityTypes.PLAYING it works fine...

I appreciate any help 👍🏻 😅