Death
DIAdiscord.js - Imagine an app
•Created by Death on 8/7/2023 in #djs-questions
Get a guild object inside an express API route
I am trying to make my bot do some changes to our server based on a request to our API endpoint.
in the index.js I am starting the server and the bot, then exporting the bot to access the client on the API route.
index.js
In the route I want the bot to make changes in:
create.js
This gives me a type error
TypeError: Cannot read properties of undefined (reading 'create')
The guild I fetch is an object that only has a few properties and I can't access properties like roles, channels...etc
How can I change the fetched guild into an object to access roles and other properties and methods?5 replies