[英]Linking a discord channel that your bot made in a message Discord.js
I went looking on how to link the discord channel the bot just made in a message but was not able to find a solution that worked.我继续寻找如何链接机器人刚刚在消息中创建的 discord 频道,但找不到有效的解决方案。
Here is my current code:这是我当前的代码:
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
returns the channel created: guild.channels.create
返回创建的通道:
let createdChannel = await guild.channels.create({
name: `TICKET-${ticketId}`,
parent: "1057370813357109308",
});
...so you can later use it in your message like this: ...所以您以后可以像这样在您的消息中使用它:
content: `Your ticket has been submitted \n You can view it here -> ${createdChannel}`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.