The Specialist
DIAdiscord.js - Imagine an app
•Created by The Specialist on 5/18/2024 in #djs-questions
Send regular text in a message with an embed
So I'm trying to make my bot send a message that mentions a certain role when it sends an embed. I want the mention and embed to be in the same message if possible. If this is possible, how can I do it? A snippet of my code where the embed is sent is below.
10 replies
DIAdiscord.js - Imagine an app
•Created by The Specialist on 5/13/2024 in #djs-questions
"Cannot read properties of undefined (reading 'guilds')
Hi there. I'm pretty new to discord.js and JavaScript (I'm working on Codecademy's course as I do this) and I'm trying to create a multipurpose bot for a community I own. So far, I've followed the guide to a tee with one exception. The code below is from my ready.js file. Once the bot is ready, I want it to change its activity to say "Watching over XX SRP members" where XX is the number of members in the guild. The issue is that I keep getting errors about things being undefined. Currently, I'm getting an error about 'guilds' being undefined. I have a feeling I'm doing this all wrong and am probably in way over my head. My guess is that this is a very simple issue to solve and due to my lack of knowledge and experience, I'm having a hard time figuring this stuff out. Thank you to anyone who is able to help.
/Users/XXXXX/Documents/SRP Helper/events/ready.js:2
const Guild = client.guilds.cache.get('1215384838526472212');
^
TypeError: Cannot read properties of undefined (reading 'guilds')
at Object.<anonymous> (/Users/XXXXX/Documents/SRP Helper/events/ready.js:2:22)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/Users/XXXXX/Documents/SRP Helper/index.js:31:16)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
Node.js v20.13.1
7 replies