当我的机器人在所有服务器上联机时,如何发送启动消息是不协调的.Js



所以我基本上是在我的终端中启动它或在所有可用的服务器中联机时,立即尝试发送我删除和添加的命令的bot更新日志及其新版本信息和数据。目前我正在尝试以下代码:-

Client.on{message.channel.send('Bot Name:- My bot n Bot Verison :- 1.0.0 n Owner :- Rega! 

您需要从客户端向ready事件添加一个侦听器。这是您的代码,已更正并重新格式化。

// The callback gets called when the bot is ready
client.on('ready', () => {
// Get the channel from its ID
const logChannel = client.channels.cache.get('channel-id')
// Send the message
logChannel.send('The bot is up!')
})

您自然需要将channel-id替换为您的频道ID。你可以在这篇Discord Support文章中找到更多关于它的信息。

最新更新