Skip to content

Commit

Permalink
Rolls to Webhooks 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Jul 12, 2023
1 parent 1250164 commit e793688
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chat-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,11 @@ class TabbedChatlog {
}
try {
let webhook, message, name, img, embeds;
const sendRoll = chatMessage.isRoll && game.settings.get("chat-tabs", "rollsToWebhook");
if (
chatMessage.type == CONST.CHAT_MESSAGE_TYPES.IC ||
chatMessage.type == CONST.CHAT_MESSAGE_TYPES.EMOTE ||
(chatMessage.isRoll && chatMessage.speaker.actor)
(sendRoll && chatMessage.speaker.actor)
) {
const scene = game.scenes.get(chatMessage.speaker.scene);
webhook =
Expand All @@ -270,7 +271,7 @@ class TabbedChatlog {
name = actor ? actor.name : speaker.alias;
} else if (
chatMessage.type == CONST.CHAT_MESSAGE_TYPES.OOC ||
(chatMessage.isRoll && !chatMessage.speaker.actor)
(sendRoll && !chatMessage.speaker.actor)
) {
webhook = game.settings.get("chat-tabs", "oocWebhook");
if (webhook == undefined || webhook == "") return;
Expand All @@ -279,7 +280,7 @@ class TabbedChatlog {
name = chatMessage.user.name;
}
if (webhook) {
if (chatMessage.isRoll) {
if (sendRoll) {
const title = chatMessage.flavor ? chatMessage.flavor + "\n" : "";
const description = `${game.i18n.localize("Roll Formula")}: ${chatMessage.rolls[0].formula} = ${
chatMessage.rolls[0].result
Expand Down

0 comments on commit e793688

Please sign in to comment.