Discord 警告命令

Discord 警告命令,discord,discord.py,Discord,Discord.py,您好,我需要有关警告命令的帮助。我不知道如何让它说的东西在聊天,如果你真的告诉我如何解决这个问题,我最好希望这在一个嵌入式 @bot.command(pass\u context=True) @拥有权限(管理角色=True,禁止成员=True) 异步定义警告(ctx,用户:discord.user,*原因:str): 如果不是原因: 等待ctx发送(“请提供原因”) 回来 原因=“”。加入(原因) 对于报表['users']中的当前用户: 如果当前用户['name']==user.name:

您好,我需要有关警告命令的帮助。我不知道如何让它说的东西在聊天,如果你真的告诉我如何解决这个问题,我最好希望这在一个嵌入式

@bot.command(pass\u context=True)
@拥有权限(管理角色=True,禁止成员=True)
异步定义警告(ctx,用户:discord.user,*原因:str):
如果不是原因:
等待ctx发送(“请提供原因”)
回来
原因=“”。加入(原因)
对于报表['users']中的当前用户:
如果当前用户['name']==user.name:
当前用户['reasons']。追加(reason)
打破
其他:
报表['users']。追加({
“名称”:user.name,
“原因”:[原因,]
})
将open('reports.json','w+')作为f:
json.dump(报告,f)
@命令(pass\u context=True)
异步def警告(ctx,用户:discord.user):
对于报表['users']中的当前用户:
如果user.name==当前用户['name']:
wait ctx.send(f“``{user.name}已报告{len(当前用户['reasons'])}次:{'','.join(当前用户['reasons'])}`)
打破
其他:
等待ctx.send(f“`{user.name}从未报告过”``)
@警告.错误
异步def踢_错误(错误,ctx):
如果isinstance(错误,缺少权限):
text=“对不起{},您没有这样做的权限!”。格式(ctx.message.author)

等待bot.发送消息(ctx.message.channel,text)
并嵌入put代码。e、 g:

embed = discord.Embed(title=f'{member}\'s Warning!',color=0x1d9521)
    embed.add_field(name='why he is warned',value=reason, inline=False)    
    embed.add_field(name="Moderator that warned", value={ctx.author.mention}, inline=False)
我不知道这是否会工作,但然后发送它做

   await ctx.send(embed=embed)
另一种发送方式是

await ctx.reply(embed=embed)
要想把它排除在外,你可以这样做

await ctx.send("Why they are warned    `{reason}`/nThe Responsible Moderator   {ctx.author.mention}")

我不确定这是否行得通,但你可以试试看

你在一个字一个字地添加理由,这是一个很难的部分。只需执行以下操作:
async def warn(ctx,user:discord.user,*,reason:str):
这将在用户提到参数作为reason参数后添加所有内容