Created
May 23, 2021 13:36
-
-
Save MorenoMdz/e3db55c15725b001fe94cd6282b61e4f to your computer and use it in GitHub Desktop.
Firebase cloud function discord hook example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sendDiscordMessage = async (type = 'info', name, message) => { | |
const webhook = require('webhook-discord'); | |
const Hook = new webhook.Webhook( | |
'your-discord-hook-key' | |
); | |
if (type === 'info') { | |
return Hook.info(name, message); | |
} | |
if (type === 'warn') { | |
return Hook.warn(name, message); | |
} | |
if (type === 'success') { | |
return Hook.success(name, message); | |
} | |
if (type === 'error') { | |
return Hook.err(name, message); | |
} | |
}; | |
exports.sendDiscordMessage = sendDiscordMessage; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment