Configurable chat history length

The previous default of 5 messages is utterly lame and didn't provide enough context to anything, and was also a downgrade from the old server as that had 10 messages by default (of which we're now going back to with this change).
This commit is contained in:
dakrk
2023-05-01 15:03:14 +01:00
parent b7cba2f572
commit 41bf76ab0d
3 changed files with 4 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ bancmd = "iptables -A INPUT -s $IP -j REJECT"
moderatorEnabled = true moderatorEnabled = true
usernameblacklist = [] usernameblacklist = []
maxChatLength = 100 maxChatLength = 100
maxChatHistoryLength = 10
# Temporarily mute a user if they send more than x messages in n seconds # Temporarily mute a user if they send more than x messages in n seconds
automute = {enabled = true, seconds = 5, messages = 5} automute = {enabled = true, seconds = 5, messages = 5}
# How long a temporary mute lasts, in seconds # How long a temporary mute lasts, in seconds

View File

@@ -21,6 +21,7 @@ export default interface IConfig {
moderatorEnabled : boolean; moderatorEnabled : boolean;
usernameblacklist : string[]; usernameblacklist : string[];
maxChatLength : number; maxChatLength : number;
maxChatHistoryLength : number;
automute : { automute : {
enabled: boolean; enabled: boolean;
seconds: number; seconds: number;

View File

@@ -47,13 +47,13 @@ export default class WSServer {
private ModPerms : number; private ModPerms : number;
private VM : VM; private VM : VM;
constructor(config : IConfig, vm : VM) { constructor(config : IConfig, vm : VM) {
this.ChatHistory = new CircularBuffer<{user:string,msg:string}>(Array, 5); this.Config = config;
this.ChatHistory = new CircularBuffer<{user:string,msg:string}>(Array, this.Config.collabvm.maxChatHistoryLength);
this.TurnQueue = new Queue<User>(); this.TurnQueue = new Queue<User>();
this.TurnTime = 0; this.TurnTime = 0;
this.TurnIntervalRunning = false; this.TurnIntervalRunning = false;
this.clients = []; this.clients = [];
this.ips = []; this.ips = [];
this.Config = config;
this.voteInProgress = false; this.voteInProgress = false;
this.voteTime = 0; this.voteTime = 0;
this.voteCooldown = 0; this.voteCooldown = 0;