简体   繁体   English

我创建了一个频道,但无法获取此创建频道的ID

[英]I created a channel, but I can't get the id of this created channel

I created a channel using the code below, but I can't find the channel ID to continue with the function that moves to the category and sends a message to it. 我使用下面的代码创建了一个频道,但找不到该频道ID来继续该功能,该功能移至该类别并向其发送消息。


const buyid = createID

message.guild.createChannel(`venda-${buyid}`, 'text', [
    {
        id: message.guild.defaultRole.id,
        deny: ['VIEW_CHANNEL'],
    },
    {
        id: userID,
        allow: ['VIEW_CHANNEL'],
    },
])

You can do futher things with a created channel when you do this: 执行以下操作时,您可以使用已创建的频道执行其他操作:

message.guild.createChannel(`venda-${buyid}`, 'text', [
    {
        id: message.guild.defaultRole.id,
        deny: ['VIEW_CHANNEL'],
    },
    {
        id: userID,
        allow: ['VIEW_CHANNEL'],
    },
]).then((channel) => {

 channel.setParent("PARENT_CHANNEL_ID")
 channel.send("YOUR_MESSAGE")

})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM