So i want that the bot dms the server owner when it get added to the server.
Here is the code:
@client.event
async def on_guild_join(guild, ctx):
guild_owner = client.get_user(int(ctx.guild.owner.id))
await guild_owner.send("hi")
But I always get this one error:
TypeError: on_guild_join() missing 1 required positional argument: 'ctx'
I know what that means but i dont know how to fix that.
First of all, as mousetail has said,
on_guild_joinonly takes one argument. You should only haveguildas the function's argument. Secondly, since you're using aguildobject, you should already be able to access the guild's owner throughguild.owner. Do view the revised code below.