npm i discord.log
import Discord from 'discord.log'
const discord = new Discord(/* discord webhook URL */)
discord.log('Hello world!') // returns promise (see axios docs)
discord.log({
username: 'Mr. Bot',
message: 'Hello world!'
})
Logging stuff to discord can be a really useful way of alerting yourself about certain events. E.g. incoming user feedback, a new purchase, errors, etc. Writing the same webhook post code over and over gets annoying, so this module aims to make it easy.
- Find the text channel you want to create the webhook for and click the gear icon.
- Click on the "Webhooks" tab and click "Create Webhook"
- Copy the Webhook URL