Reputation: 19
@client.command()
async def eventsoon(ctx):
role = discord.utils.get(ctx.message.guild.roles, name='Golden God')
for member in ctx.message.guild.members:
if role in member.roles:
await member.send("ur mom")
I want the bot to dm users with golden god role, it doesnt work aand gives no errors
Upvotes: 0
Views: 80
Reputation: 2663
I tested your code and it's probably happening because you didn't enable Privileged Gateway intents and your bot can't get all members. Enable Server Members Intent
on the Discord Developer site in the Bot section.
Then, add them to your code. Example:
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix="!", intents=intents)
Upvotes: 0