diff --git a/chat/conversations.ts b/chat/conversations.ts index 3e016bd..ad40e11 100644 --- a/chat/conversations.ts +++ b/chat/conversations.ts @@ -432,8 +432,18 @@ class ChannelConversation extends Conversation implements Interfaces.ChannelConv createMessage(isAd ? MessageType.Ad : MessageType.Message, core.characters.ownCharacter, message, new Date()) ); - if(isAd) + if(isAd) { this.nextAd = Date.now() + core.connection.vars.lfrp_flood * 1000; + + // enforces property setter + this.settings = { + ...this.settings, + adSettings: { + ...this.settings.adSettings, + lastAdTimestamp: Date.now() + } + }; + } } ); } @@ -485,7 +495,14 @@ class ChannelConversation extends Conversation implements Interfaces.ChannelConv this.nextAd = Date.now() + core.connection.vars.lfrp_flood * 1000; - this.settings.adSettings.lastAdTimestamp = Date.now(); + // enforces property setter + this.settings = { + ...this.settings, + adSettings: { + ...this.settings.adSettings, + lastAdTimestamp: Date.now() + } + }; } ); } diff --git a/chat/interfaces.ts b/chat/interfaces.ts index 7252d86..3685bfd 100644 --- a/chat/interfaces.ts +++ b/chat/interfaces.ts @@ -113,7 +113,7 @@ export namespace Conversation { export interface AdSettings { readonly ads: string[]; readonly randomOrder: boolean; - lastAdTimestamp: number; + readonly lastAdTimestamp: number; } export const enum UnreadState { None, Unread, Mention }