How to get the username and Discord tag of the owner of server - Python

泄露秘密 提交于 2020-01-30 11:30:17

问题


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))


来源:https://stackoverflow.com/questions/57741196/how-to-get-the-username-and-discord-tag-of-the-owner-of-server-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!