Started work on character log for rolls to be stored

This commit is contained in:
Stefan Zermatten
2020-09-29 22:34:30 +02:00
parent 75ab43da00
commit a6a96fc19f
12 changed files with 190 additions and 45 deletions

View File

@@ -0,0 +1,24 @@
import Discord from 'discord.js'
export default function sendWebhook({webhookURL, message}){
//webhookURL = https://discordapp.com/api/webhooks/<id>/<token>
let urlArray = webhookURL.split('/');
let token = urlArray.pop();
let id = urlArray.pop();
// const hook = new Discord.WebhookClient(webhook.id, webhook.token);
const hook = new Discord.WebhookClient(id, token);
// Send a message using the webhook
hook.send(message);
}
export function sendWebhookAsCreature({creature, content, embeds}){
if (!creature || !creature.discordWebhook) return;
sendWebhook({
webhookURL: creature.discordWebhook,
message: {
username: creature.name,
avatar_url: creature.avatarPicture,
content,
embeds,
}
});
}