【发布时间】:2021-02-07 13:23:49
【问题描述】:
我在 discord.py 中遇到问题,以下代码运行良好,但 ctx.guild.owner 没有返回任何内容,并且在文档中说如果发生这种情况,事件 guild_subscriptions 设置为 False,怎么能我将此事件设置为True 以使其正常工作?我在 discord.py 文档中找不到任何解决方案,Google 也没有。
我的serverstats命令代码:
@commands.command(name="serverstats", aliases = ["serverinfo", "si", "ss", "check-stats", 'cs'])
async def serverstats(self, ctx: commands.Context):
embed = discord.Embed(
color = discord.Colour.orange(),
title = f"{ctx.guild.name}")
embed.set_thumbnail(url = f"{ctx.guild.icon_url}")
embed.add_field(name = "ID", value = f"{ctx.guild.id}")
embed.add_field(name = "????Owner", value = f"{ctx.guild.owner}")
embed.add_field(name = "????Region", value = f"{ctx.guild.region}")
embed.add_field(name = "????Member Count", value = f"{ctx.guild.member_count}")
embed.add_field(name = "????Created at", value = f"{ctx.guild.created_at}")
embed.set_footer(icon_url = f"{ctx.author.avatar_url}", text = f"Requested by {ctx.author.name}")
await ctx.send(embed=embed)
【问题讨论】:
标签: bots discord.py ctx