【发布时间】:2021-07-29 22:03:55
【问题描述】:
我想制作一个票务系统,并在您对 ✅ 做出反应时在票证中仅从管理员那里查看频道。 (关闭工单。)
代码:
if (reaction.emoji.name === "✅") {
if(!reaction.message.channel.name.includes('ticket-')) return
reaction.users.remove(user)
reaction.message.reactions.cache.get('✅').remove()
reaction.message.reactions.cache.get('❌').remove()
let channel = reaction.message
channel.updateOverwrite("user.id", { VIEW_CHANNEL: false });
}
错误:
TypeError: channel.updateOverwrite is not a function
【问题讨论】:
-
从您的代码看来,
channel只是message对象,而不是实际的channel对象。我认为您只需将let channel = reaction.message切换为let channel = reaction.message.channel。
标签: javascript discord discord.js ticket-system