【问题标题】:How to get the username and Discord tag of the owner of server - Python如何获取服务器所有者的用户名和 Discord 标签 - Python
【发布时间】:2020-01-04 13:28:27
【问题描述】:

我正在 discord.py 库中寻找一种方法来返回已部署机器人的服务器的所有者。现在我只是对其进行了硬编码(即

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

),但是当所有者更改其名称时,我必须更改它,这似乎没有任何麻烦。我已经查看了 discord.py 的权限系统,但它似乎没有这样做的东西。有什么可以做到的吗?

【问题讨论】:

    标签: python permissions discord discord.py


    【解决方案1】:

    您正在寻找Guild.owner

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

    【讨论】:

    • 上帝,非常感谢你。我一直在到处寻找,但我没有耐心阅读文档。
    • 能不能返回服务器昵称?
    • 当然,Guild.ownerMember,所以你可以使用 message.guild.owner.display_name
    猜你喜欢
    • 2021-04-12
    • 2021-07-01
    • 2023-03-22
    • 2020-07-05
    • 2021-05-20
    • 2021-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多