Python 3.x 我不知道';我不知道为什么它不';不要给我发报告信息
因此,我正在使用discord.py重写分支生成一个报告命令,下面是一些代码Python 3.x 我不知道';我不知道为什么它不';不要给我发报告信息,python-3.x,discord.py,Python 3.x,Discord.py,因此,我正在使用discord.py重写分支生成一个报告命令,下面是一些代码 @bot.command() async def report(args): report_channel = bot.message.guild report = bot.message.guild await report_channel.send(f"Report sended with reason provided {args}") server = bot
@bot.command()
async def report(args):
report_channel = bot.message.guild
report = bot.message.guild
await report_channel.send(f"Report sended with reason provided {args}")
server = bot.get_guild(794541486083145729)
channel = server.get_channel(809009106148130877)
await channel.send(f"Report from {report} is reported with reason {args}")
但它只是不发送任何信息。相反,它只是给我一个错误。机智
AttributeError:“Bot”对象没有属性“message”
这是什么?您需要传入
ctx
。试试这个:
@bot.command()
异步def报告(ctx,参数):
report=ctx.guild
wait ctx.send(f“已发送报告,并提供原因{args}”)
服务器=bot.get_公会(794541486083145729)
通道=机器人获取通道(809009106148130877)
wait channel.send(f“来自{Report}的报告报告的原因为{args}”)
只要使用此命令正常运行您的代码,它就会工作。@mooping如果对您有效,请接受此答案!