They use webhooks, which can be created like:
const webhook = await channel.createWebhook('Some-username', {
avatar: 'https://i.imgur.com/wSTFkRM.png',
})
So you'd want to set the username and avatar to mimic the target. Then, to fire the webhook, you need to install node-fetch (npm i node-fetch
), and:
const fetch = require('node-fetch');
const webhookURL = webhook.url;
await fetch(webhookURL, {
headers: {'Content-Type': 'application/json' },
method: 'POST',
body: JSON.stringify({
content: 'your message here'
})
});
and that will fire the webhook. Then, delete the webhook:
await webhook.delete()
That's the basics of webhooks, to find out more try this video. Hope that helped!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…