Skip to content

Commit b99c685

Browse files
committed
v13.4.0.1: notification sound triggers
1 parent 4ba1c15 commit b99c685

File tree

3 files changed

+25
-29
lines changed

3 files changed

+25
-29
lines changed

changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Changelog (v13.4.0.1)
2+
3+
**Minor QoL Fix**
4+
5+
- **Notification Sounds: Event Cards Only**
6+
Reduced notification sound triggers to only play for scheduled event notification cards (standardized event cards), not for other About Time Next chat/status/confirmation cards.
7+
8+
---
9+
110
# Changelog (v13.4.0.0)
211

312
**D&D 5e Calendar Integration + Timekeeper & Stability Updates**

module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "about-time-next",
33
"title": "About Time Next (FVTT v13+ Edition)",
44
"description": "Time and event scheduling management utility for Foundry VTT, updated for v13 compatibility.",
5-
"version": "13.4.0.0",
5+
"version": "13.4.0.1",
66
"compatibility": {
77
"minimum": "13",
88
"verified": "13",

module/ATNotificationSound.js

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,23 @@ export class ATNotificationSound {
5757
static isEventNotification(message) {
5858
// Get message content
5959
const content = message.content || "";
60-
61-
// Must contain ATN identifier
62-
if (!content.includes("[about-time-next]") && !content.includes("about-time")) {
60+
61+
// Only trigger on GM whispers.
62+
const isWhisper = Array.isArray(message?.whisper) && message.whisper.length > 0;
63+
if (!isWhisper) return false;
64+
65+
// v13.4.0.1: Restrict sound playback to standardized event notification cards only.
66+
// These are created by formatEventChatCard() and include stable field labels.
67+
const hasModulePrefix = content.includes("[about-time-next]");
68+
const hasEventName = /\bEvent Name:\s*<\/strong>/i.test(content) || content.includes("Event Name:");
69+
const hasEventUid = /\bEvent UID:\s*<\/strong>/i.test(content) || content.includes("Event UID:");
70+
71+
// Exclude confirmation/status cards that also contain the module prefix.
72+
if (content.includes("atn-at-confirm") || content.includes("data-atn-confirm") || content.includes("data-atn-cancel")) {
6373
return false;
6474
}
65-
66-
// Exclude messages that are clearly NOT event notifications
67-
const excludePatterns = [
68-
"Created", // Event creation confirmation
69-
"Stopped", // Event stop confirmation
70-
"Queue:", // Queue list display
71-
"/at", // Chat command echo
72-
"Flushed", // Queue flush confirmation
73-
"cleared", // Timeout clear confirmation
74-
"Event Manager", // Event Manager UI messages
75-
"event:" // Event metadata display
76-
];
77-
78-
for (const pattern of excludePatterns) {
79-
if (content.includes(pattern)) {
80-
return false;
81-
}
82-
}
83-
84-
// If whispered to GM and contains ATN identifier, likely an event
85-
const isWhisper = message.whisper && message.whisper.length > 0;
86-
87-
// Event notifications are typically whispers with event content
88-
// This heuristic may need refinement based on testing
89-
return isWhisper;
75+
76+
return hasModulePrefix && hasEventName && hasEventUid;
9077
}
9178

9279
/**

0 commit comments

Comments
 (0)