[英]Discord JS : How can ı send message when create channel by bot
創建頻道 np,權限正常,但是我如何在創建頻道時發送消息但在創建的消息中發送消息? 這是我的代碼;
當我的機器人在創建的頻道中創建頻道時,我需要發送消息。
var kayitFormu = new Map();
bot.on('message', message => {
if(message.author.bot) return;
if(message.content.toLowerCase() === '!kayıt' && message.channel.id ===
'701096677238374401')
if(kayitFormu.has(message.author.id)) {
message.author.send("`Açık olan bir formun var!`/ **RAPIXEL APP**");
} else {let guild = message.guild;
guild.channels.create(`${message.author.username}-kayıtodası`, {
type: 'text',
topic: `!kapat yazarak form doldurmayı kapatabilirsin. `,
message: 'denemee',
permissionOverwrites: [
{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL'],
},
{
id: '701098731440832542',
allow: ['VIEW_CHANNEL'],
},
],
}).then(ch => {
channel => channel.send("Hello!");
console.log("Kayıt formu olan " + ch.name + " oluşturuldu." );
kayitFormu.set(message.author.id, ch.id)
//channel => channel.send("Hello!");
}).catch(err => console.log(err));
當您使用guild.channels.create()
時,您可以使用 .then( .then()
將消息發送到該特定通道,而無需再次獲取/獲取它。
guild.channels.create(`${message.author.username}-kayıtodası`, {
type: 'text',
topic: `!kapat yazarak form doldurmayı kapatabilirsin. `,
message: 'denemee',
}).then(channel => channel.send("Hello!"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.