问题描述
您好,我的 discord 票务系统出现了一些问题,这让我感到非常困惑......它在创建票务系统的渠道时不起作用,这真的让我感到困惑......
代码:
Open ticket command:
const discord = require('discord.js')
module.exports = {
name: 'ticket',description: "opens a ticket",execute(message,args){
const user = message.author.id;
const name = "ticket-" + user;
if(message.guild.channels.cache.find(ch => ch.name == name)){
message.channel.send("You have already opened a ticket!")
}else{
message.guild.channels.create(name).then((chan)=>{
chan.updateOverwrite(message.guild.roles.everyone,{
SEND_MESSAGES: false,VIEW_CHANNEL: false
})
chan.updateOverwrite(user,{
SEND_MESSAGES: true,VIEW_CHANNEL: true
})
message.channel.send("I have created a ticket for you! Please go to the channel at the top of the server,Only you will have access to it and it will be called ticket(id)");
chan.send("Support will be here shortly").then((m)=>{
m.pin()
})
})
}
}
}
close ticket command (this is were the error is):
const discord = require('discord.js');
module.exports = {
name: 'endticket',description: "ends the ticket",execute(client,message,args){
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("Only a moderator can end a ticket!")
if(message.member.hasPermission("ADMINISTRATOR")) message.channnel.delete()
}
}
console error:
TypeError: Cannot read property 'delete' of undefined
我不明白出了什么问题... 谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)