You can try:
require('dotenv').config();
const Discord = require('discord.js');
const bot = new Discord.Client();
const TOKEN = process.env.TOKEN;
bot.login(TOKEN);
bot.on('ready', () => {
console.info(`Logged in as ${bot.user.tag}!`);
const channel = bot.channels.get('711580200315650078');
channel.send('hello');
});
This is probably because you're using Discord.js v11. You should migrate to v12, using npm install discord.js
. You will then be able to use:
const channel = bot.channels.cache.get('711580200315650078');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…