#Receiving non slash command messages

1 messages · Page 1 of 1 (latest)

grim plover

I'm trying to receive regular guild messages that aren't slash commands. I'm aware of the privacy issues, it's just a private bot for my friends and I running a local AI model for fun.

I used to use discord.js but it's obviously changed a lot over the years e.g. slash commands and I can't figure out receiving messages without a slash command.

I've enabled all privileged gateway intents on the discord dev dashboard and here is my code.

import { Client, Events, GatewayIntentBits } from 'discord.js';
import 'dotenv/config';

const client = new Client({ 
    verbose: true,
    intents: [
        GatewayIntentBits.Guilds, 
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMessagePolls,
        GatewayIntentBits.GuildMessageReactions,
        GatewayIntentBits.GuildModeration,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.DirectMessages
    ]
});

client.on(Events.ClientReady, readyClient => {
  console.log(`Logged in as ${readyClient.user.tag}!`);
});

client.on(Events.MessageCreate, async (message) => {
    console.log(message);
});

client.on(Events.InteractionCreate, async (interaction) => {
    console.log(interaction);
});

client.login(process.env.TOKEN);```

Nothing is being logged when I send messages in the testing server (which the bot is in with full permissions).