正在创建 channel np ,权限正常,但是如何在创建 channel 时发送消息,但在创建的消息中发送消息?这是我的代码;
当我的机器人在创建的 channel 中创建 channel 时,我需要发送消息。
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()
将消息发送到该特定 channel ,而无需再次获取/获取它.
guild.channels.create(`${message.author.username}-kayıtodası`, {
type: 'text',
topic: `!kapat yazarak form doldurmayı kapatabilirsin. `,
message: 'denemee',
}).then(channel => channel.send("Hello!"))
关于javascript - 不和谐JS : How can ı send message when create channel by bot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61416120/