forked from public/foundryvtt-reve-de-dragon
Appel à la chance sur les défenses
Suppressions de ChatMessage selon contenu En ayant un <div id=""> avec id unique, on peut retrouver et supprimer les messages obsoletes (par exemple, les choix dans les combats).
This commit is contained in:
@ -3,6 +3,12 @@
|
||||
* Class providing helper methods to get the list of users, and
|
||||
*/
|
||||
export class ChatUtility {
|
||||
static removeMyChatMessageContaining(part) {
|
||||
const toDelete = game.messages.filter(it => it.user._id == game.user._id)
|
||||
.filter(it => it.data.content.includes(part))
|
||||
.forEach(it => it.delete());
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static chatWithRollMode(chatOptions, name) {
|
||||
@ -11,7 +17,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatMessage( chatOptions, rollMode, name) {
|
||||
static createChatMessage(chatOptions, rollMode, name) {
|
||||
switch (rollMode) {
|
||||
case "blindroll": // GM only
|
||||
if (!game.user.isGM) {
|
||||
@ -28,12 +34,12 @@ export class ChatUtility {
|
||||
chatOptions.whisper = ChatUtility.getWhisperRecipients(rollMode, name);
|
||||
break;
|
||||
}
|
||||
chatOptions.alias = chatOptions.alias||name;
|
||||
chatOptions.alias = chatOptions.alias || name;
|
||||
ChatMessage.create(chatOptions);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static prepareChatMessage( rollMode, name) {
|
||||
static prepareChatMessage(rollMode, name) {
|
||||
return {
|
||||
user: game.user._id,
|
||||
whisper: ChatUtility.getWhisperRecipients(rollMode, name)
|
||||
@ -41,7 +47,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getWhisperRecipients( rollMode, name) {
|
||||
static getWhisperRecipients(rollMode, name) {
|
||||
switch (rollMode) {
|
||||
case "blindroll": return ChatUtility.getUsers(user => user.isGM);
|
||||
case "gmroll": return ChatUtility.getWhisperRecipientsAndGMs(name);
|
||||
|
Reference in New Issue
Block a user