forked from public/foundryvtt-reve-de-dragon
Ajout de la date/heure aux messages
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
|
||||
|
||||
/**
|
||||
@ -163,4 +164,17 @@ export class ChatUtility {
|
||||
return game.messages.get(chatMessageId);
|
||||
}
|
||||
|
||||
static async onRenderChatMessage(chatMessage, html, data) {
|
||||
const rddTimestamp = chatMessage.getFlag(SYSTEM_RDD, 'rdd-timestamp')
|
||||
if (rddTimestamp) {
|
||||
const timestamp = new RdDTimestamp(rddTimestamp);
|
||||
const timestampData = timestamp.toCalendrier();
|
||||
const dateHeure = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
|
||||
html.find('header.message-header .message-sender').after(dateHeure)
|
||||
}
|
||||
}
|
||||
|
||||
static async onCreateChatMessage(chatMessage, options, id) {
|
||||
await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user