前提・実現したいこと
ボタンを押して作られたチャンネルの権限を追加したいのですが
エラーが出て追加されません(多分コードのせい(そのコードが分からない))
発生している問題・エラーメッセージ
(node:9348) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role. at Function.resolve (/rbd/pnpm-volume/ce4ee5fc-5e9a-42f2-a0a4-5fd3539a9378/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/structures/PermissionOverwrites.js:177:28) at /rbd/pnpm-volume/ce4ee5fc-5e9a-42f2-a0a4-5fd3539a9378/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/managers/GuildChannelManager.js:109:81 at Array.map (<anonymous>) at GuildChannelManager.create (/rbd/pnpm-volume/ce4ee5fc-5e9a-42f2-a0a4-5fd3539a9378/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/managers/GuildChannelManager.js:109:51) Client.<anonymous> (/app/index.js:89:27) at processTicksAndRejections (internal/process/task_queues.js:88:5) (node:9348) 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:9348) [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.
該当のソースコード
const prefix = '=' const disbtn = require("discord.js-buttons")(client); client.on("message", async message => { if (!message.content.startsWith(prefix)) return; const args = message.content .slice(prefix.length) .trim() .split(/ +/g); const command = args.shift().toLowerCase(); if (command === "shin") { const button = new disbtn.MessageButton() .setID("shin") .setStyle("green") .setLabel("ボタンの言葉"); message.channel.send({ embed: { title: "埋め込みのタイトル", description: "埋め込みの説明", color: 0xffa500 }, buttons: [button] }); } }); client.on("clickButton", async button => { try { if (button.id === "shin") { await button.think(true); const member = client.guilds.cache.get(button.guild.id).member(button.clicker.user.id); const shin = await button.guild.channels.create('チャンネル名', { parent: button.channel.parent }) button.guild.channels.create(shin, { type: "text", permissionOverwrites: [ { id: 'ロールID', allow: ['VIEW_CHANNEL'] }, { id: '管理者のID', allow: ['VIEW_CHANNEL'] }, { id: 'サーバーID', deny: ['VIEW_CHANNEL'] } ] }) .then((channel) => { const categoryID = 'カテゴリーのID'; channel.setParent(categoryID); }) button.reply.edit("チャンネルを作成しました"); } } catch (e) { // log any errors that come if (e == "DiscordAPIError: Unknown Message") return; console.log(`エラー ${e}`); } });
試したこと
上のやつ
補足情報(FW/ツールのバージョンなど)
discord.js 12.5.3
discord.js-buttons 1.0.0