У меня есть команда билета, которая создает канал билета, который может видеть человек, который выполнял команду и персонал. Но недавно это перестало работать на ровном месте. Это не устанавливает разрешения. Канал создан, хотя. Вот код, который выдает ошибку.
Примечание: ssi, hos, ssi и подобные вещи являются переменными, которые возвращают идентификатор роли
message.guild.channels
.create(message.author.username + "-" + String(ticketid), "text")
.then(channel => {
let category = client.channels
.fetch("693131250667356272")
.then(category => {
channel.setParent(category);
});
channel.overwritePermissions([
{
id: message.member.id,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: sm,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: channel.guild.roles.everyone,
deny: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: ssi,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: hos,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: m,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: si,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: tm,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
},
{
id: tsi,
allow: [
"VIEW_CHANNEL",
"SEND_MESSAGES",
"READ_MESSAGE_HISTORY",
"ATTACH_FILES"
]
}
]);
channel.send(
"<@" +
message.author.id +
"> Here is your ticket channel. Please explain your problem in detail and a staff member will reply in this channel soon. When you want to close the ticket, do `,ticket close`"
);
});
Ошибка заключается в том, где устанавливаются разрешения , Вот что напечатано
(node:2507) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not an User nor a Role.
at Function.resolve (/rbd/pnpm-volume/1610b021-5dc3-42d8-a00c-f4489c1bc502/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/PermissionOverwrites.js:177:28)
at /rbd/pnpm-volume/1610b021-5dc3-42d8-a00c-f4489c1bc502/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/GuildChannel.js:338:92
at Array.map (<anonymous>)
at TextChannel.edit (/rbd/pnpm-volume/1610b021-5dc3-42d8-a00c-f4489c1bc502/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/GuildChannel.js:338:62)
at TextChannel.overwritePermissions (/rbd/pnpm-volume/1610b021-5dc3-42d8-a00c-f4489c1bc502/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/GuildChannel.js:211:17)
at /app/server.js:264:19
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:2507) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2507) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.