Reputation: 33
I am trying to make my bot dm the server owner whenever it joins a new server. I have tried this:
@client.event
async def on_guild_join(guild):
user = await client.fetch_user(guild.owner)
await client.send_message(user,"hi there!")
But it gives this error message:
In user_id: Value "myname" is not snowflake
I can't figure out how to get the user id of the guild owner, i looked through the documentation but i couldn't find anything.
Upvotes: 1
Views: 1339
Reputation: 1812
Here is a solution. You can just call the owner
argument on a Guild
:
@client.event
async def on_guild_join(guild):
owner = guild.owner
await owner.send("hi there!")
Upvotes: 1