【发布时间】:2021-08-14 23:23:23
【问题描述】:
我想用命令删除 JSON 文件中的公会 ID。
这是我的代码:
@welcome.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def reset(guild):
with open('welcome.json', 'r') as f:
welcome = json.load(f)
welcome.pop(str(guild.id))
with open('welcome.json', 'w',) as f:
json.dump(welcomereset, f, indent=4)
这是错误消息:discord.ext.commands.errors.CommandInvokeError: 命令引发异常:AttributeError: 'Context' object has no attribute 'id'
我该如何解决这个问题?
【问题讨论】:
标签: python discord.py