I dont know if i used it wrong or made an error in it
So I have an index.js file that has lots of features, but the one that i have error in, is that someone dm's the bot !startquiz and it starts a quiz for them. When I dm the bot it says nothing. I don't know if I did something wrong, but help me. These are the guilds I use: GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessageTyping
And these where the dm quiz part is: client.on(Events.MessageCreate, async (message) => {
if (message.content.toLowerCase() === '!startquiz') {
if (message.guild) {
message.author.send(
Áhh... Mr | Ms ${message.author.username}! Lássuk, mely házba kerülsz pár rövid kérdéssel!
).catch(console.error);
let index = 0;
const answers = [];
const askQuestion = async () => {
if (index < questions.length) {
const question = questions[index];
let embed = new EmbedBuilder()
.setTitle(Kérdés ${index + 1}
)
.setDescription(question.question)
.addFields(
{ name: "A", value: question.options.A },
{ name: "B", value: question.options.B },
{ name: "C", value: question.options.C },
{ name: "D", value: question.options.D }
)
.setColor("RANDOM");8 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPIf you want my whole index.js code, here and correct things that makes it slower or should be corrected to be cooler, better or anything: https://sourceb.in/NRvvOvrHTh
missing channel partial
Uhm what is that sir?
Thanks, let me read it.
This is what I added and it still doesnt work: const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessageTyping
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction]
you check if the message is in a guild
if you dm the bot, it wont be in a guild
also 'RANDOM' is not a color, Random is
okay ill try