OtakuXD
OtakuXD

Reputation: 1

getting 'NoneType' object has no attribute 'send'

getting the 'NoneType' object has no attribute 'send' what should I do?this error making my head blow up

async def message(ctx, *, mymsg):
    role = discord.utils.get(ctx.guild.roles, name="زاجل")
    await ctx.message.delete()
    await ctx.send(f'انتظر قليلا وسيتم نشر  رسالتك <a:Aonigif2:780891217549328425> {ctx.message.author.mention}', delete_after=5)
    await asyncio.sleep(3)
    await ctx.message.author.remove_roles(role)
    user = client.get_user(732195349661351987)
    await user.send(f'{mymsg}')```

Upvotes: 0

Views: 494

Answers (1)

Axisnix
Axisnix

Reputation: 2907

You require the Members Intent

You will have to enable it here. Select the application you want it on -> Select Bot -> SERVER MEMBERS INTENT and then make sure it shows blue next to it. Then click Save Changes. Since you are developing your bot you might want to enable Presence intent as well to save you time later.

You will then have to edit your bot variable like so:

intents = discord.Intents.default()
intents.members = True

client = commands.Bot(command_prefix=".", intents=intents)

Upvotes: 1

Related Questions