Code Update
Hi all, just a quick one.
I'm updating from v12 to v13, and need to amend about 90% of the bot's code. Once I've got the first part, I should be able to work out the rest, but can someone please help me with the updated code line for the following, please?
Many thanks in advance
13 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.Structures were removed entirely in v13
What do I need to be using instead, please? This is the error I have on my console:
/home/container/structures/Guild.js:3
const Guild = Structures.get('Guild')
^
TypeError: Cannot read properties of undefined (reading 'get')
at Object.<anonymous> (/home/container/structures/Guild.js:3:26)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/container/index.js:1:1)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
Node.js v17.9.1
You can use the Guild exported from discord.js.
Not sure what you'd need either though.
So can I just remove that entire line, then?
If you are not using the variable you declare there anywhere, sure.
My concern is that there are quite a few modules that do use that constant, so I do need to define it
Then you can use the class directly exported from discord.js.
And where do I need to go to find that, please?
I don't quite understand, what do you mean?
Where would I find the "class directly exported from discord.js" so that I can make sure it is defined?
You mean how to import it? The same as you did with Structures.
It's so long since I created the bot, I can't remember how I imported
Literally only have: