message.content doesn’t have any value in Discord.js

Make sure you enable the message content intent on your developer portal and add the GatewayIntentBits.MessageContent enum to your intents array. Applications ↦ Settings ↦ Bot ↦ Privileged Gateway Intents You’ll also need to add the MessageContent intent: const client = new Client({ intents: [ GatewayIntentBits.DirectMessages, GatewayIntentBits.Guilds, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], partials: [Partials.Channel], }); If … Read more

message.content doesn’t have any value in Discord.js v14

Make sure you enable the message content intent on your developer portal and add the GatewayIntentBits.MessageContent enum to your intents array. Applications ↦ Settings ↦ Bot ↦ Privileged Gateway Intents You’ll also need to add the MessageContent intent: const client = new Client({ intents: [ GatewayIntentBits.DirectMessages, GatewayIntentBits.Guilds, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], partials: [Partials.Channel], });

Guild members are not populated anymore, cannot GetUserAsync as it only returns the bot and no one else

This is a result of Discord enforcing intents. Intents allow you to opt-in to certain gateway events. Currently, the GUILD_MEMBERS and GUILD_PRESENCES intents are “privileged intents” and have the following effects: GUILD_MEMBER_[ADD|UPDATE|REMOVE] requires the GUILD_MEMBERS intent to be received PRESENCE_UPDATE requires the GUILD_PRESENCES intent to be received REQUEST_GUILD_MEMBERS requires GUILD_PRESENCES intent to set presences=true requires … Read more

Discord Bot can only see itself and no other users in guild

Enable the server members intent near the bottom of the Bot tab of your Discord Developer Portal: Change the line client = discord.Client() to this: intents = discord.Intents.default() intents.members = True client = discord.Client(intents=intents) This makes your bot request the “members” gateway intent. What are gateway intents? Intents allow you to subscribe to certain events. … Read more

Python – DM a User Discord Bot

The easiest way to do this is with the discord.ext.commands extension. Here we use a converter to get the target user, and a keyword-only argument as an optional message to send them: from discord.ext import commands import discord bot = commands.Bot(command_prefix=’!’) @bot.command(pass_context=True) async def DM(ctx, user: discord.User, *, message=None): message = message or “This Message … Read more