discord js v12 code example
Example 1: discord.js start
const Discord = require('discord.js');
const client = new Discord.Client();
const token = 'TOLKEN';
client.on('ready', () => {
console.log('The client is ready!')
})
client.login(token)
Example 2: discord js fetch user
<client>.users.fetch('UserID').then((user) => {
console.log(user);
}).catch(console.error);
const user = await <client>.users.fetch('UserID').catch(console.error);
console.log(user);
Example 3: discord js channel send
const user = <client>.users.cache.get('<id>');
user.send('<content>');
Example 4: discord js channel send
const channel = <client>.channels.cache.get('<id>');
channel.send('<content>');