Skip to content

Instantly share code, notes, and snippets.

@MorenoMdz
Created May 23, 2021 13:36
Show Gist options
  • Save MorenoMdz/e3db55c15725b001fe94cd6282b61e4f to your computer and use it in GitHub Desktop.
Save MorenoMdz/e3db55c15725b001fe94cd6282b61e4f to your computer and use it in GitHub Desktop.
Firebase cloud function discord hook example
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