discord.py-更改服务器图标和名称



我有一个名为p!potato的命令,我希望它将服务器的图片更改为文件,并将服务器的名称更改为"马铃薯";。有人能帮忙吗?

@client.command()
async def potato(ctx):
with open('potato.jpg', 'rb') as f:
icon = f.read()
await ctx.guild.edit(ctx.guild.icon, icon=icon)
await ctx.guild.name.edit("potato")

错误:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: edit() takes 1 positional argument but 2 were given```

您不必将ctx.guild.icon传递到Guild.edit

await ctx.guild.edit(icon=icon)

最新更新