【发布时间】:2020-12-13 20:17:10
【问题描述】:
我正在执行报告/错误命令并收到此错误:
reportschannel is undefined
这是我的完整代码:
switch (args[0]) {
case "report":
message.delete({ timeout: 3000 });
let target =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]);
if (!target)
return message.channel
.send("Please provide a user that you wish to report")
.then((m) => m.delete({ timeout: 15000 }));
if ((args[1] === target, args[2] === reason)) {
message.channel.send(
"Your report has been filled to the staff team. Thank you for reporting!"
);
reportsChannel.send(
`**${message.author.username}** has reported **${target.user.username}** for **${reason}**.`
);
}
var reason = args.slice(2).join(" ");
if (!reason)
return message.channel
.send(
`Please provide a reason for reporting **${target.user.username}**`
)
.then((m) => m.delete({ timeout: 15000 }));
let reportsChannel = message.guild.channels.cache.find(
(x) => x.name === "wide log"
);
break;
}
我不太确定我的代码出了什么问题;我在忽略什么吗?提前致谢。
【问题讨论】:
标签: javascript node.js discord bots discord.js