【发布时间】:2022-01-05 02:20:26
【问题描述】:
我已经对此进行了一段时间的修改,但我从未创建过基于权限的频道。我正在为我的机器人开发票证功能,但我似乎无法让它工作。这个想法是创建一个具有设置权限的频道,名为 message.author 整个标签,权限设置为只允许 message.author 看到频道。出于某种原因,我一直遇到错误。我怎样才能解决这个问题?我已经定义了所有人角色,并且应该已经定义了 message.author。我错过了什么吗?
if (message.channel.type !== "text") {
let active = db.fetch(`support_${message.author.id}`)
let guild = client.guilds.cache.get('took out ID')
let channel, found = true
try {
if (active) client.channels.cache.get(active.channelID).guild
} catch (e) {
found = false;
}
if(!active || !found) {
active = {}
let everyoneRole = msg.guild.roles.cache.find(r => r.name === '@everyone');
channel = await guild.channels.create(`${message.author.username}-${message.author.discriminator}`, {
parent: 'took out ID',
topic: `Support for ${message.author.tag} | ID: ${message.author.id}`,
permissionOverwrites: [
{
id: everyoneRole.id,
deny: ['VIEW_CHANNEL'],
id: message.author.id,
allow: ['VIEW_CHANNEL'],
},
],
})
【问题讨论】:
标签: javascript discord discord.js bots