【发布时间】:2019-01-15 21:38:36
【问题描述】:
一个相对简单的命令,它采用 3 个参数(reportedTag、reporterTag 和原因),其简单目的是从 #report 中删除消息并将其发送到 #reported 我的问题是它没有'看不到原始命令,因此不发送报告的消息
我尝试过使用频道 ID、频道名称,但无济于事
#---Report Command---#
@bot.command(pass_context=True)
async def report(ctx, reportedTag, reporterTag, *reasons):
if int(ctx.message.channel.id) == 416164062901305345:
reason = ' '.join(reasons)
await bot.delete_message(ctx.message)
mesg = "Report by "+ reporterTag + " for " + reportedTag + "Reason is: " + reason
return await bot.say("Report recieved. Staff have been notified :)\nEnjoy your day and we'll take care of this")
return await bot.send_message(bot.get_channel("534496148149370900"), mesg)
else:
print ("Something went wrong")
预期结果:命令行从#report 中删除,消息发送到#reported
实际结果:“出了点问题”
【问题讨论】:
-
应该发生的是它会发送这样的消息:
Report by @IGA for @Hoe Hoe Hoe 2 Point O Reason is: being mean and swearing lots and lots它以前可以工作,但是在添加 if/else 语句后它不再发送消息 -
显然
int(ctx.message.channel.id)不等于 416164062901305345。为什么你认为它应该是? -
当在
#report文本通道中执行命令时,将返回单独的命令!channel416164062901305345。
标签: python python-3.x discord.py