我的机器人不会联机,但有一个简单的代码:
const discord = require('discord.js')
const client = new discord.Client();
const token = ('my bot token')
client.on('ready', function(){
console.log('online')
})
client.login(token)
试试这个:
const discord = require('discord.js')
const client = new discord.Client();
// you will want to define some intents if you want the bot to be able to do anything
// see https://discordjs.guide/popular-topics/intents.html#enabling-intents and https://discord.js.org/#/docs/main/stable/class/Intents
const token = 'my bot token' // took away the ()
client.on('ready', () => { //removed 'function' and added => to pass everything through
console.log('online')
})
client.login(token)