How to get the username and Discord tag of the own

2020-05-09 10:02发布

问题:

I'm looking for a method in the discord.py library to return the owner of the server the bot has been deployed in. Right now I just have it hard coded (i.e.

if message.content == '!owner': 
    await message.channel.send('ownername#1234')

), but when the owner changes their name I have to change it, and it seems like a hassle for nothing. I've looked into the permissions system of discord.py but it doesn't seem to have something that does this. Is there anything that does this?

回答1:

You're looking for Guild.owner

await message.channel.send(str(message.guild.owner))