message.guild.fetchWebhooks().then(hooks => {
let hook = hooks.first()
hook.send('Hey!')
})
let Discord = require('discord.js')
let { WebhookClient } = require('discord.js')
let client = new Discord.Client({ ws: {intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_BANS', 'GUILD_EMOJIS', 'GUILD_INTEGRATIONS', 'GUILD_WEBHOOKS', 'GUILD_INVITES', 'GUILD_VOICE_STATES', 'GUILD_PRESENCES', 'GUILD_MESSAGES', 'GUILD_MESSAGE_REACTIONS', 'GUILD_MESSAGE_TYPING', 'DIRECT_MESSAGES', 'DIRECT_MESSAGE_REACTIONS', 'DIRECT_MESSAGE_TYPING'] } })
let fs = require('fs')
client.commands = new Discord.Collection()
client.on('ready', () => {
console.log('Ready!')
})
client.on('message', message => {
let prefixes = '?'
if (message.content == `${prefixes}test2`){
let hook = new WebhookClient({ id: 'webhook id', token: 'webhook.token' })
hook.send({
content: 'Hey!',
username: 'имя_пользователя',
avatarURL: message.author.avatarURL,
})
}
})
client.login(token)