【发布时间】:2020-12-08 02:26:45
【问题描述】:
@client.command()
@commands.has_any_role( 703596629873131590, 703596629894365209, 703596629894365210, 703596629894365211, 703596629923725334, 703596629911142433 )
async def info_pred(ctx, member:discord.Member = None):
with open('pred.json', 'r') as f:
moders = json.load(f)
if member == ctx.author or member == None:
emb = discord.Embed(title = '**PRED INFO**',description = f'{ctx.author.mention}, **на данный момент у Вас** `{moders[str(ctx.author.id)]["Pred"]}` **предупреждений**' ,color = random.choice(colors))
await ctx.send(embed = emb)
else:
emb = discord.Embed(title = '**PRED INFO**',description = f'**У модератора** {member.mention} `{moders[str(member.id)]["Pred"]}` **предупреждений**' ,color = random.choice(colors))
await ctx.send(embed = emb)
json
{"388421980472475648": {"Pred": 4}, "507619532391579658": {"Pred": 0}, "287605474692431873": {"Pred": 1}, "350257225731801090": {"Pred": 1}, "464411914261233664": {"Pred": 1}}
美好的一天。我不会破坏如何制作它,以便使用命令 !info_prev 显示整个成员列表及其 arg
【问题讨论】:
-
您需要说明您想要实现的目标以及遇到的问题,请查看stackoverflow.com/help/how-to-ask 了解如何提出一个好的问题。
标签: python json bots discord.py