using Subprocess to avoid long-running task from disconnecting discord.py bot?

praw relies on the requests library, which is synchronous meaning that the code is blocking. This can cause your bot to freeze if the blocking code takes too long to execute. To get around this, a separate thread can be created that handles the blocking code. Below is an example of this. Note how blocking_function … Read more

How to resolve the following error in discord.py: “TypeError __init__() missing 1 required keyword-only argument: ‘intents'” [duplicate]

A little disclaimer: Join the discord.py server for more information, there are weekly updates since they are actively developing the library and changes can be breaking. Now every Client subclass needs the intents keysword as mentioned in the following picture: How to change the code: Head over to the Discord Developer Portal and click on … Read more

Client.__init__() “missing 1 required keyword-only argument: ‘intents'”, or “takes 1 positional argument but 2 were given”

You could use the default Intents unless you have a particular one to specify. client = discord.Client(intents=discord.Intents.default()) As the first error message says, it is a keyword-only argument, so you cannot write discord.Client(discord.Intents.default()) without intents=. See Intents for more details.

Discord.py | add role to someone

from discord.ext import commands from discord.utils import get bot = commands.Bot(command_prefix=’!’) @bot.command(pass_context=True) @commands.has_role(“Admin”) # This must be exactly the name of the appropriate role async def addrole(ctx): member = ctx.message.author role = get(member.server.roles, name=”Test”) await bot.add_roles(member, role) I think the only real mistake in your code is the lack of pass_context=True in the @bot.command decorator. … Read more

on_member_join and remove dont work. How to make it work?

I’m pretty sure this is an intents issue, you should enable intents.members intents = discord.Intents.default() # Enabling everything apart from privileged intents (members & presences) intents.members = True # Explicitly enabling `intents.members` client = commands.Bot(…, intents=intents) Also make sure to enable them in the developer portal How to enable privileged gateway intents