#Why can i not read message.content?

1 messages · Page 1 of 1 (latest)

vocal verge
#

There can be a lot of causes. Show us message

valid crystal
#

My bot is online

#

Is in my server

#

I tried console.logging message

#

And i get nothing

#

When i type in a channel

#

I just created the bot

#

Ohhh

#

I am used to discord.js 12

simple anchor
#

no

near rapids
#

Intents.FLAGS.GUILD_MESSAGES

#

?

simple anchor
#

not you

pastel vigil
#

Intent.flag.guilds_nessages

simple anchor
#

message content intent will be available 30 april 2022

pastel vigil
#

Mesages

valid crystal
#

So I did that and it still doesn't work

vocal verge
pastel vigil
#

Tick on discord developer portal

simple anchor
#

not the same

simple anchor
fleet lichen
#

messageCreate

pastel vigil
#

And the settings in developer portal

near rapids
#

yeah the event

vocal verge
#

@valid crystal enjoy being assisted by so many people. It rarely happens

pastel vigil
#

Did you use discord v12 code just copy to v13?

valid crystal
#

tes

#

Yes

pastel vigil
#

... You can't do that...

valid crystal
#

lmao

valid crystal
pastel vigil
#

Change all the code, even just send a message

valid crystal
#

I'm not copying the whole bot

near rapids
#

change the event to messageCreate

pastel vigil
#

Message.channel.send(embed) to .send({embeds: [embed]})

valid crystal
#

Ah ok

pastel vigil
#

And btw recreate the codebase

#

To a better one

#

Remove the unnecessary codes

valid crystal
#

Alright then

#

messageCreate still does not work

pastel vigil
near rapids
#

you get no errors?

valid crystal
#

I get nothing

dry crow
pastel vigil
dry crow
#

Oh fuck

valid crystal
#

I want it to log the whole thing

dry crow
#

Its console lmao

near rapids
#

console.log(message.content) instead of just message

valid crystal
dry crow
pastel vigil
valid crystal
#

ok

pastel vigil
#

The whole object seems better

#

For me

dry crow
pastel vigil
#

No

valid crystal
#

Still nothing

pastel vigil
#

There shouldn't be error

#

Coz it's client.on

#

It's callback

#

If it didn't find callback it just ignore

#

I mean

#

The arg

near rapids
#

the messageCreate event havent emitted

pastel vigil
valid crystal
#

Administrator

#

Hold on lemme try again

pastel vigil
#

?

#

Wdym

#

I mean the bot settings

#

And enable the receive messages one

near rapids
#

you get no errors?

valid crystal
#

No errors

valid crystal
pastel vigil
#

And you playing Minecraft while so many people helping lol, close that window

pastel vigil
#

Ss

valid crystal
#

I gave the bot admin

#

Yeah me too

pastel vigil
#

The client setting

near rapids
#

you sure you have your bot on the server right, just asking

valid crystal
#

what client setting?

pastel vigil
#

Idk I think I spell it wrong

valid crystal
pastel vigil
#

The client

valid crystal
#

O

pastel vigil
#

Setting

#

Go to bot

#

I mean app

#

And that the list of settihs

#

Settings

#

Yes that

valid crystal
#

I'm blind

#

I found it

pastel vigil
#

Enable it

valid crystal
#

BURH

#

Still nothing

#

Even after i enabled that

#

yes

#

yez

pastel vigil
#

Nothing C & P

valid crystal
#

what is that

pastel vigil
#

Copy & paste

valid crystal
#

Ok

pastel vigil
#

I'm on phone it's so hard to type

valid crystal
#

Alright, i'll start from the beginning

pastel vigil
#

const {Client, Intents}

#

= require (discord.js)

#

With "

#

Lemme type on my PC one sec

valid crystal
#

yeah got that

pastel vigil
#

const client = new Client({options})

#

options =

#

Intents: [Intents.FLAG.GUILD, ...GUILDS_MESSAGE]

#

btw

#

don't C & P

#

you need to retype some of it

near rapids
#

show your terminal @valid crystal

valid crystal
#
const { Client, Intents } = require('discord.js');
const Discord = require('discord.js');
const bot = new Client({ intents: [Intents.FLAGS.GUILD_MESSAGES] });
const credentials = require("./credentials.json");
const token = credentials['token'];
bot.on('messageCreate', async message => {
    console.log(message.content);
})
bot.on('ready', async () => {
    console.log('This bot is online!');
});
bot.login(token);
#

what

pastel vigil
valid crystal
#

and still nothing

#

oh

#

that's a good question

#

Removed that

pastel vigil
#
const { /*Collection, */Intents, Client/*, Permissions, MessageEmbed*/ } = require('discord.js');
//const fs = require('fs');

const client = new Client({
    intents: [
        //Intents.FLAGS.DIRECT_MESSAGES,
        Intents.FLAGS.GUILDS,
        Intents.FLAGS.GUILD_MESSAGES,
        //Intents.FLAGS.GUILD_MEMBERS,
        //Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
        //Intents.FLAGS.GUILD_VOICE_STATES,
        //Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
        //Intents.FLAGS.GUILD_BANS,
        //Intents.FLAGS.GUILD_INVITES,
        //Intents.FLAGS.GUILD_WEBHOOKS,
    ],
});
valid crystal
#

ok

pastel vigil
#

client.on("messageCreate", async message => {
console.log(message);
/*
    let Prefix = config.prefix;
    if (message.author.bot || !message.guild || message.webhookId) return;
    if (!message.content.startsWith(Prefix)) return;

    const requirePerms = new Permissions([
        Permissions.FLAGS.SEND_MESSAGES,
        Permissions.FLAGS.EMBED_LINKS,
    ])

    if (!message.channel.permissionsFor(message.guild.me).has(requirePerms)) {
        if (message.channel.permissionsFor(message.guild.me).has(Permissions.FLAGS.SEND_MESSAGES)) {
            message.reply("I need the permission to send embeds, please give me send embed permission!");
        }
        return
    }

    let args = message.content.slice(Prefix.length).trim().split(/ +/g);
    let cmd = args.shift().toLowerCase();

    let command = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd));

    if (!command) return;
    if (cooldown.indexOf(message.guild.id) != -1) return message.reply('Please do not spam commands');
    console.log(`User: ${message.author.tag}, used command: -${cmd}, in guild: ${message.guild.name}`);

    command.run(client, message, args);

    cooldown.unshift(message.guild.id);
    setTimeout(() => {
        try {
            cooldown.splice(cooldown.indexOf(message.guild.id), 1);
        }
        catch {
            console.error();
        }
    }, 2000);*/
})
valid crystal
#

'

#

OOOOO

#

It worked

#

I just needed both intents

#

Why

#

I don't know

#

I thought that guild_messages would be enough

#

or guilds

pastel vigil
#

yeah

valid crystal
#

I thought you wanted me to replace

#

Sorry

#

but thank you

pastel vigil
#

np