#Why can i not read message.content?
1 messages · Page 1 of 1 (latest)
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
no
not you
Intent.flag.guilds_nessages
message content intent will be available 30 april 2022
Mesages
I think the event is wrong
Tick on discord developer portal
not the same
add guilds too
messageCreate
And the settings in developer portal
yeah the event
@valid crystal enjoy being assisted by so many people. It rarely happens
Did you use discord v12 code just copy to v13?
Thanks
... You can't do that...
lmao
Fair enough
Change all the code, even just send a message
I'm not copying the whole bot
change the event to messageCreate
Message.channel.send(embed) to .send({embeds: [embed]})
Ah ok
?
you get no errors?
I get nothing
.log({ content: message })
No
Oh fuck
I want it to log the whole thing
Its console lmao
console.log(message.content) instead of just message
Wait i didn't do that one sec
And do this ^
Just log the message fair enough
ok
Message.content would be better if he just want message, he doesn't want object
No
Still nothing
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
the messageCreate event havent emitted
Which setting is disabled and which setting is enabled?
you get no errors?
No errors
Oh so administrator is not enough?
And you playing Minecraft while so many people helping lol, close that window
you sure you have your bot on the server right, just asking
what client setting?
It is
Isn't it that?
O
Setting
Go to bot
I mean app
And that the list of settihs
Settings
Yes that
Enable it
Can you try recreate the bot?
Nothing C & P
what is that
Copy & paste
Ok
I'm on phone it's so hard to type
Alright, i'll start from the beginning
const {Client, Intents}
= require (discord.js)
With "
Lemme type on my PC one sec
yeah got that
const client = new Client({options})
options =
Intents: [Intents.FLAG.GUILD, ...GUILDS_MESSAGE]
btw
don't C & P
you need to retype some of it
show your terminal @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
why the const Discord = require('discord.js');?
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,
],
});
ok
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);*/
})
'
OOOOO
It worked
I just needed both intents
Why
I don't know
I thought that guild_messages would be enough
or guilds
yeah
np