【发布时间】:2020-09-06 17:22:58
【问题描述】:
我想用python和json做一个discord账户生成器,我可以让它生成,但我不能让它在生成后删除账户,请帮忙。
代码:
@client.command()
async def gentest(ctx):
genembed = discord.Embed(
title="Minecraft NFA",
colour=discord.Color.green()
)
with open('alts.json', 'r') as f:
alts = json.load(f)
genembed.add_field(name="Account:", value=random.choice(alts), inline=False)
with open('alts.json', 'w') as f:
alts = alts.pop(alts)
await ctx.author.send(embed=genembed)
await ctx.send(f"{ctx.author.mention} Please check your DMs!")
但是当我尝试生成(使用 alts.pop)时,它会发送此错误:
命令引发异常:TypeError: 'list' object cannot be 解释为整数
【问题讨论】:
标签: python discord discord.py discord.py-rewrite