How to solve a “429: Too Many Requests” when running discord.py bot on repl.it?

Other than avoiding the error, there’s a way to get around it. If discord.errors.HTTPException: 429 appears in the console on replit, just use the command kill 1 in the shell. This command completely exits the script, and when you click run again it will run from a different IP Address, bypassing the Discord rate limit. … Read more

Discord.js: Invalid bitfield flag or number: GUILDS

In discord.js v14, intent flags are available from GatewayIntentBits. const { Client, GatewayIntentBits } = require(‘discord.js’); const client = new Discord.Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, ] }) List of changes: v12/v13 v14 GUILDS GatewayIntentBits.Guilds GUILD_BANS GatewayIntentBits.GuildBans GUILD_EMOJIS_AND_STICKERS GatewayIntentBits.GuildEmojisAndStickers GUILD_INTEGRATIONS GatewayIntentBits.GuildIntegrations GUILD_INVITES GatewayIntentBits.GuildInvites GUILD_MEMBERS GatewayIntentBits.GuildMembers GUILD_MESSAGE_REACTIONS GatewayIntentBits.GuildMessageReactions GUILD_MESSAGE_TYPING GatewayIntentBits.GuildMessageTyping GUILD_MESSAGES GatewayIntentBits.GuildMessages GUILD_PRESENCES GatewayIntentBits.GuildPresences GUILD_SCHEDULED_EVENTS GatewayIntentBits.GuildScheduledEvents GUILD_VOICE_STATES … Read more

setPresence activity type in discord.js v14 can only be set to “PLAYING”

In v14, you will need to use the ActivityType enums or numbers. You can import it from discord.js: const { Client, GatewayIntentBits, ActivityType } = require(‘discord.js’); And use it like this: client.user.setPresence({ activities: [{ name: `discord.js v14`, type: ActivityType.Watching }], status: ‘dnd’, }); List of ActivityTypes: v13 v14 v14 value “COMPETING” ActivityType.Competing 5 “CUSTOM” ActivityType.Custom … 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

Checking if a message was sent from a DM channel type not working

Are you sure you haven’t updated your discord.js version and you’re still using v12? Channel types in v13 are now uppercase and align with Discord’s naming conventions. See below the changes: channel type v12 v13 DM channel dm DM group DM channel N/A GROUP_DM guild text channel text GUILD_TEXT guild text channel’s public thread channel … Read more

Discord.js Bot Welcomes Member, Assign a Role and send them a DM

Your code looks fine, the problem is that the event isn’t triggered. Thats because discord turned off “privileged intents” by default. Some intents are defined as “Privileged” due to the sensitive nature of the data. Those intents are: GUILD_PRESENCES GUILD_MEMBERS One effect of that is what you are experiencing, the not working guildMemberAdd event. The … Read more

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