链接你的机器人在消息discord .js中创建的不和谐频道



我去看如何链接机器人刚刚在消息中制作的不和谐频道,但未能找到有效的解决方案。

下面是我当前的代码:

const guild = client.guilds.cache.get("1057116059750117426");
const storageBuffer = fs.readFileSync("./src/Storage/storage.json");
const storageData = JSON.parse(storageBuffer.toString());
storageData.ticket_id++; // adds one to the ticket number
const ticketId = storageData.ticket_id;
await guild.channels.create({
name: `TICKET-${ticketId}`,
parent: "1057370813357109308",
});

const ChannelName = guild.channel.id
//Here is were I want to link the channel 
await interaction.update({
ephemeral: true,
content: `Your ticket has been submited n You can view it here -> ${ChannelName}`,
components: [],
embed: [],
});

guild.channels.create返回创建的通道:

let createdChannel = await guild.channels.create({
name: `TICKET-${ticketId}`,
parent: "1057370813357109308",
});

…所以你以后可以像这样在你的消息中使用它:

content: `Your ticket has been submitted n You can view it here -> ${createdChannel}`

相关内容

  • 没有找到相关文章

最新更新