Move the query event handlers into a subfolder and name them in a consistent way
This commit is contained in:
parent
6a2cc1170d
commit
c113c326c6
6 changed files with 38 additions and 32 deletions
24
module/sockets/query/notify.mjs
Normal file
24
module/sockets/query/notify.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { respondedToQueries } from "../../utils/QueryManager.mjs";
|
||||
|
||||
export function queryNotify(payload) {
|
||||
const { id, userID, content, includeGM } = payload;
|
||||
|
||||
if (userID !== game.user.id) { return };
|
||||
|
||||
// Ensure that each user can only get one notification about a query
|
||||
if (!respondedToQueries.has(id)) { return };
|
||||
|
||||
let whisper = [game.user.id];
|
||||
if (includeGM) {
|
||||
whisper = game.users.filter(u => u.isGM).map(u => u.id);
|
||||
};
|
||||
|
||||
ChatMessage.implementation.create({
|
||||
flavor: `Data Query Notification`,
|
||||
content,
|
||||
whisper,
|
||||
style: CONST.CHAT_MESSAGE_STYLES.OOC,
|
||||
});
|
||||
|
||||
respondedToQueries.delete(id);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue