我有一个票证命令,该命令创建了一个票证通道,运行该命令的人员和员工可以看到。但是最近,它突然停止工作了。它没有设置权限。通道已创建。这是出现错误的代码。
注意:ssi,hos,ssi和类似的东西是返回角色ID的变量
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.
答案 0 :(得分:1)
要编辑所有人角色的权限时,必须输入行会ID,而不是角色本身。