我目前正在尝试制作类似票据的系统,并且在运行代码时遇到以下错误:
TypeError: fn.bind is not a function
我的代码有问题吗?谢谢!
command(client, 'channel', (message, user) => {
user = message.member;
user = user.toString();
if (user.includes("!")) {
user = user.split("!")[1].split(">")[0];
} else {
user = user.split("@")[1].split(">")[0];
}
let name = client.users.cache.get(user).username
message.channel.send(name)
console.log(`${message.author.name} has created a new ticket.`)
message.guild.channels
.create(`Channel-${name}`, {
type: 'text',
})
.then((channel) => {
channel.setParent('776390304848674836').then((settedParent) => { // Zet kanaal in category.
// Put permissions for everyone
settedParent.overwritePermissions(message.guild.roles.cache.find('name', "@everyone"), { "READ_MESSAGES": false });
settedParent.overwritePermissions(message.guild.roles.cache.find('name', "@management"), { "VIEW_CHANNEL": true });
// Put permission by the user that created the ticket
settedParent.overwritePermissions(message.author, {
"READ_MESSAGES": true, "SEND_MESSAGES": true,
})
})
})
})