即使在使用前已指定值,也“无法读取未定义的属性'get'”

时间:2020-08-24 22:27:13

标签: node.js discord discord.js

我对JavaScripting和discord.js还是很陌生

我似乎无法发现机器人的问题。

console.log("Ban Key is " + banKey);
console.log("Punishment Log Key is " + punishmentLogs);
toBan.push({key: banKey, method: method, channelID: message.channel.id, memberID: memberID, timeForBan: args[3], reasonForBan: args[4], username: JSON.parse(data).Username,value: args[2], cid: message.channel.id});
client.channels.cache.get(punishmentLogs).send("**Player banned through Discord.**" + "\r" + "**Player:** " + args[2] + "\r" + "*Moderator:**" + "<@" + message.member.id + ">" + "\r" + "**Length:**" + args[3] + "**Hours.**" + "\r" + "**Reason:**" + args[4]);

记录banKey和惩罚日志键会返回此

// Key so my other script knows where the ban is coming from
Ban Key is PSG
// Channel ID of the punishment-logs channel
Punishment Log Key is 741047551221825700

这意味着它知道它们有一个值,但是当涉及到使用渠道时,它说它是未定义的。

0 个答案:

没有答案