javascript - 关闭票务系统不起作用... Discord.js
问题描述
您好,我的 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
我不明白出了什么问题...谢谢。
解决方案
推荐阅读
- jquery - jQuery 劫持 TypeScript 的“this”引用
- ansible - How can Ansible skip ./configure and make install when already run
- vba - 在不同工作表中更改触发宏
- r - Shiny SelectInput and SelectizeInput
- c# - How to Avoid "A task was cancelled" when debugging
- android - Smsgateway.me API - 在 V4 上禁用 REST Mod
- vb6 - 在 VB6 中,如何访问 FileSystem.GetFileInfo()?
- ruby-on-rails - gitlab-ci 找不到 config/database.yml,尽管它不应该存在于我的仓库中
- reactjs - 道具未传递到 ReactJS/react-router 中的相对 url
- c# - 使用 Web 服务检索多个数据库列