Refactor Modlog Formatting (#3972)

This commit is contained in:
Charlie Kobayashi
2018-01-08 16:18:24 -05:00
committed by Guangcong Luo
parent e34843c993
commit 331af4e794
20 changed files with 431 additions and 222 deletions

View File

@@ -822,7 +822,8 @@ exports.commands = {
}
delete room.isPrivate;
room.privacySetter = null;
this.addModCommand(`${user.name} made this room public.`);
this.addModAction(`${user.name} made this room public.`);
this.modlog('PUBLICROOM');
if (room.chatRoomData) {
delete room.chatRoomData.isPrivate;
Rooms.global.writeChatRoomData();
@@ -838,7 +839,8 @@ exports.commands = {
return this.errorReply(`This room is already ${settingName}.`);
}
room.isPrivate = setting;
this.addModCommand(`${user.name} made this room ${settingName}.`);
this.addModAction(`${user.name} made this room ${settingName}.`);
this.modlog(`${settingName.toUpperCase()}ROOM`);
if (room.chatRoomData) {
room.chatRoomData.isPrivate = setting;
Rooms.global.writeChatRoomData();
@@ -861,13 +863,15 @@ exports.commands = {
if (this.meansNo(target)) {
if (!room.isOfficial) return this.errorReply(`This chat room is already unofficial.`);
delete room.isOfficial;
this.addModCommand(`${user.name} made this chat room unofficial.`);
this.addModAction(`${user.name} made this chat room unofficial.`);
this.modlog('UNOFFICIALROOM');
delete room.chatRoomData.isOfficial;
Rooms.global.writeChatRoomData();
} else {
if (room.isOfficial) return this.errorReply(`This chat room is already official.`);
room.isOfficial = true;
this.addModCommand(`${user.name} made this chat room official.`);
this.addModAction(`${user.name} made this chat room official.`);
this.modlog('OFFICIALROOM');
room.chatRoomData.isOfficial = true;
Rooms.global.writeChatRoomData();
}
@@ -881,13 +885,15 @@ exports.commands = {
if (this.meansNo(target)) {
if (!room.pspl) return this.errorReply(`This chat room is already not a PSPL Winner room.`);
delete room.pspl;
this.addModCommand(`${user.name} made this chat room no longer a PSPL Winner room.`);
this.addModAction(`${user.name} made this chat room no longer a PSPL Winner room.`);
this.modlog('PSPLROOM');
delete room.chatRoomData.pspl;
Rooms.global.writeChatRoomData();
} else {
if (room.pspl) return this.errorReply("This chat room is already a PSPL Winner room.");
room.pspl = true;
this.addModCommand(`${user.name} made this chat room a PSPL Winner room.`);
this.addModAction(`${user.name} made this chat room a PSPL Winner room.`);
this.modlog('UNPSPLROOM');
room.chatRoomData.pspl = true;
Rooms.global.writeChatRoomData();
}
@@ -929,7 +935,8 @@ exports.commands = {
room.users[userid].updateIdentity(room.id);
}
return this.addModCommand(`This room was set as a subroom of ${main.title} by ${user.name}.`);
this.modlog('SUBROOM', null, `of ${main.title}`);
return this.addModAction(`This room was set as a subroom of ${main.title} by ${user.name}.`);
},
removesubroom: 'unsubroom',
@@ -953,7 +960,8 @@ exports.commands = {
room.users[userid].updateIdentity(room.id);
}
return this.addModCommand(`This room was unset as a subroom by ${user.name}.`);
this.modlog('UNSUBROOM');
return this.addModAction(`This room was unset as a subroom by ${user.name}.`);
},
parentroom: 'subrooms',
@@ -1007,7 +1015,8 @@ exports.commands = {
room.desc = target;
this.sendReply(`(The room description is now: ${target})`);
this.privateModCommand(`(${user.name} changed the roomdesc to: "${target}".)`);
this.privateModAction(`(${user.name} changed the roomdesc to: "${target}".)`);
this.modlog('ROOMDESC', null, `to "${target}"`);
if (room.chatRoomData) {
room.chatRoomData.desc = room.desc;
@@ -1046,7 +1055,8 @@ exports.commands = {
this.sendReply("(The room introduction has been changed to:)");
this.sendReply('|raw|<div class="infobox infobox-limited">' + room.introMessage.replace(/\n/g, '') + '</div>');
this.privateModCommand(`(${user.name} changed the roomintro.)`);
this.privateModAction(`(${user.name} changed the roomintro.)`);
this.modlog('ROOMINTRO');
this.roomlog(room.introMessage.replace(/\n/g, ''));
if (room.chatRoomData) {
@@ -1059,7 +1069,8 @@ exports.commands = {
if (!this.can('declare', null, room)) return false;
if (!room.introMessage) return this.errorReply("This room does not have a introduction set.");
this.privateModCommand(`(${user.name} deleted the roomintro.)`);
this.privateModAction(`(${user.name} deleted the roomintro.)`);
this.modlog('DELETEROOMINTRO');
this.roomlog(target);
delete room.introMessage;
@@ -1101,7 +1112,8 @@ exports.commands = {
this.sendReply("(The staff introduction has been changed to:)");
this.sendReply('|raw|<div class="infobox">' + target.replace(/\n/g, '') + '</div>');
this.privateModCommand(`(${user.name} changed the staffintro.)`);
this.privateModAction(`(${user.name} changed the staffintro.)`);
this.modlog('STAFFINTRO');
this.roomlog(room.staffMessage.replace(/\n/g, ''));
if (room.chatRoomData) {
@@ -1114,7 +1126,8 @@ exports.commands = {
if (!this.can('ban', null, room)) return false;
if (!room.staffMessage) return this.errorReply("This room does not have a staff introduction set.");
this.privateModCommand(`(${user.name} deleted the staffintro.)`);
this.privateModAction(`(${user.name} deleted the staffintro.)`);
this.modlog('DELETESTAFFINTRO');
this.roomlog(target);
delete room.staffMessage;
@@ -1142,7 +1155,8 @@ exports.commands = {
if (room.isPersonal) return this.errorReply("Personal rooms can't have aliases.");
Rooms.aliases.set(alias, room.id);
this.privateModCommand(`(${user.name} added the room alias '${target.trim()}'.)`);
this.privateModAction(`(${user.name} added the room alias '${alias}'.)`);
this.modlog('ROOMALIAS', null, alias);
if (!room.aliases) room.aliases = [];
room.aliases.push(alias);
@@ -1172,7 +1186,8 @@ exports.commands = {
if (!alias || !Rooms.aliases.has(alias)) return this.errorReply("Please specify an existing alias.");
if (Rooms.aliases.get(alias) !== room.id) return this.errorReply("You may only remove an alias from the current room.");
this.privateModCommand(`(${user.name} removed the room alias '${target}'.)`);
this.privateModAction(`(${user.name} removed the room alias '${alias}'.)`);
this.modlog('REMOVEALIAS', null, alias);
let aliasIndex = room.aliases.indexOf(alias);
if (aliasIndex >= 0) {
@@ -1202,7 +1217,8 @@ exports.commands = {
if (!room.auth) room.auth = room.chatRoomData.auth = {};
room.auth[userid] = '#';
this.addModCommand(`${name} was appointed Room Owner by ${user.name}.`);
this.addModAction(`${name} was appointed Room Owner by ${user.name}.`);
this.modlog('ROOMOWNER', userid);
if (targetUser) {
targetUser.popup(`You were appointed Room Owner by ${user.name} in ${room.id}.`);
room.onUpdateIdentity(targetUser);
@@ -1294,13 +1310,16 @@ exports.commands = {
// if the user can't see the demotion message (i.e. rank < %), it is shown in the chat
targetUser.send(">" + room.id + "\n(You were demoted to Room " + groupName + " by " + user.name + ".)");
}
this.privateModCommand(`(${name} was demoted to Room ${groupName} by ${user.name}.)`);
this.privateModAction(`(${name} was demoted to Room ${groupName} by ${user.name}.)`);
this.modlog(`ROOM${groupName.toUpperCase()}`, userid, '(demote)');
if (needsPopup) targetUser.popup(`You were demoted to Room ${groupName} by ${user.name} in ${room.id}.`);
} else if (nextGroup === '#') {
this.addModCommand(`${'' + name} was promoted to ${groupName} by ${user.name}.`);
this.addModAction(`${'' + name} was promoted to ${groupName} by ${user.name}.`);
this.modlog('ROOM OWNER', userid);
if (needsPopup) targetUser.popup(`You were promoted to ${groupName} by ${user.name} in ${room.id}.`);
} else {
this.addModCommand(`${'' + name} was promoted to Room ${groupName} by ${user.name}.`);
this.addModAction(`${'' + name} was promoted to Room ${groupName} by ${user.name}.`);
this.modlog(`ROOM${groupName.toUpperCase()}`, userid);
if (needsPopup) targetUser.popup(`You were promoted to Room ${groupName} by ${user.name} in ${room.id}.`);
}
@@ -1442,7 +1461,7 @@ exports.commands = {
if (Punishments.isRoomBanned(targetUser, room.id) && !target) {
let problem = " but was already banned";
return this.privateModCommand("(" + name + " would be banned by " + user.name + problem + ".)");
return this.privateModAction("(" + name + " would be banned by " + user.name + problem + ".)");
}
if (targetUser.trusted && room.isPrivate !== true && !room.isPersonal) {
@@ -1457,23 +1476,26 @@ exports.commands = {
}
const reason = (target ? ` (${target})` : ``);
this.addModCommand(`${name} was banned from ${room.title} by ${user.name}.${reason}`, ` (${targetUser.latestIp})`);
this.addModAction(`${name} was banned from ${room.title} by ${user.name}.${reason}`);
let affected = Punishments.roomBan(room, targetUser, null, null, target);
if (!room.isPrivate && room.chatRoomData) {
let acAccount = (targetUser.autoconfirmed !== userid && targetUser.autoconfirmed);
let displayMessage = '';
if (affected.length > 1) {
this.privateModCommand("(" + name + "'s " + (acAccount ? " ac account: " + acAccount + ", " : "") + "banned alts: " + affected.slice(1).map(user => user.getLastName()).join(", ") + ")");
displayMessage = "(" + name + "'s " + (acAccount ? " ac account: " + acAccount + ", " : "") + "banned alts: " + affected.slice(1).map(user => user.getLastName()).join(", ") + ")";
this.privateModAction(displayMessage);
} else if (acAccount) {
this.privateModCommand("(" + name + "'s ac account: " + acAccount + ")");
displayMessage = "(" + name + "'s ac account: " + acAccount + ")";
this.privateModAction(displayMessage);
}
}
this.add('|unlink|hide|' + userid);
if (userid !== toId(this.inputUsername)) this.add('|unlink|hide|' + toId(this.inputUsername));
if (!room.isPrivate && room.chatRoomData) {
this.globalModlog("ROOMBAN", targetUser, " by " + user.name + (target ? ": " + target : ""));
this.globalModlog("ROOMBAN", targetUser, " by " + user.userid + (target ? ": " + target : ""));
}
return true;
},
@@ -1488,9 +1510,9 @@ exports.commands = {
let name = Punishments.roomUnban(room, target);
if (name) {
this.addModCommand("" + name + " was unbanned from " + room.title + " by " + user.name + ".");
this.addModAction("" + name + " was unbanned from " + room.title + " by " + user.name + ".");
if (!room.isPrivate && room.chatRoomData) {
this.globalModlog("UNROOMBAN", name, " by " + user.name);
this.globalModlog("UNROOMBAN", name, " by " + user.userid);
}
} else {
this.errorReply("User '" + target + "' is not banned from this room.");
@@ -1560,7 +1582,8 @@ exports.commands = {
}
if (!this.can('warn', targetUser, room)) return false;
this.addModCommand("" + targetUser.name + " was warned by " + user.name + "." + (target ? " (" + target + ")" : ""));
this.addModAction("" + targetUser.name + " was warned by " + user.name + "." + (target ? " (" + target + ")" : ""));
this.modlog('WARN', targetUser, target, {noalts: 1});
targetUser.send('|c|~|/warn ' + target);
let userid = targetUser.getLastId();
this.add('|unlink|' + userid);
@@ -1594,7 +1617,8 @@ exports.commands = {
return this.errorReply("User " + this.targetUsername + " is not in the room " + room.id + ".");
}
if (!targetUser.joinRoom(targetRoom.id)) return this.errorReply("User " + targetUser.name + " could not be joined to room " + targetRoom.title + ". They could be banned from the room.");
this.addModCommand("" + targetUser.name + " was redirected to room " + targetRoom.title + " by " + user.name + ".");
this.addModAction("" + targetUser.name + " was redirected to room " + targetRoom.title + " by " + user.name + ".");
this.modlog('REDIRECT', targetUser, `to ${targetRoom.title}`, {noip: 1, noalts: 1});
targetUser.leaveRoom(room);
},
redirhelp: [`/redirect OR /redir [username], [roomname] - Attempts to redirect the user [username] to the room [roomname]. Requires: % @ & ~`],
@@ -1617,14 +1641,18 @@ exports.commands = {
if (targetUser.locked || (room.isMuted(targetUser) && !canBeMutedFurther) || Punishments.isRoomBanned(targetUser, room.id)) {
let problem = " but was already " + (targetUser.locked ? "locked" : room.isMuted(targetUser) ? "muted" : "room banned");
if (!target) {
return this.privateModCommand("(" + targetUser.name + " would be muted by " + user.name + problem + ".)");
return this.privateModAction("(" + targetUser.name + " would be muted by " + user.name + problem + ".)");
}
return this.addModCommand("" + targetUser.name + " would be muted by " + user.name + problem + "." + (target ? " (" + target + ")" : ""));
return this.addModAction("" + targetUser.name + " would be muted by " + user.name + problem + "." + (target ? " (" + target + ")" : ""));
}
if (targetUser in room.users) targetUser.popup("|modal|" + user.name + " has muted you in " + room.id + " for " + Chat.toDurationString(muteDuration) + ". " + target);
this.addModCommand("" + targetUser.name + " was muted by " + user.name + " for " + Chat.toDurationString(muteDuration) + "." + (target ? " (" + target + ")" : ""));
if (targetUser.autoconfirmed && targetUser.autoconfirmed !== targetUser.userid) this.privateModCommand("(" + targetUser.name + "'s ac account: " + targetUser.autoconfirmed + ")");
this.addModAction("" + targetUser.name + " was muted by " + user.name + " for " + Chat.toDurationString(muteDuration) + "." + (target ? " (" + target + ")" : ""));
this.modlog(`${cmd.includes('h') ? 'HOUR' : ''}MUTE`, targetUser, target);
if (targetUser.autoconfirmed && targetUser.autoconfirmed !== targetUser.userid) {
let displayMessage = "(" + targetUser.name + "'s ac account: " + targetUser.autoconfirmed + ")";
this.privateModAction(displayMessage);
}
let userid = targetUser.getLastId();
this.add('|unlink|' + userid);
if (userid !== toId(this.inputUsername)) this.add('|unlink|' + toId(this.inputUsername));
@@ -1651,7 +1679,8 @@ exports.commands = {
let successfullyUnmuted = room.unmute(targetUser ? targetUser.userid : this.targetUsername, "Your mute in '" + room.title + "' has been lifted.");
if (successfullyUnmuted) {
this.addModCommand("" + (targetUser ? targetUser.name : successfullyUnmuted) + " was unmuted by " + user.name + ".");
this.addModAction("" + (targetUser ? targetUser.name : successfullyUnmuted) + " was unmuted by " + user.name + ".");
this.modlog('UNMUTE', targetUser, null, {noip: 1, noalts: 1});
} else {
this.errorReply("" + (targetUser ? targetUser.name : this.targetUsername) + " is not muted.");
}
@@ -1686,7 +1715,7 @@ exports.commands = {
userid = targetUser.getLastId();
if (targetUser.locked && !week) {
return this.privateModCommand(`(${name} would be locked by ${user.name} but was already locked.)`);
return this.privateModAction(`(${name} would be locked by ${user.name} but was already locked.)`);
}
if (targetUser.trusted) {
@@ -1740,7 +1769,7 @@ exports.commands = {
let lockMessage = `${name} was locked from talking${weekMsg} by ${user.name}.` + (userReason ? ` (${userReason})` : "");
this.addModCommand(lockMessage, ` ${proof}` + (targetUser ? `(${targetUser.latestIp})` : ''));
this.addModAction(lockMessage);
// Notify staff room when a user is locked outside of it.
if (room.id !== 'staff' && Rooms('staff')) {
@@ -1758,16 +1787,19 @@ exports.commands = {
}
let acAccount = (targetUser && targetUser.autoconfirmed !== userid && targetUser.autoconfirmed);
let displayMessage = '';
if (affected.length > 1) {
this.privateModCommand(`(${name}'s ` + (acAccount ? ` ac account: ${acAccount}, ` : "") + `locked alts: ${affected.slice(1).map(user => user.getLastName()).join(", ")})`);
displayMessage = `(${name}'s ` + (acAccount ? ` ac account: ${acAccount}, ` : "") + `locked alts: ${affected.slice(1).map(user => user.getLastName()).join(", ")})`;
this.privateModAction(displayMessage);
} else if (acAccount) {
this.privateModCommand(`(${name}'s ac account: ${acAccount})`);
displayMessage = `(${name}'s ac account: ${acAccount})`;
this.privateModAction(displayMessage);
}
this.add(`|unlink|hide|${userid}`);
if (userid !== toId(this.inputUsername)) this.add(`|unlink|hide|${toId(this.inputUsername)}`);
const globalReason = (target ? `: ${userReason} ${proof}` : ``);
this.globalModlog((week ? "WEEKLOCK" : "LOCK"), targetUser || userid, ` by ${user.name}${globalReason}`);
this.globalModlog((week ? "WEEKLOCK" : "LOCK"), targetUser || userid, ` by ${user.userid}${globalReason}`);
// Automatically upload replays as evidence/reference to the punishment
if (room.battle) this.parse('/savereplay');
@@ -1797,12 +1829,12 @@ exports.commands = {
if (unlocked) {
const unlockMessage = unlocked.join(", ") + " " + ((unlocked.length > 1) ? "were" : "was") +
" unlocked by " + user.name + "." + reason;
this.addModCommand(unlockMessage);
this.addModAction(unlockMessage);
// Notify staff room when a user is unlocked outside of it.
if (!reason && room.id !== 'staff' && Rooms('staff')) {
Rooms('staff').addByUser(user, "<<" + room.id + ">> " + unlockMessage);
}
if (!reason) this.globalModlog("UNLOCK", target, " by " + user.name);
if (!reason) this.globalModlog("UNLOCK", target, " by " + user.userid);
if (targetUser) targetUser.popup("" + user.name + " has unlocked you.");
} else {
this.errorReply("User '" + target + "' is not locked.");
@@ -1862,7 +1894,7 @@ exports.commands = {
targetUser.popup("|modal|" + user.name + " has globally banned you." + (userReason ? "\n\nReason: " + userReason : "") + (Config.appealurl ? "\n\nIf you feel that your ban was unjustified, you can appeal:\n" + Config.appealurl : "") + "\n\nYour ban will expire in a few days.");
let banMessage = "" + name + " was globally banned by " + user.name + "." + (userReason ? " (" + userReason + ")" : "");
this.addModCommand(banMessage, ` ${proof}(${targetUser.latestIp})`);
this.addModAction(banMessage);
// Notify staff room when a user is banned outside of it.
if (room.id !== 'staff' && Rooms('staff')) {
@@ -1871,23 +1903,26 @@ exports.commands = {
let affected = Punishments.ban(targetUser, null, null, userReason);
let acAccount = (targetUser.autoconfirmed !== userid && targetUser.autoconfirmed);
let displayMessage = '';
if (affected.length > 1) {
let guests = affected.length - 1;
affected = affected.slice(1).map(user => user.getLastName()).filter(alt => alt.substr(0, 7) !== '[Guest ');
guests -= affected.length;
this.privateModCommand("(" + name + "'s " + (acAccount ? " ac account: " + acAccount + ", " : "") + "banned alts: " + affected.join(", ") + (guests ? " [" + guests + " guests]" : "") + ")");
displayMessage = "(" + name + "'s " + (acAccount ? " ac account: " + acAccount + ", " : "") + "banned alts: " + affected.join(", ") + (guests ? " [" + guests + " guests]" : "") + ")";
this.privateModAction(displayMessage);
for (const user of affected) {
this.add('|unlink|' + toId(user));
}
} else if (acAccount) {
this.privateModCommand("(" + name + "'s ac account: " + acAccount + ")");
displayMessage = "(" + name + "'s ac account: " + acAccount + ")";
this.privateModAction(displayMessage);
}
this.add('|unlink|hide|' + userid);
if (userid !== toId(this.inputUsername)) this.add('|unlink|hide|' + toId(this.inputUsername));
const globalReason = (target ? `: ${userReason} ${proof}` : ``);
this.globalModlog("BAN", targetUser, ` by ${user.name}${globalReason}`);
this.globalModlog("BAN", targetUser, ` by ${user.userid}${globalReason}`);
return true;
},
globalbanhelp: [
@@ -1905,12 +1940,12 @@ exports.commands = {
let unbanMessage = `${name} was globally unbanned by ${user.name}.`;
if (name) {
this.addModCommand(unbanMessage);
this.addModAction(unbanMessage);
// Notify staff room when a user is unbanned outside of it.
if (room.id !== 'staff' && Rooms('staff')) {
Rooms('staff').addByUser(user, `<<${room.id}>> ${unbanMessage}`);
}
this.globalModlog("UNBAN", name, ` by ${user.name}`);
this.globalModlog("UNBAN", name, ` by ${user.userid}`);
} else {
this.errorReply(`User '${target}' is not globally banned.`);
}
@@ -1932,7 +1967,8 @@ exports.commands = {
Punishments.userids.clear();
Punishments.ips.clear();
Punishments.savePunishments();
this.addModCommand("All bans and locks have been lifted by " + user.name + ".");
this.addModAction("All bans and locks have been lifted by " + user.name + ".");
this.modlog('UNBANALL');
},
unbanallhelp: [`/unbanall - Unban all IP addresses. Requires: & ~`],
@@ -1963,7 +1999,8 @@ exports.commands = {
if (room.chatRoomData) {
Rooms.global.writeChatRoomData();
}
this.addModCommand("All " + count + " roomvoices have been cleared by " + user.name + ".");
this.addModAction("All " + count + " roomvoices have been cleared by " + user.name + ".");
this.modlog('DEROOMVOICEALL');
},
deroomvoiceallhelp: [`/deroomvoiceall - Devoice all roomvoiced users. Requires: # & ~`],
@@ -1982,7 +2019,8 @@ exports.commands = {
return this.errorReply(`The ${targetDesc} is already temporarily banned.`);
}
Punishments.banRange(targetIp, target);
this.addModCommand(`${user.name} hour-banned the ${targetDesc}: ${target}`);
this.addModAction(`${user.name} hour-banned the ${targetDesc}: ${target}`);
this.modlog('RANGEBAN', null, target);
},
baniphelp: [`/banip [ip] - Globally bans this IP or IP range for an hour. Accepts wildcards to ban ranges. Existing users on the IP will not be banned. Requires: & ~`],
@@ -1997,7 +2035,8 @@ exports.commands = {
return this.errorReply("" + target + " is not a locked/banned IP or IP range.");
}
Punishments.ips.delete(target);
this.addModCommand("" + user.name + " unbanned the " + (target.charAt(target.length - 1) === '*' ? "IP range" : "IP") + ": " + target);
this.addModAction("" + user.name + " unbanned the " + (target.charAt(target.length - 1) === '*' ? "IP range" : "IP") + ": " + target);
this.modlog('UNRANGEBAN', null, target);
},
unbaniphelp: [`/unbanip [ip] - Unbans. Accepts wildcards to ban ranges. Requires: & ~`],
@@ -2018,7 +2057,8 @@ exports.commands = {
}
Punishments.lockRange(targetIp, target);
this.addModCommand(`${user.name} hour-locked the ${targetDesc}: ${target}`);
this.addModAction(`${user.name} hour-locked the ${targetDesc}: ${target}`);
this.modlog('RANGELOCK', null, target);
},
lockiphelp: [`/lockip [ip] - Globally locks this IP or IP range for an hour. Accepts wildcards to ban ranges. Existing users on the IP will not be banned. Requires: & ~`],
@@ -2034,7 +2074,8 @@ exports.commands = {
return this.errorReply("" + target + " is not a locked/banned IP or IP range.");
}
Punishments.ips.delete(target);
this.addModCommand("" + user.name + " unlocked the " + (target.charAt(target.length - 1) === '*' ? "IP range" : "IP") + ": " + target);
this.addModAction("" + user.name + " unlocked the " + (target.charAt(target.length - 1) === '*' ? "IP range" : "IP") + ": " + target);
this.modlog('UNRANGELOCK', null, target);
},
/*********************************************************
@@ -2050,7 +2091,8 @@ exports.commands = {
return this.errorReply("The note is too long. It cannot exceed " + MAX_REASON_LENGTH + " characters.");
}
if (!this.can('receiveauthmessages', null, room)) return false;
return this.privateModCommand("(" + user.name + " notes: " + target + ")");
this.modlog('NOTE', null, target);
return this.privateModAction("(" + user.name + " notes: " + target + ")");
},
modnotehelp: [`/modnote [note] - Adds a moderator note that can be read through modlog. Requires: % @ * # & ~`],
@@ -2101,10 +2143,12 @@ exports.commands = {
}
Users.setOfflineGroup(name, nextGroup);
if (Config.groups[nextGroup].rank < Config.groups[currentGroup].rank) {
this.privateModCommand(`(${name} was demoted to ${groupName} by ${user.name}.)`);
this.privateModAction(`(${name} was demoted to ${groupName} by ${user.name}.)`);
this.modlog(`GLOBAL ${groupName.toUpperCase()}`, userid, '(demote)');
if (targetUser) targetUser.popup(`You were demoted to ${groupName} by ${user.name}.`);
} else {
this.addModCommand(`${name} was promoted to ${groupName} by ${user.name}.`);
this.addModAction(`${name} was promoted to ${groupName} by ${user.name}.`);
this.modlog(`GLOBAL ${groupName.toUpperCase()}`, userid);
if (targetUser) targetUser.popup(`You were promoted to ${groupName} by ${user.name}.`);
}
@@ -2129,7 +2173,8 @@ exports.commands = {
targetUser.setGroup(Config.groupsranking[0], true);
this.sendReply("User '" + name + "' is now trusted.");
this.privateModCommand(`${name} was set as a trusted user by ${user.name}.`);
this.privateModAction(`${name} was set as a trusted user by ${user.name}.`);
this.modlog('TRUSTUSER', userid);
},
trustuserhelp: [`/trustuser [username] - Trusts the user (makes them immune to locks). Requires: & ~`],
@@ -2154,7 +2199,8 @@ exports.commands = {
}
Users.setOfflineGroup(name, nextGroup);
this.addModCommand("" + name + " was promoted to " + (Config.groups[nextGroup].name || "regular user") + " by " + user.name + ".");
this.addModAction("" + name + " was promoted to " + (Config.groups[nextGroup].name || "regular user") + " by " + user.name + ".");
this.modlog(`GLOBAL${(Config.groups[nextGroup].name || "regular").toUpperCase()}`, toId(name));
},
devoice: 'deauth',
@@ -2184,7 +2230,7 @@ exports.commands = {
this.add(`|notify|${room.title} announcement!|${target}`);
this.add(Chat.html`|raw|<div class="broadcast-blue"><b>${target}</b></div>`);
this.logModCommand(`${user.name} declared: ${target}`);
this.modlog('DECLARE', null, target);
},
declarehelp: [`/declare [message] - Anonymously announces a message. Requires: # * & ~`],
@@ -2197,7 +2243,7 @@ exports.commands = {
this.add(`|notify|${room.title} announcement!|${Chat.stripHTML(target)}`);
this.add(`|raw|<div class="broadcast-blue"><b>${target}</b></div>`);
this.logModCommand(`${user.name} HTML-declared: ${target}`);
this.modlog(`HTMLDECLARE`, null, target);
},
htmldeclarehelp: [`/htmldeclare [message] - Anonymously announces a message using safe HTML. Requires: ~`],
@@ -2214,7 +2260,7 @@ exports.commands = {
Users.users.forEach(u => {
if (u.connected) u.send(`|pm|~|${u.group}${u.name}|/raw <div class="broadcast-blue"><b>${target}</b></div>`);
});
this.logModCommand(`${user.name} globally declared: ${target}`);
this.modlog(`GLOBALDECLARE`, null, target);
},
globaldeclarehelp: [`/globaldeclare [message] - Anonymously announces a message to every room on the server. Requires: ~`],
@@ -2228,7 +2274,7 @@ exports.commands = {
Rooms.rooms.forEach((curRoom, id) => {
if (id !== 'global' && curRoom.type !== 'battle') curRoom.addRaw(`<div class="broadcast-blue"><b>${target}</b></div>`).update();
});
this.logModCommand(`${user.name} declared to all chat rooms: ${target}`);
this.modlog(`CHATDECLARE`, null, target);
},
chatdeclarehelp: [`/cdeclare [message] - Anonymously announces a message to all chatrooms on the server. Requires: ~`],
@@ -2262,7 +2308,8 @@ exports.commands = {
if (!this.can('forcerename', targetUser)) return false;
let entry = targetUser.name + " was forced to choose a new name by " + user.name + (reason ? ": " + reason : "");
this.privateModCommand("(" + entry + ")");
this.privateModAction("(" + entry + ")");
this.modlog('FORCERENAME', targetUser, reason, {noip: 1, noalts: 1});
Ladders.cancelSearches(targetUser);
targetUser.resetName(true);
targetUser.send("|nametaken||" + user.name + " considers your name inappropriate" + (reason ? ": " + reason : "."));
@@ -2285,14 +2332,14 @@ exports.commands = {
const reasonText = reason ? ` (${reason})` : `.`;
const lockMessage = `${targetUser.name} was namelocked by ${user.name}${reasonText}`;
this.privateModCommand(`(${lockMessage})`, ` (${targetUser.latestIp})`);
this.privateModAction(`(${lockMessage})`);
// Notify staff room when a user is locked outside of it.
if (room.id !== 'staff' && Rooms('staff')) {
Rooms('staff').addByUser(user, "<<" + room.id + ">> " + lockMessage);
}
this.globalModlog("NAMELOCK", targetUser, ` by ${user.name}${reasonText}`);
this.globalModlog("NAMELOCK", targetUser, ` by ${user.userid}${reasonText}`);
Ladders.cancelSearches(targetUser);
Punishments.namelock(targetUser, null, null, reason);
targetUser.popup(`|modal|${user.name} has locked your name and you can't change names anymore${reasonText}`);
@@ -2314,8 +2361,8 @@ exports.commands = {
let unlocked = Punishments.unnamelock(target);
if (unlocked) {
this.addModCommand(unlocked + " was unnamelocked by " + user.name + "." + reason);
if (!reason) this.globalModlog("UNNAMELOCK", target, " by " + user.name);
this.addModAction(unlocked + " was unnamelocked by " + user.name + "." + reason);
if (!reason) this.globalModlog("UNNAMELOCK", target, " by " + user.userid);
if (targetUser) targetUser.popup("" + user.name + " has unnamelocked you.");
} else {
this.errorReply("User '" + target + "' is not namelocked.");
@@ -2344,7 +2391,8 @@ exports.commands = {
}
if (cmd === 'hidealtstext' || cmd === 'hidetextalts' || cmd === 'hidealttext') {
this.addModCommand(`${targetUser.name}'s alts' messages were cleared from ${room.title} by ${user.name}.`);
this.addModAction(`${targetUser.name}'s alts' messages were cleared from ${room.title} by ${user.name}.`);
this.modlog('HIDEALTSTEXT', targetUser, null, {noip: 1});
this.add(`|unlink|${hidetype}${userid}`);
const alts = targetUser.getAltUsers(true);
@@ -2355,7 +2403,8 @@ exports.commands = {
this.add(`|unlink|${hidetype}${targetUser.prevNames[name]}`);
}
} else {
this.addModCommand("" + targetUser.name + "'s messages were cleared from " + room.title + " by " + user.name + ".");
this.addModAction("" + targetUser.name + "'s messages were cleared from " + room.title + " by " + user.name + ".");
this.modlog('HIDETEXT', targetUser, null, {noip: 1, noalts: 1});
this.add('|unlink|' + hidetype + userid);
if (userid !== toId(this.inputUsername)) this.add('|unlink|' + hidetype + toId(this.inputUsername));
}
@@ -2403,23 +2452,26 @@ exports.commands = {
);
}
this.addModCommand(`${name} was blacklisted from ${room.title} by ${user.name}. ${(target ? ` (${target})` : ``)}`, ` (${targetUser.latestIp})`);
this.addModAction(`${name} was blacklisted from ${room.title} by ${user.name}. ${(target ? ` (${target})` : ``)}`);
let affected = Punishments.roomBlacklist(room, targetUser, null, null, target);
if (!room.isPrivate && room.chatRoomData) {
let acAccount = (targetUser.autoconfirmed !== userid && targetUser.autoconfirmed);
let displayMessage = '';
if (affected.length > 1) {
this.privateModCommand("(" + name + "'s " + (acAccount ? " ac account: " + acAccount + ", " : "") + "blacklisted alts: " + affected.slice(1).map(user => user.getLastName()).join(", ") + ")");
displayMessage = "(" + name + "'s " + (acAccount ? " ac account: " + acAccount + ", " : "") + "blacklisted alts: " + affected.slice(1).map(user => user.getLastName()).join(", ") + ")";
this.privateModAction(displayMessage);
} else if (acAccount) {
this.privateModCommand("(" + name + "'s ac account: " + acAccount + ")");
displayMessage = "(" + name + "'s ac account: " + acAccount + ")";
this.privateModAction(displayMessage);
}
}
this.add('|unlink|hide|' + userid);
if (userid !== toId(this.inputUsername)) this.add('|unlink|hide|' + toId(this.inputUsername));
if (!room.isPrivate && room.chatRoomData) {
this.globalModlog("BLACKLIST", targetUser, " by " + user.name + (target ? ": " + target : ""));
this.globalModlog("BLACKLIST", targetUser, " by " + user.userid + (target ? ": " + target : ""));
}
return true;
},
@@ -2458,9 +2510,12 @@ exports.commands = {
if (trusted && room.isPrivate !== true) {
Monitor.log("[CrisisMonitor] Trusted user " + userid + (trusted !== userid ? " (" + trusted + ")" : "") + " was nameblacklisted from " + room.id + " by " + user.name + ", and should probably be demoted.");
}
if (!room.isPrivate && room.chatRoomData) {
this.globalModlog("NAMEBLACKLIST", userid, " by " + user.userid);
}
}
this.addModCommand(`${targets.join(', ')}${(targets.length > 1 ? " were" : " was")} nameblacklisted from ${room.title} by ${user.name}.`);
this.addModAction(`${targets.join(', ')}${(targets.length > 1 ? " were" : " was")} nameblacklisted from ${room.title} by ${user.name}.`);
return true;
},
blacklistnamehelp: [`/blacklistname OR /nameblacklist [username1, username2, etc.] | reason - Blacklists the given username(s) from the room you are in for a year. Requires: # & ~`],
@@ -2473,9 +2528,9 @@ exports.commands = {
const name = Punishments.roomUnblacklist(room, target);
if (name) {
this.addModCommand("" + name + " was unblacklisted by " + user.name + ".");
this.addModAction("" + name + " was unblacklisted by " + user.name + ".");
if (!room.isPrivate && room.chatRoomData) {
this.globalModlog("UNBLACKLIST", name, " by " + user.name);
this.globalModlog("UNBLACKLIST", name, " by " + user.userid);
}
} else {
this.errorReply("User '" + target + "' is not blacklisted.");
@@ -2498,7 +2553,8 @@ exports.commands = {
user.lastCommand = '';
let unblacklisted = Punishments.roomUnblacklistAll(room);
if (!unblacklisted) return this.errorReply("No users are currently blacklisted in this room to unblacklist.");
this.addModCommand(`All blacklists in this room have been lifted by ${user.name}.`);
this.addModAction(`All blacklists in this room have been lifted by ${user.name}.`);
this.modlog('UNBLACKLISTALL');
this.roomlog(`Unblacklisted users: ${unblacklisted.join(', ')}`);
},
unblacklistallhelp: [`/unblacklistall - Unblacklists all blacklisted users in the current room. Requires #, &, ~`],
@@ -2575,7 +2631,8 @@ exports.commands = {
Punishments.addSharedIp(ip, note);
if (note) note = ` (${note})`;
return this.addModCommand(`The IP '${ip}' was marked as shared by ${user.name}.${note}`);
this.modlog('SHAREDIP', null, ip + note);
return this.addModAction(`The IP '${ip}' was marked as shared by ${user.name}.${note}`);
},
marksharedhelp: [`/markshared [ip] - Marks an IP address as shared. Requires @, &, ~`],
@@ -2587,7 +2644,8 @@ exports.commands = {
if (!Punishments.sharedIps.has(target)) return this.errorReply("This IP isn't marked as shared.");
Punishments.removeSharedIp(target);
return this.addModCommand(`The IP '${target}' was unmarked as shared by ${user.name}.`);
this.modlog('UNSHAREIP', null, target);
return this.addModAction(`The IP '${target}' was unmarked as shared by ${user.name}.`);
},
unmarksharedhelp: [`/unmarkshared [ip] - Unmarks a shared IP address. Requires @, &, ~`],
@@ -2858,7 +2916,7 @@ exports.commands = {
Ladders.disabled = true;
this.logModCommand(`The ladder was disabled by ${user.name}.`);
this.modlog(`DISABLELADDER`);
Monitor.log(`The ladder was disabled by ${user.name}.`);
const innerHTML = (
@@ -2882,7 +2940,7 @@ exports.commands = {
}
Ladders.disabled = false;
this.logModCommand(`The ladder was enabled by ${user.name}.`);
this.modlog('ENABLELADDER');
Monitor.log(`The ladder was enabled by ${user.name}.`);
const innerHTML = (
@@ -3387,7 +3445,8 @@ exports.commands = {
if (!this.can('joinbattle', null, room)) return;
room.auth[targetUser.userid] = Users.PLAYER_SYMBOL;
this.addModCommand("" + name + " was promoted to Player by " + user.name + ".");
this.addModAction("" + name + " was promoted to Player by " + user.name + ".");
this.modlog('ROOMPLAYER', targetUser.getLastId());
},
addplayerhelp: [`/addplayer [username] - Allow the specified user to join the battle as a player.`],
@@ -3421,7 +3480,8 @@ exports.commands = {
if (!this.can('kick', targetUser)) return false;
if (room.game.leaveGame(targetUser)) {
this.addModCommand("" + targetUser.name + " was kicked from a battle by " + user.name + (target ? " (" + target + ")" : ""));
this.addModAction("" + targetUser.name + " was kicked from a battle by " + user.name + (target ? " (" + target + ")" : ""));
this.modlog('KICKBATTLE', targetUser, target, {noip: 1, noalts: 1});
} else {
this.errorReply("/kickbattle - User isn't in battle.");
}
@@ -3471,10 +3531,10 @@ exports.commands = {
if (!this.can('autotimer')) return;
if (this.meansNo(target) || target === 'stop') {
Config.forcetimer = false;
this.addModCommand("Forcetimer is now OFF: The timer is now opt-in. (set by " + user.name + ")");
this.addModAction("Forcetimer is now OFF: The timer is now opt-in. (set by " + user.name + ")");
} else if (this.meansYes(target) || target === 'start' || !target) {
Config.forcetimer = true;
this.addModCommand("Forcetimer is now ON: All battles will be timed. (set by " + user.name + ")");
this.addModAction("Forcetimer is now ON: All battles will be timed. (set by " + user.name + ")");
} else {
this.errorReply("'" + target + "' is not a recognized forcetimer setting.");
}
@@ -3491,7 +3551,7 @@ exports.commands = {
room.battle.endType = 'forced';
if (!target) {
room.battle.tie();
this.logModCommand(user.name + " forced a tie.");
this.modlog('FORCETIE');
return false;
}
let targetUser = Users.getExact(target);
@@ -3501,7 +3561,7 @@ exports.commands = {
if (target) {
room.battle.win(targetUser);
this.logModCommand(user.name + " forced a win for " + target + ".");
this.modlog('FORCEWIN', target);
}
},
forcewinhelp: [

View File

@@ -221,7 +221,8 @@ exports.commands = {
room.game = new Hangman(room, user, word, hint);
room.game.display(user, true);
return this.privateModCommand("(A game of hangman was started by " + user.name + ".)");
this.modlog('HANGMAN');
return this.privateModAction("(A game of hangman was started by " + user.name + ".)");
},
createhelp: ["/hangman create [word], [hint] - Makes a new hangman game. Requires: % @ * # & ~"],
@@ -244,7 +245,8 @@ exports.commands = {
if (!room.game || room.game.gameid !== 'hangman') return this.errorReply("There is no game of hangman running in this room.");
room.game.end();
return this.privateModCommand("(The game of hangman was ended by " + user.name + ".)");
this.modlog('ENDHANGMAN');
return this.privateModAction("(The game of hangman was ended by " + user.name + ".)");
},
endhelp: ["/hangman end - Ends the game of hangman before the man is hanged or word is guessed. Requires: % @ * # & ~"],

View File

@@ -83,7 +83,8 @@ exports.commands = {
if (!target) return;
HF.setCardio(target);
this.privateModCommand(`(${user.name} has set the cardio challenge to: ${target})`);
this.privateModAction(`(${user.name} has set the cardio challenge to: ${target})`);
this.modlog('CARDIO CHALLENGE', null, target);
this.sendReply(`The daily cardio challenge has been updated to: ${target}`);
}
},
@@ -106,7 +107,8 @@ exports.commands = {
if (!target) return;
HF.setGym(target);
this.privateModCommand(`(${user.name} has set the gym challenge to: ${target})`);
this.privateModAction(`(${user.name} has set the gym challenge to: ${target})`);
this.modlog('GYM CHALLENGE', null, target);
this.sendReply(`The daily gym challenge has been updated to: ${target}`);
}
},
@@ -129,7 +131,8 @@ exports.commands = {
if (!target) return;
HF.setQuote(target);
this.privateModCommand(`(${user.name} has set the daily quote to: ${target})`);
this.privateModAction(`(${user.name} has set the daily quote to: ${target})`);
this.modlog('HF QUOTE', null, target);
this.sendReply(`The daily quote has been updated to: ${target}`);
}
},

View File

@@ -84,6 +84,7 @@ class HelpTicket extends Rooms.RoomGame {
modnote(user, text) {
this.room.addByUser(user, text);
this.room.modlog(text);
}
close(staff) {
@@ -601,19 +602,19 @@ exports.commands = {
if (targetUser) {
name = targetUser.getLastName();
userid = targetUser.getLastId();
if (ticket && ticket.banned && ticket.expires > Date.now()) return this.privateModCommand(`(${name} would be ticket banned by ${user.name} but was already ticket banned.)`);
if (ticket && ticket.banned && ticket.expires > Date.now()) return this.privateModAction(`(${name} would be ticket banned by ${user.name} but was already ticket banned.)`);
if (targetUser.trusted) Monitor.log(`[CrisisMonitor] Trusted user ${targetUser.name}${(targetUser.trusted !== targetUser.userid ? ` (${targetUser.trusted})` : ``)} was ticket banned by ${user.name}, and should probably be demoted.`);
} else {
name = this.targetUsername;
userid = toId(this.targetUsername);
if (ticket && ticket.banned && ticket.expires > Date.now()) return this.privateModCommand(`(${name} would be ticket banned by ${user.name} but was already ticket banned.)`);
if (ticket && ticket.banned && ticket.expires > Date.now()) return this.privateModAction(`(${name} would be ticket banned by ${user.name} but was already ticket banned.)`);
}
if (targetUser) {
targetUser.popup(`|modal|${user.name} has banned you from creating help tickets.${(target ? `\n\nReason: ${target}` : ``)}\n\nYour ban will expire in a few days.`);
}
this.addModCommand(`${name} was ticket banned by ${user.name}.${target ? ` (${target})` : ``}`, (targetUser ? `(${targetUser.latestIp})` : ''));
this.addModAction(`${name} was ticket banned by ${user.name}.${target ? ` (${target})` : ``}`);
let affected = [];
let punishment = {
@@ -644,10 +645,13 @@ exports.commands = {
}
let acAccount = (targetUser && targetUser.autoconfirmed !== userid && targetUser.autoconfirmed);
let displayMessage = '';
if (affected.length > 1) {
this.privateModCommand(`(${name}'s ${acAccount ? ` ac account: ${acAccount}, ` : ""}ticket banned alts: ${affected.slice(1).map(user => user.getLastName()).join(", ")})`);
displayMessage = `(${name}'s ${acAccount ? ` ac account: ${acAccount}, ` : ""}ticket banned alts: ${affected.slice(1).map(user => user.getLastName()).join(", ")})`;
this.privateModAction(displayMessage);
} else if (acAccount) {
this.privateModCommand(`(${name}'s ac account: ${acAccount})`);
displayMessage = `(${name}'s ac account: ${acAccount})`;
this.privateModAction(displayMessage);
}
for (let i in affected) {
@@ -691,7 +695,7 @@ exports.commands = {
delete tickets[ticket.userid];
writeTickets();
this.addModCommand(`${affected.join(', ')} ${Chat.plural(affected.length, "were", "was")} ticket unbanned by ${user.name}.`);
this.addModAction(`${affected.join(', ')} ${Chat.plural(affected.length, "were", "was")} ticket unbanned by ${user.name}.`);
this.globalModlog("UNTICKETBAN", target, `by ${user.name}`);
if (targetUser) targetUser.popup(`${user.name} has ticket unbanned you.`);
},

View File

@@ -1603,10 +1603,12 @@ exports.commands = {
if (target === 'delete' || target === 'remove') {
if (!room.rulesLink) return this.errorReply("This room does not have rules set to remove.");
delete room.rulesLink;
this.privateModCommand(`(${user.name} has removed the room rules link.)`);
this.privateModAction(`(${user.name} has removed the room rules link.)`);
this.modlog('RULES', null, `removed room rules link`);
} else {
room.rulesLink = target;
this.privateModCommand(`(${user.name} changed the room rules link to: ${target})`);
this.privateModAction(`(${user.name} changed the room rules link to: ${target})`);
this.modlog('RULES', null, `changed link to: ${target}`);
}
if (room.chatRoomData) {
@@ -1899,10 +1901,10 @@ exports.commands = {
Rooms.SimulatorProcess.eval('Config.potd = \'' + toId(target) + '\'');
if (target) {
if (Rooms.lobby) Rooms.lobby.addRaw("<div class=\"broadcast-blue\"><b>The Pok&eacute;mon of the Day is now " + target + "!</b><br />This Pokemon will be guaranteed to show up in random battles.</div>");
this.logModCommand("The Pok\u00e9mon of the Day was changed to " + target + " by " + user.name + ".");
this.modlog('POTD', null, target);
} else {
if (Rooms.lobby) Rooms.lobby.addRaw("<div class=\"broadcast-blue\"><b>The Pok&eacute;mon of the Day was removed!</b><br />No pokemon will be guaranteed in random battles.</div>");
this.logModCommand("The Pok\u00e9mon of the Day was removed by " + user.name + ".");
this.modlog('POTD', null, 'removed');
}
},

View File

@@ -548,7 +548,8 @@ exports.commands = {
if (categoryCount > MAX_CATEGORY_COUNT) return this.sendReply(`A match with more than ${MAX_CATEGORY_COUNT} categories cannot be created.`);
if (questionCount > MAX_QUESTION_COUNT) return this.sendReply(`A match with more than ${MAX_QUESTION_COUNT} questions per category cannot be created.`);
room.game = new Jeopardy(room, user, categoryCount, questionCount);
this.privateModCommand(`A new game of Jeopardy was started by ${user.name}`);
this.privateModAction(`A new game of Jeopardy was started by ${user.name}`);
this.modlog('JEOPARDY');
},
categories: function (target, room, user) {
@@ -726,7 +727,8 @@ exports.commands = {
if (!room.game || room.game.gameid !== 'jeopardy') return this.errorReply("There is no game of Jeopardy going on in this room.");
if (!this.can('minigame', null, room)) return;
room.game.destroy();
this.privateModCommand(`The game of Jeopardy was ended by ${user.name}`);
this.privateModAction(`The game of Jeopardy was ended by ${user.name}`);
this.modlog('JEOPARDY END');
},
pass: function (target, room, user) {
@@ -742,7 +744,8 @@ exports.commands = {
if (!amount || amount < 2 || amount > 120) return this.errorReply("The amount must be a number between 2 and 120.");
room.game.answeringTime = amount;
this.addModCommand(`${user.name} has set the answering window for questions to ${amount} seconds`);
this.addModAction(`${user.name} has set the answering window for questions to ${amount} seconds`);
this.modlog('JEOPARDY TIMER', null, `${amount} seconds`);
},
finaltimer: function (target, room, user) {
@@ -752,7 +755,8 @@ exports.commands = {
if (!amount || amount < 2 || amount > 300) return this.errorReply("The amount must be a number between 2 and 300.");
room.game.finalAnsweringTime = amount;
this.addModCommand(`${user.name} has set the answering window for the final question to ${amount} seconds`);
this.addModAction(`${user.name} has set the answering window for the final question to ${amount} seconds`);
this.modlog('JEOPARDY FINALTIMER', null, `${amount} seconds`);
},
},
jeopardyhelp: [

View File

@@ -790,8 +790,8 @@ exports.commands = {
room.game = new Mafia(room, params.length, params, defaultSettings);
}
return this.privateModCommand("(A game of mafia was started by " + user.name + ".)");
this.modlog('MAFIA');
return this.privateModAction("(A game of mafia was started by " + user.name + ".)");
},
display: function (target, room, user) {
@@ -908,7 +908,8 @@ exports.commands = {
if (!this.canTalk()) return;
room.game.forceEnd();
return this.privateModCommand("(The game of mafia was forcibly ended by " + user.name + ".)");
this.modlog('MAFIAEND');
return this.privateModAction("(The game of mafia was forcibly ended by " + user.name + ".)");
},
disable: function (target, room, user) {

View File

@@ -254,7 +254,7 @@ function prettifyResults(rawResults, room, searchString, exactSearch, addModlogL
let time;
let bracketIndex;
if (line) {
if (hideIps) line = line.replace(/\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\)/g, '');
if (hideIps) line = line.replace(/[([][0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[)\]]/g, '');
bracketIndex = line.indexOf(']');
if (bracketIndex < 0) return Chat.escapeHTML(line);
time = new Date(line.slice(1, bracketIndex));

View File

@@ -217,7 +217,8 @@ exports.commands = {
room.poll.display();
this.roomlog("" + user.name + " used " + message);
return this.privateModCommand("(A poll was started by " + user.name + ".)");
this.modlog('POLL');
return this.privateModAction("(A poll was started by " + user.name + ".)");
},
newhelp: [`/poll create [question], [option1], [option2], [...] - Creates a poll. Requires: % @ * # & ~`],
@@ -260,7 +261,8 @@ exports.commands = {
delete room.poll;
}, (timeout * 60000));
room.add("The poll timer was turned on: the poll will end in " + timeout + " minute(s).");
return this.privateModCommand("(The poll timer was set to " + timeout + " minute(s) by " + user.name + ".)");
this.modlog('POLL TIMER', null, `${timeout} minutes`);
return this.privateModAction("(The poll timer was set to " + timeout + " minute(s) by " + user.name + ".)");
} else {
if (!this.runBroadcast()) return;
if (room.poll.timeout) {
@@ -292,7 +294,8 @@ exports.commands = {
room.poll.end();
delete room.poll;
return this.privateModCommand("(The poll was ended by " + user.name + ".)");
this.modlog('POLL END');
return this.privateModAction("(The poll was ended by " + user.name + ".)");
},
endhelp: [`/poll end - Ends a poll and displays the results. Requires: % @ * # & ~`],

View File

@@ -62,7 +62,8 @@ exports.commands = {
date: date,
desc: desc,
};
this.privateModCommand(`(${user.name} ${this.cmd}ed ${this.cmd === 'add' ? 'a' : 'the'} roomevent titled "${eventName}".)`);
this.privateModAction(`(${user.name} ${this.cmd}ed ${this.cmd === 'add' ? 'a' : 'the'} roomevent titled "${eventName}".)`);
this.modlog('ROOMEVENT', null, `${this.cmd}ed "${eventName}"`);
room.chatRoomData.events = room.events;
Rooms.global.writeChatRoomData();
@@ -77,7 +78,8 @@ exports.commands = {
target = toId(target);
if (!room.events[target]) return this.errorReply(`There is no such event named '${target}'. Check spelling?`);
delete room.events[target];
this.privateModCommand(`(${user.name} removed a roomevent titled "${target}".)`);
this.privateModAction(`(${user.name} removed a roomevent titled "${target}".)`);
this.modlog('ROOMEVENT', null, `removed "${target}"`);
room.chatRoomData.events = room.events;
Rooms.global.writeChatRoomData();

View File

@@ -45,7 +45,8 @@ exports.commands = {
roomFaqs[room.id][topic] = text;
saveRoomFaqs();
this.sendReplyBox(Chat.formatText(text, true));
this.privateModCommand(`(${user.name} added a FAQ for '${topic}')`);
this.privateModAction(`(${user.name} added a FAQ for '${topic}')`);
this.modlog('RFAQ', null, `added '${topic}'`);
},
removefaq: function (target, room, user) {
if (!this.canTalk()) return this.errorReply("You cannot do this while unable to talk.");
@@ -59,7 +60,8 @@ exports.commands = {
Object.keys(roomFaqs[room.id]).filter(val => getAlias(room.id, val) === topic).map(val => delete roomFaqs[room.id][val]);
if (!Object.keys(roomFaqs[room.id]).length) delete roomFaqs[room.id];
saveRoomFaqs();
this.privateModCommand(`(${user.name} removed the FAQ for '${topic}')`);
this.privateModAction(`(${user.name} removed the FAQ for '${topic}')`);
this.modlog('ROOMFAQ', null, `removed ${topic}`);
},
addalias: function (target, room, user) {
if (!this.canTalk()) return this.errorReply("You cannot do this while unable to talk.");
@@ -74,7 +76,8 @@ exports.commands = {
if (getAlias(room.id, topic)) return this.errorReply(`You cannot make an alias of an alias. Use /addalias ${alias}, ${getAlias(room.id, topic)} instead.`);
roomFaqs[room.id][alias] = `>${topic}`;
saveRoomFaqs();
this.privateModCommand(`(${user.name} added an alias for '${topic}': ${alias})`);
this.privateModAction(`(${user.name} added an alias for '${topic}': ${alias})`);
this.modlog('ROOMFAQ', null, `alias for '${topic}' - ${alias}`);
},
rfaq: 'roomfaq',
roomfaq: function (target, room, user) {

View File

@@ -243,7 +243,8 @@ exports.commands = {
this.add(`|raw|<div class="broadcast-red"><strong>Moderated chat was set to ${modchatSetting}!</strong><br />Only users of rank ${modchatSetting} and higher can talk.</div>`);
}
if (room.battle && !room.modchat && !user.can('modchat')) room.requestModchat(null);
this.privateModCommand(`(${user.name} set modchat to ${room.modchat})`);
this.privateModAction(`(${user.name} set modchat to ${room.modchat})`);
this.modlog('MODCHAT', null, `to ${room.modchat}`);
if (room.chatRoomData) {
room.chatRoomData.modchat = room.modchat;
@@ -295,7 +296,8 @@ exports.commands = {
if (!room.modjoin) return this.errorReply(`Modjoin is already turned off in this room.`);
delete room.modjoin;
this.add(`|raw|<div class="broadcast-blue"><strong>This room is no longer invite only!</strong><br />Anyone may now join.</div>`);
this.addModCommand(`${user.name} turned off modjoin.`);
this.addModAction(`${user.name} turned off modjoin.`);
this.modlog('MODJOIN', null, 'OFF');
if (room.chatRoomData) {
delete room.chatRoomData.modjoin;
Rooms.global.writeChatRoomData();
@@ -305,19 +307,22 @@ exports.commands = {
if (room.modjoin === true) return this.errorReply(`Modjoin is already set to sync modchat in this room.`);
room.modjoin = true;
this.add(`|raw|<div class="broadcast-red"><strong>Moderated join is set to sync with modchat!</strong><br />Only users who can speak in modchat can join.</div>`);
this.addModCommand(`${user.name} set modjoin to sync with modchat.`);
this.addModAction(`${user.name} set modjoin to sync with modchat.`);
this.modlog('MODJOIN SYNC');
} else if (target === 'ac' || target === 'autoconfirmed') {
if (room.modjoin === 'autoconfirmed') return this.errorReply(`Modjoin is already set to autoconfirmed.`);
room.modjoin = 'autoconfirmed';
this.add(`|raw|<div class="broadcast-red"><strong>Moderated join is set to autoconfirmed!</strong><br />Users must be rank autoconfirmed or invited with <code>/invite</code> to join</div>`);
this.addModCommand(`${user.name} set modjoin to autoconfirmed.`);
this.addModAction(`${user.name} set modjoin to autoconfirmed.`);
this.modlog('MODJOIN', null, 'autoconfirmed');
} else if (target in Config.groups || target === 'trusted') {
if (room.battle && !user.can('makeroom') && target !== '+') return this.errorReply(`/modjoin - Access denied from setting modjoin past + in battles.`);
if (room.isPersonal && !user.can('makeroom') && target !== '+') return this.errorReply(`/modjoin - Access denied from setting modjoin past + in group chats.`);
if (room.modjoin === target) return this.errorReply(`Modjoin is already set to ${target} in this room.`);
room.modjoin = target;
this.add(`|raw|<div class="broadcast-red"><strong>This room is now invite only!</strong><br />Users must be rank ${target} or invited with <code>/invite</code> to join</div>`);
this.addModCommand(`${user.name} set modjoin to ${target}.`);
this.addModAction(`${user.name} set modjoin to ${target}.`);
this.modlog('MODJOIN', null, target);
} else {
this.errorReply(`Unrecognized modjoin setting.`);
this.parse('/help modjoin');
@@ -359,7 +364,8 @@ exports.commands = {
return this.parse("/help slowchat");
}
const slowchatSetting = (room.slowchat || "OFF");
this.privateModCommand(`(${user.name} set slowchat to ${slowchatSetting})`);
this.privateModAction(`(${user.name} set slowchat to ${slowchatSetting})`);
this.modlog('SLOWCHAT', null, slowchatSetting);
if (room.chatRoomData) {
room.chatRoomData.slowchat = room.slowchat;
@@ -391,7 +397,8 @@ exports.commands = {
return this.parse("/help stretchfilter");
}
const stretchSetting = (room.filterStretching ? "ON" : "OFF");
this.privateModCommand(`(${user.name} turned the stretch filter ${stretchSetting})`);
this.privateModAction(`(${user.name} turned the stretch filter ${stretchSetting})`);
this.log('STRETCH FILTER', null, stretchSetting);
if (room.chatRoomData) {
room.chatRoomData.filterStretching = room.filterStretching;
@@ -420,7 +427,8 @@ exports.commands = {
return this.parse("/help capsfilter");
}
const capsSetting = (room.filterCaps ? "ON" : "OFF");
this.privateModCommand(`(${user.name} turned the caps filter ${capsSetting})`);
this.privateModAction(`(${user.name} turned the caps filter ${capsSetting})`);
this.modlog('CAPS FILTER', null, capsSetting);
if (room.chatRoomData) {
room.chatRoomData.filterCaps = room.filterCaps;
@@ -449,7 +457,8 @@ exports.commands = {
return this.parse("/help emojifilter");
}
const emojiSetting = (room.filterEmojis ? "ON" : "OFF");
this.privateModCommand(`(${user.name} turned the emoji filter ${emojiSetting})`);
this.privateModAction(`(${user.name} turned the emoji filter ${emojiSetting})`);
this.modlog('EMOJI FILTER', null, emojiSetting);
if (room.chatRoomData) {
room.chatRoomData.filterEmojis = room.filterEmojis;
@@ -496,10 +505,12 @@ exports.commands = {
room.banwords = room.banwords.concat(words);
room.banwordRegex = null;
if (words.length > 1) {
this.privateModCommand(`(The banwords ${words.map(w => `'${w}'`).join(', ')} were added by ${user.name}.)`);
this.privateModAction(`(The banwords ${words.map(w => `'${w}'`).join(', ')} were added by ${user.name}.)`);
this.modlog('BANWORD', null, words.map(w => `'${w}'`).join(', '));
this.sendReply(`Banned phrases succesfully added. The list is currently: ${room.banwords.join(', ')}`);
} else {
this.privateModCommand(`(The banword '${words[0]}' was added by ${user.name}.)`);
this.privateModAction(`(The banword '${words[0]}' was added by ${user.name}.)`);
this.modlog('BANWORD', null, words[0]);
this.sendReply(`Banned phrase succesfully added. The list is currently: ${room.banwords.join(', ')}`);
}
@@ -527,10 +538,12 @@ exports.commands = {
room.banwords = room.banwords.filter(w => !words.includes(w));
room.banwordRegex = null;
if (words.length > 1) {
this.privateModCommand(`(The banwords ${words.map(w => `'${w}'`).join(', ')} were removed by ${user.name}.)`);
this.privateModAction(`(The banwords ${words.map(w => `'${w}'`).join(', ')} were removed by ${user.name}.)`);
this.modlog('UNBANWORD', null, words.map(w => `'${w}'`).join(', '));
this.sendReply(`Banned phrases succesfully deleted. The list is currently: ${room.banwords.join(', ')}`);
} else {
this.privateModCommand(`(The banword '${words[0]}' was removed by ${user.name}.)`);
this.privateModAction(`(The banword '${words[0]}' was removed by ${user.name}.)`);
this.modlog('UNBANWORD', null, words[0]);
this.sendReply(`Banned phrase succesfully deleted. The list is currently: ${room.banwords.join(', ')}`);
}

View File

@@ -492,9 +492,10 @@ class ScavengerHunt extends Rooms.RoomGame {
// notify staff
let staffMsg = `(${player.name} has been caught trying to do their own hunt.)`;
let logMsg = `([${player.userid}] has been caught trying to do their own hunt.)`;
this.room.sendMods(staffMsg);
this.room.roomlog(staffMsg);
this.room.modlog(staffMsg);
this.room.modlog(`(${this.room.id}) ${logMsg}`);
PlayerLeaderboard.addPoints(player.name, 'infraction', 1);
player.infracted = true;
@@ -507,9 +508,11 @@ class ScavengerHunt extends Rooms.RoomGame {
// notify staff
let staffMsg = `(${player.name} has been caught attempting a hunt with ${uniqueConnections} connections on the account. The user has also been given 1 infraction point on the player leaderboard.)`;
let logMsg = `([${player.userid}] has been caught attempting a hunt with ${uniqueConnections} connections on the account. The user has also been given 1 infraction point on the player leaderboard.)`;
this.room.sendMods(staffMsg);
this.room.roomlog(staffMsg);
this.room.modlog(staffMsg);
this.room.modlog(`(${this.room.id}) ${logMsg}`);
PlayerLeaderboard.addPoints(player.name, 'infraction', 1);
player.infracted = true;
@@ -719,7 +722,8 @@ let commands = {
if (!this.can('mute', null, room)) return false;
if (!room.game || !room.game.scavParentGame) return this.errorReply(`There is no scavenger game currently running.`);
this.privateModCommand(`The ${room.game.title} has been forcibly ended by ${user.name}.`);
this.privateModAction(`The ${room.game.title} has been forcibly ended by ${user.name}.`);
this.modlog('SCAVENGER', null, 'ended the hunt');
room.game.announce(`The ${room.game.title} has been forcibly ended.`);
room.game.destroy();
},
@@ -733,7 +737,8 @@ let commands = {
let success = room.game.eliminate(targetId);
if (success) {
this.addModCommand(`User '${targetId}' has been kicked from the ${room.game.title}.`);
this.addModAction(`User '${targetId}' has been kicked from the ${room.game.title}.`);
this.modlog('SCAVENGERS', target, `kicked from the ${room.game.title}`);
} else {
this.errorReply(`Unable to kick user '${targetId}'.`);
}
@@ -793,7 +798,8 @@ let commands = {
} else {
room.game = new ScavengerHunt(room, user, hosts, gameType, params.result);
}
this.privateModCommand(`(A new scavenger hunt was created by ${user.name}.)`);
this.privateModAction(`(A new scavenger hunt was created by ${user.name}.)`);
this.modlog('SCAV NEW', null, `${gameType ? gameType.toUpperCase() : ''}: creators - ${hosts.map(h => h.userid)}`);
},
status: function (target, room, user) {
@@ -839,7 +845,8 @@ let commands = {
let message = `The scavenger timer has been ${(result === 'off' ? "turned off" : `set to ${result} minutes`)}`;
room.add(message + '.');
this.privateModCommand(`(${message} by ${user.name}.)`);
this.privateModAction(`(${message} by ${user.name}.)`);
this.modlog('SCAV TIMER', null, (result === 'off' ? 'OFF' : `${result} minutes`));
},
inherit: function (target, room, user) {
@@ -858,7 +865,8 @@ let commands = {
game.eliminate(user.userid);
game.cacheUserIps(user);
this.privateModCommand(`(${user.name} has inherited staff permissions for the current hunt.)`);
this.privateModAction(`(${user.name} has inherited staff permissions for the current hunt.)`);
this.modlog('SCAV INHERIT');
},
reset: function (target, room, user) {
@@ -866,7 +874,8 @@ let commands = {
if (!room.game || !room.game.scavGame) return this.errorReply(`There is no scavenger game currently running.`);
room.game.onEnd(true, user);
this.privateModCommand(`(${user.name} has reset the scavenger hunt.)`);
this.privateModAction(`(${user.name} has reset the scavenger hunt.)`);
this.modlog('SCAV RESET');
},
forceend: 'end',
@@ -884,7 +893,8 @@ let commands = {
}
room.game.onEnd(null, user);
this.privateModCommand(`(${user.name} has ended the scavenger hunt.)`);
this.privateModAction(`(${user.name} has ended the scavenger hunt.)`);
this.modlog('SCAV END');
},
viewhunt: function (target, room, user) {
@@ -915,7 +925,10 @@ let commands = {
let game = room.game.childGame || room.game;
let success = game.eliminate(null, targetId);
if (success) return this.privateModCommand(`(${user.name} has kicked '${targetId}' from the scavenger hint.)`);
if (success) {
this.modlog('SCAV KICK', targetId);
return this.privateModAction(`(${user.name} has kicked '${targetId}' from the scavenger hunt.)`);
}
this.errorReply(`Unable to kick '${targetId}' from the scavenger hunt.`);
},
@@ -938,7 +951,7 @@ let commands = {
if (!room.scavQueue) room.scavQueue = [];
room.scavQueue.push({hosts: hosts, questions: params.result, staffHostId: user.userid, staffHostName: user.name});
this.privateModCommand(`(${user.name} has added a scavenger hunt to the queue.)`);
this.privateModAction(`(${user.name} has added a scavenger hunt to the queue.)`);
if (room.chatRoomData) {
room.chatRoomData.scavQueue = room.scavQueue;
@@ -954,7 +967,7 @@ let commands = {
if (!room.scavQueue || isNaN(id) || id < 0 || id >= room.scavQueue.length) return false; // this command should be using the display to manage anyways.
let removed = room.scavQueue.splice(id, 1)[0];
this.privateModCommand(`(${user.name} has removed a scavenger hunt by [${removed.hosts.map(u => u.name).join(", ")}] from the queue.)`);
this.privateModAction(`(${user.name} has removed a scavenger hunt created by [${removed.hosts.map(u => u.userid).join(", ")}] from the queue.)`);
this.sendReply(`|uhtmlchange|scav-queue|${formatQueue(room.scavQueue, user, room)}`);
if (room.chatRoomData) {
@@ -985,6 +998,7 @@ let commands = {
room.game = new ScavengerHunt(room, {userid: next.staffHostId, name: next.staffHostName}, next.hosts, false, next.questions);
if (target) this.sendReply(`|uhtmlchange|scav-queue|${formatQueue(room.scavQueue, user, room)}`);
this.modlog('SCAV NEW', null, `from queue: creators - ${next.hosts.map(h => h.userid)}`);
// update the saved queue.
if (room.chatRoomData) {
@@ -1007,7 +1021,8 @@ let commands = {
Rooms.global.writeChatRoomData();
}
this.sendReply(`|uhtmlchange|scav-queue|${formatQueue(room.scavQueue, user, room)}`);
this.privateModCommand(`(The queue has been ${state ? 'disabled' : 'enabled'} by ${user.name}.)`);
this.privateModAction(`(The queue has been ${state ? 'disabled' : 'enabled'} by ${user.name}.)`);
this.modlog('SCAV QUEUE', null, (state ? 'disabled' : 'enabled'));
},
defaulttimer: function (target, room, user) {
@@ -1024,7 +1039,8 @@ let commands = {
room.chatRoomData.defaultScavTimer = room.defaultScavTimer;
Rooms.global.writeChatRoomData();
}
this.privateModCommand(`(The default scavenger timer has been set to ${duration} minutes by ${user.name}.)`);
this.privateModAction(`(The default scavenger timer has been set to ${duration} minutes by ${user.name}.)`);
this.modlog('SCAV DEFAULT TIMER', null, `${duration} minutes`);
},
/**
@@ -1043,7 +1059,8 @@ let commands = {
Leaderboard.addPoints(targetId, 'points', points, true).write();
this.privateModCommand(`(${targetId} was given ${points} points on the monthly scavengers ladder by ${user.name}.)`);
this.privateModAction(`(${targetId} was given ${points} points on the monthly scavengers ladder by ${user.name}.)`);
this.modlog('SCAV ADDPOINTS', targetId, points);
},
removepoints: function (target, room, user) {
@@ -1059,7 +1076,8 @@ let commands = {
Leaderboard.addPoints(targetId, 'points', -points, true).write();
this.privateModCommand(`(${user.name} has taken ${points} points from ${targetId} on the monthly scavengers ladder.)`);
this.privateModAction(`(${user.name} has taken ${points} points from ${targetId} on the monthly scavengers ladder.)`);
this.modlog('SCAV REMOVEPOINTS', targetId, points);
},
resetladder: function (target, room, user) {
@@ -1068,7 +1086,8 @@ let commands = {
Leaderboard.reset().write();
this.privateModCommand(`(${user.name} has reset the monthly scavengers ladder.)`);
this.privateModAction(`(${user.name} has reset the monthly scavengers ladder.)`);
this.modlog('SCAV RESETLADDER');
},
top: 'ladder',
ladder: function (target, room, user) {
@@ -1118,7 +1137,8 @@ let commands = {
room.chatRoomData.blitzPoints = room.blitzPoints;
Rooms.global.writeChatRoomData();
}
this.privateModCommand(`(${user.name} has set the points awarded for blitz to ${blitzPoints}.)`);
this.privateModAction(`(${user.name} has set the points awarded for blitz to ${blitzPoints}.)`);
this.modlog('SCAV BLITZ', null, blitzPoints);
},
setpoints: function (target, room, user) {
@@ -1138,7 +1158,9 @@ let commands = {
room.chatRoomData.winPoints = room.winPoints;
Rooms.global.writeChatRoomData();
}
this.privateModCommand(`(${user.name} has set the points awarded for winning an official scavenger hunt to - ${winPoints.map((p, i) => `(${(i + 1)}) ${p}`).join(', ')})`);
const pointsDisplay = winPoints.map((p, i) => `(${(i + 1)}) ${p}`).join(', ');
this.privateModAction(`(${user.name} has set the points awarded for winning an official scavenger hunt to - ${pointsDisplay})`);
this.modlog('SCAV SETPOINTS', null, pointsDisplay);
},
/**
@@ -1153,13 +1175,15 @@ let commands = {
if (!this.can('declare', null, room)) return false;
HostLeaderboard.softReset().then(() => {
HostLeaderboard.write();
this.privateModCommand(`(${user.name} has reset the host log leaderboard into the next month.)`);
this.privateModAction(`(${user.name} has reset the host log leaderboard into the next month.)`);
this.modlog('SCAV HUNTLOGS', null, 'RESET');
});
return;
} else if (target === 'HARD RESET') {
if (!this.can('declare', null, room)) return false;
HostLeaderboard.hardReset().write();
this.privateModCommand(`(${user.name} has hard reset the host log leaderboard.)`);
this.privateModAction(`(${user.name} has hard reset the host log leaderboard.)`);
this.modlog('SCAV HUNTLOGS', null, 'HARD RESET');
return;
}
@@ -1195,13 +1219,15 @@ let commands = {
if (!this.can('declare', null, room)) return false;
PlayerLeaderboard.softReset().then(() => {
PlayerLeaderboard.write();
this.privateModCommand(`(${user.name} has reset the player log leaderboard into the next month.)`);
this.privateModAction(`(${user.name} has reset the player log leaderboard into the next month.)`);
this.modlog('SCAV PLAYLOGS', null, 'RESET');
});
return;
} else if (target === 'HARD RESET') {
if (!this.can('declare', null, room)) return false;
PlayerLeaderboard.hardReset().write();
this.privateModCommand(`(${user.name} has hard reset the player log leaderboard.)`);
this.privateModAction(`(${user.name} has hard reset the player log leaderboard.)`);
this.modlog('SCAV PLAYLOGS', null, 'HARD RESET');
return;
}
@@ -1251,7 +1277,8 @@ let commands = {
PlayerLeaderboard.addPoints(targetId, 'infraction', change, true).write();
this.privateModCommand(`(${user.name} has ${(change > 0 ? 'given' : 'taken')} one infraction point ${(change > 0 ? 'to' : 'from')} '${targetId}'.)`);
this.privateModAction(`(${user.name} has ${(change > 0 ? 'given' : 'taken')} one infraction point ${(change > 0 ? 'to' : 'from')} '${targetId}'.)`);
this.modlog(`SCAV ${this.cmd.toUpperCase()}`, user);
},
};

View File

@@ -26,7 +26,7 @@ exports.commands = {
if (!room.chatRoomData.quote) return this.sendReply("The Quote of the Day has already been reset.");
delete room.chatRoomData.quote;
this.sendReply("The Quote of the Day was reset by " + Chat.escapeHTML(user.name) + ".");
this.logModCommand(user.name + " reset the Quote of the Day.");
this.modlog('QOTD', null, 'RESET');
Rooms.global.writeChatRoomData();
return;
}
@@ -36,7 +36,7 @@ exports.commands = {
"<div class=\"broadcast-blue\"><strong>The Inspirational Quote of the Day has been updated by " + Chat.escapeHTML(user.name) + ".</strong><br />" +
"Quote: " + room.chatRoomData.quote + "</div>"
);
this.logModCommand(Chat.escapeHTML(user.name) + " updated the quote of the day to \"" + room.chatRoomData.quote + "\".");
this.modlog('QOTD', null, `to "${room.chatRoomData.quote}"`);
},
quoteofthedayhelp: 'qotdhelp',
qotdhelp: [

View File

@@ -234,7 +234,8 @@ let commands = {
room.aotdVote = new ArtistOfTheDayVote(room);
room.aotdVote.display(false);
this.privateModCommand(`(${user.name} has started nominations for the Artist of the Day.)`);
this.privateModAction(`(${user.name} has started nominations for the Artist of the Day.)`);
this.modlog('AOTD START');
},
starthelp: [`/aotd start - Starts nominations for the Artist of the Day. Requires: % @ # & ~`],
@@ -246,7 +247,8 @@ let commands = {
if (!room.aotdVote.runAotd()) return this.errorReply("Can't select an Artist of the Day without nominations.");
this.privateModCommand(`(${user.name} has ended nominations for the Artist of the Day.)`);
this.privateModAction(`(${user.name} has ended nominations for the Artist of the Day.)`);
this.modlog('AOTD END');
},
endhelp: [`/aotd end - End nominations for the Artist of the Day and set it to a randomly selected artist. Requires: % @ # & ~`],
@@ -292,7 +294,8 @@ let commands = {
if (!userid) return this.errorReply(`'${name}' is not a valid username.`);
if (removeNomination(userid)) {
this.privateModCommand(`(${user.name} removed ${this.targetUsername}'s nomination for the Artist of the Day.)`);
this.privateModAction(`(${user.name} removed ${this.targetUsername}'s nomination for the Artist of the Day.)`);
this.modlog('AOTD REMOVENOM', userid);
} else {
this.sendReply(`User '${name}' has no nomination for the Artist of the Day.`);
}
@@ -344,7 +347,8 @@ let commands = {
if (keys.length) {
setWinnerProperty(changelist);
return this.privateModCommand(`(${user.name} changed the following propert${Chat.plural(keys, 'ies', 'y')} of the Artist of the Day: ${keys.join(', ')})`);
this.modlog('AOTD', null, `changed ${keys.join(', ')}`);
return this.privateModAction(`(${user.name} changed the following propert${Chat.plural(keys, 'ies', 'y')} of the Artist of the Day: ${keys.join(', ')})`);
}
},
sethelp: [`/aotd set property: value[, property: value] - Set the artist, quote, song, link or image for the current Artist of the Day. Requires: % @ * # & ~`],

View File

@@ -657,9 +657,14 @@ class Trivia extends Rooms.RoomGame {
` mode trivia under the ${this.category} category with a cap of ` +
`${this.cap} points, with ${winner.points} points and ` +
`${winner.correctAnswers} correct answers!)`;
let logbuf = `(User ${winner.userid} won the game of ${this.mode}` +
` mode trivia under the ${this.category} category with a cap of ` +
`${this.cap} points, with ${winner.points} points and ` +
`${winner.correctAnswers} correct answers!)`;
this.room.sendMods(buf);
this.room.roomlog(buf);
this.room.modlog(buf);
this.room.modlog(`(${this.room.id}) ${logbuf}`);
writeTriviaData();
this.destroy();
@@ -1446,13 +1451,15 @@ const commands = {
if (cmd === 'add') {
triviaData.questions.splice(findEndOfCategory(category, false), 0, submission);
writeTriviaData();
return this.privateModCommand(`(Question '${target[1]}' was added to the ${isWL ? "Weakest Link" : "Trivia"} question database by ${user.name}.)`);
this.modlog('TRIVIAQUESTION', null, `added to ${isWL ? "Weakest Link" : "Trivia"} - '${target[1]}'`);
return this.privateModAction(`(Question '${target[1]}' was added to the ${isWL ? "Weakest Link" : "Trivia"} question database by ${user.name}.)`);
}
submissions.splice(findEndOfCategory(category, true), 0, submission);
writeTriviaData();
if (!user.can('mute', null, room)) this.sendReply(`Question '${target[1]}' was submitted for review.`);
this.privateModCommand(`(${user.name} submitted question '${target[1]}' for review.)`);
this.modlog('TRIVIAQUESTION', null, `submitted '${target[1]}'`);
this.privateModAction(`(${user.name} submitted question '${target[1]}' for review.)`);
},
submithelp: [`/trivia submit [category] | [question] | [answer1], [answer2] ... [answern] - Add a question to the submission database for staff to review. Requires: + % @ # & ~`],
addhelp: [`/trivia add [category] | [question] | [answer1], [answer2], ... [answern] - Add a question to the question database. Requires: % @ # & ~`],
@@ -1502,7 +1509,8 @@ const commands = {
triviaData.submissions = [];
writeTriviaData();
return this.privateModCommand(`(${user.name} ${(isAccepting ? " added " : " removed ")} all questions from the submission database.)`);
this.modlog(`TRIVIAQUESTION`, null, `${(isAccepting ? "added" : "removed")} all from submission database.`);
return this.privateModAction(`(${user.name} ${(isAccepting ? " added " : " removed ")} all questions from the submission database.)`);
}
if (/^\d+(?:-\d+)?(?:, ?\d+(?:-\d+)?)*$/.test(target)) {
@@ -1555,7 +1563,8 @@ const commands = {
}
writeTriviaData();
return this.privateModCommand(`(${user.name} ${(isAccepting ? "added " : "removed ")}submission number${(indicesLen > 1 ? "s " : " ")}${target} from the submission database.)`);
this.modlog('TRIVIAQUESTION', null, `${(isAccepting ? "added " : "removed ")}submission number${(indicesLen > 1 ? "s " : " ")}${target}`);
return this.privateModAction(`(${user.name} ${(isAccepting ? "added " : "removed ")}submission number${(indicesLen > 1 ? "s " : " ")}${target} from the submission database.)`);
}
this.errorReply(`'${target}' is an invalid argument. View /trivia help questions for more information.`);
@@ -1580,7 +1589,8 @@ const commands = {
if (toId(question.question) === questionID) {
questions.splice(i, 1);
writeTriviaData();
return this.privateModCommand(`(${user.name} removed question '${target}' from the question database.)`);
this.modlog('TRIVIAQUESTION', null, `removed '${target}'`);
return this.privateModAction(`(${user.name} removed question '${target}' from the question database.)`);
}
}
@@ -1756,7 +1766,8 @@ const commands = {
}
CATEGORIES.ugm = 'Ultimate Gaming Month';
writeTriviaData();
return this.privateModCommand(`(${user.name} enabled UGM mode.)`);
this.modlog('UGMMODE', null, 'ON');
return this.privateModAction(`(${user.name} enabled UGM mode.)`);
}
if (command === 'disable') {
if (!triviaData.ugm) return this.errorReply("UGM mode is already disabled.");
@@ -1764,7 +1775,8 @@ const commands = {
delete triviaData.ugm;
delete CATEGORIES.ugm;
writeTriviaData();
return this.privateModCommand(`(${user.name} disabled UGM mode.)`);
this.modlog('UGMMODE', null, 'OFF');
return this.privateModAction(`(${user.name} disabled UGM mode.)`);
}
this.errorReply("Invalid target. Valid targets: enable, disable");
},
@@ -1864,4 +1876,3 @@ module.exports = {
],
},
};

View File

@@ -556,13 +556,17 @@ exports.commands = {
let suppressMessages = cmd.includes('private') || !(cmd.includes('public') || room.id === 'gamecorner');
room.game = new UNOgame(room, target, suppressMessages);
this.privateModCommand(`(A game of UNO was created by ${user.name}.)`);
this.privateModAction(`(A game of UNO was created by ${user.name}.)`);
this.modlog('UNO CREATE');
},
start: function (target, room, user) {
if (!this.can('minigame', null, room)) return;
if (!room.game || room.game.gameid !== 'uno' || room.game.state !== 'signups') return this.errorReply("There is no UNO game in signups phase in this room.");
if (room.game.onStart()) this.privateModCommand(`(The game of UNO was started by ${user.name}.)`);
if (room.game.onStart()) {
this.privateModAction(`(The game of UNO was started by ${user.name}.)`);
this.modlog('UNO START');
}
},
stop: 'end',
@@ -571,7 +575,8 @@ exports.commands = {
if (!room.game || room.game.gameid !== 'uno') return this.errorReply("There is no UNO game going on in this room.");
room.game.destroy();
room.add("The game of UNO was forcibly ended.").update();
this.privateModCommand(`(The game of UNO was ended by ${user.name}.)`);
this.privateModAction(`(The game of UNO was ended by ${user.name}.)`);
this.modlog('UNO END');
},
timer: function (target, room, user) {
@@ -587,7 +592,8 @@ exports.commands = {
room.game.eliminate(room.game.currentPlayer);
}, amount * 1000);
}
this.addModCommand(`${user.name} has set the UNO automatic disqualification timer to ${amount} seconds.`);
this.addModAction(`${user.name} has set the UNO automatic disqualification timer to ${amount} seconds.`);
this.modlog('UNO TIMER', null, `${amount} seconds`);
},
dq: 'disqualify',
@@ -597,7 +603,8 @@ exports.commands = {
let disqualified = room.game.eliminate(toId(target));
if (disqualified === false) return this.errorReply(`Unable to disqualify ${target}.`);
this.privateModCommand(`(${user.name} has disqualified ${disqualified} from the UNO game.)`);
this.privateModAction(`(${user.name} has disqualified ${disqualified} from the UNO game.)`);
this.modlog('UNO DQ', toId(target));
room.add(`${target} has been disqualified from the UNO game.`).update();
},
@@ -683,7 +690,8 @@ exports.commands = {
room.game.suppressMessages = state;
this.addModCommand(`${user.name} has turned ${(state ? 'on' : 'off')} suppression of UNO game messages.`);
this.addModAction(`${user.name} has turned ${(state ? 'on' : 'off')} suppression of UNO game messages.`);
this.modlog('UNO SUPRESS', null, (state ? 'ON' : 'OFF'));
},
spectate: function (target, room, user) {

View File

@@ -533,7 +533,8 @@ let commands = {
room.giveaway = new QuestionGiveaway(user, targetUser, room, ot, tid, fc, prize, question, answers);
this.privateModCommand(`(${user.name} started a question giveaway for ${targetUser.name})`);
this.privateModAction(`(${user.name} started a question giveaway for ${targetUser.name})`);
this.modlog('QUESTION GIVEAWAY', null, `for ${targetUser.getLastId()}`);
},
changeanswer: 'changequestion',
changequestion: function (target, room, user, conn, cmd) {
@@ -592,7 +593,8 @@ let commands = {
room.giveaway = new LotteryGiveaway(user, targetUser, room, ot, tid, fc, prize, numWinners);
this.privateModCommand(`(${user.name} started a lottery giveaway for ${targetUser.name})`);
this.privateModAction(`(${user.name} started a lottery giveaway for ${targetUser.name})`);
this.log('LOTTERY GIVEAWAY', null, `for ${targetUser.getLastId()}`);
},
leavelotto: 'join',
leavelottery: 'join',
@@ -638,7 +640,8 @@ let commands = {
room.gtsga = new GtsGiveaway(room, targetUser, amount, summary, deposit, lookfor);
this.privateModCommand(`(${user.name} started a GTS giveaway for ${targetUser.name})`);
this.privateModAction(`(${user.name} started a GTS giveaway for ${targetUser.name})`);
this.modlog('GTS GIVEAWAY', null, `for ${targetUser.getLastId()}`);
},
left: function (target, room, user) {
if (room.id !== 'wifi') return false;
@@ -682,8 +685,9 @@ let commands = {
return this.errorReply("The reason is too long. It cannot exceed 300 characters.");
}
room.gtsga.end(true);
this.modlog('GIVEAWAY END', null, target);
if (target) target = `: ${target}`;
this.privateModCommand(`(The giveaway was forcibly ended by ${user.name}${target})`);
this.privateModAction(`(The giveaway was forcibly ended by ${user.name}${target})`);
},
},
// general.
@@ -702,8 +706,9 @@ let commands = {
Giveaway.ban(room, targetUser, target);
if (room.giveaway) room.giveaway.kickUser(targetUser);
this.modlog('GIVEAWAYBAN', targetUser, target);
if (target) target = ` (${target})`;
this.privateModCommand(`(${targetUser.name} was banned from entering giveaways by ${user.name}.${target})`);
this.privateModAction(`(${targetUser.name} was banned from entering giveaways by ${user.name}.${target})`);
},
unban: function (target, room, user) {
if (!target) return false;
@@ -716,7 +721,8 @@ let commands = {
if (!Giveaway.checkBanned(room, targetUser)) return this.errorReply(`User '${this.targetUsername}' isn't banned from entering giveaways.`);
Giveaway.unban(room, targetUser);
this.privateModCommand(`${targetUser.name} was unbanned from entering giveaways by ${user.name}.`);
this.privateModAction(`${targetUser.name} was unbanned from entering giveaways by ${user.name}.`);
this.modlog('GIVEAWAYUNBAN', targetUser, null, {noip: 1, noalts: 1});
},
stop: 'end',
end: function (target, room, user) {
@@ -728,8 +734,9 @@ let commands = {
return this.errorReply("The reason is too long. It cannot exceed 300 characters.");
}
room.giveaway.end(true);
this.modlog('GIVEAWAY END', null, target);
if (target) target = `: ${target}`;
this.privateModCommand(`(The giveaway was forcibly ended by ${user.name}${target})`);
this.privateModAction(`(The giveaway was forcibly ended by ${user.name}${target})`);
},
rm: 'remind',
remind: function (target, room, user) {
@@ -820,7 +827,8 @@ let breedingcontests = {
breedingData.latest = toId(contestName);
saveBreedingData();
this.privateModCommand(`(A winner for the '${contestName}' breeding contest was set by ${user.name}.)`);
this.privateModAction(`(A winner for the '${contestName}' breeding contest was set by ${user.name}.)`);
this.modlog('BREEDING WINNER', null, `for the '${contestName}' breeding contest`);
},
view: function (target, room, user) {
if (room.id !== 'wifi') return this.errorReply("This command can only be used in the Wi-Fi room.");

63
chat.js
View File

@@ -598,14 +598,16 @@ class CommandContext {
sendModCommand(data) {
this.room.sendModsByUser(this.user, data);
}
privateModCommand() {
throw new Error(`this.privateModCommand has been renamed to this.privateModAction, which no longer writes to modlog.`);
}
/**
* @param {string} data
* @param {?string} logOnlyText
* @param {string} msg
*/
privateModCommand(data, logOnlyText) {
this.room.sendModsByUser(this.user, data);
this.roomlog(data);
this.room.modlog('(' + this.room.id + ') ' + data + (logOnlyText || ""));
privateModAction(msg) {
this.room.sendMods(msg);
this.roomlog(msg);
}
/**
* @param {string} action
@@ -620,10 +622,41 @@ class CommandContext {
let userid = user.getLastId();
buf += `[${userid}]`;
if (user.autoconfirmed && user.autoconfirmed !== userid) buf += ` ac:[${user.autoconfirmed}]`;
const alts = user.getAltUsers(false, true).map(user => user.getLastName()).join(', ');
if (alts.length) buf += ` alts:[${alts}]`;
buf += ` [${user.latestIp}]`;
}
buf += note;
Rooms.global.modlog(buf);
this.room.modlog('(' + this.room.id + ') ' + buf);
}
/**
* @param {string} action
* @param {string | User} user
* @param {string} note
* @param {object} options
*/
modlog(action, user, note, options = {}) {
let buf = `(${this.room.id}) ${action}: `;
if (user) {
if (typeof user === 'string') {
buf += `[${toId(user)}]`;
} else {
let userid = user.getLastId();
buf += `[${userid}]`;
if (!options.noalts) {
if (user.autoconfirmed && user.autoconfirmed !== userid) buf += ` ac:[${user.autoconfirmed}]`;
const alts = user.getAltUsers(false, true).map(user => user.getLastName()).join(', ');
if (alts.length) buf += ` alts:[${alts}]`;
}
if (!options.noip) buf += ` [${user.latestIp}]`;
}
}
buf += ` by ${this.user.userid}`;
if (note) buf += `: ${note}`;
this.room.modlog('(' + this.room.id + ') ' + buf);
}
/**
* @param {string} data
@@ -632,19 +665,17 @@ class CommandContext {
if (this.pmTarget) return;
this.room.roomlog(data);
}
/**
* @param {string} text
* @param {?string} logOnlyText
*/
addModCommand(text, logOnlyText) {
this.room.addByUser(this.user, text);
this.room.modlog('(' + this.room.id + ') ' + text + (logOnlyText || ""));
logEntry() {
throw new Error(`this.logEntry has been renamed to this.roomlog.`);
}
addModCommand() {
throw new Error(`this.addModCommand has been renamed to this.addModAction, which no longer writes to modlog.`);
}
/**
* @param {string} text
* @param {string} msg
*/
logModCommand(text) {
this.room.modlog('(' + this.room.id + ') ' + text);
addModAction(msg) {
this.room.addByUser(this.user, msg);
}
update() {
if (this.room) this.room.update();

View File

@@ -1058,7 +1058,8 @@ let commands = {
this.room.send('|tournament|update|' + JSON.stringify({playerCap: tournament.playerCap}));
}
const capNote = (tournament.playerCap ? " with a player cap of " + tournament.playerCap : "");
this.privateModCommand("(" + user.name + " set tournament type to " + generator.name + capNote + ".)");
this.privateModAction("(" + user.name + " set tournament type to " + generator.name + capNote + ".)");
this.modlog('TOUR SETTYPE', null, generator.name + capNote);
this.sendReply("Tournament set to " + generator.name + capNote + ".");
}
},
@@ -1084,7 +1085,8 @@ let commands = {
const playerCap = parseInt(params[0]);
if (playerCap === 0) {
tournament.playerCap = 0;
this.privateModCommand("(" + user.name + " removed the tournament's player cap.)");
this.privateModAction("(" + user.name + " removed the tournament's player cap.)");
this.modlog('TOUR PLAYERCAP', null, 'removed');
this.sendReply("Tournament cap removed.");
} else {
if (isNaN(playerCap) || playerCap < 2) return this.errorReply("The tournament cannot have a player cap less than 2.");
@@ -1093,7 +1095,8 @@ let commands = {
if (Config.tourdefaultplayercap && tournament.playerCap > Config.tourdefaultplayercap) {
Monitor.log('[TourMonitor] Room ' + tournament.room.id + ' starting a tour over default cap (' + tournament.playerCap + ')');
}
this.privateModCommand("(" + user.name + " set the tournament's player cap to " + tournament.playerCap + ".)");
this.privateModAction("(" + user.name + " set the tournament's player cap to " + tournament.playerCap + ".)");
this.modlog('TOUR PLAYERCAP', null, tournament.playerCap);
this.sendReply("Tournament cap set to " + tournament.playerCap + ".");
}
this.room.send('|tournament|update|' + JSON.stringify({playerCap: tournament.playerCap}));
@@ -1102,7 +1105,8 @@ let commands = {
stop: 'delete',
delete: function (tournament, user) {
if (deleteTournament(tournament.room.id, this)) {
this.privateModCommand("(" + user.name + " forcibly ended a tournament.)");
this.privateModAction("(" + user.name + " forcibly ended a tournament.)");
this.modlog('TOUR END');
}
},
ruleset: 'customrules',
@@ -1122,7 +1126,8 @@ let commands = {
}
if (tournament.setCustomRules(params, this)) {
this.room.addRaw("<div class='infobox'>This tournament includes:<br />" + tournament.getCustomRules() + "</div>");
this.privateModCommand("(" + user.name + " set the tournament's custom rules to " + tournament.customRules.join(", ") + ".)");
this.privateModAction("(" + user.name + " set the tournament's custom rules to " + tournament.customRules.join(", ") + ".)");
this.modlog('TOUR RULES', null, tournament.customRules.join(", "));
}
},
clearruleset: 'clearcustomrules',
@@ -1138,7 +1143,8 @@ let commands = {
tournament.customRules = [];
tournament.teambuilderFormat = tournament.originalFormat;
this.room.addRaw("<b>The tournament's custom rules were cleared.</b>");
this.privateModCommand("(" + user.name + " cleared the tournament's custom rules.)");
this.privateModAction("(" + user.name + " cleared the tournament's custom rules.)");
this.modlog('TOUR CLEARRULES');
},
name: 'setname',
customname: 'setname',
@@ -1153,7 +1159,8 @@ let commands = {
if (name.includes('|')) return this.errorReply("The tournament's name cannot include the | symbol.");
tournament.format = name;
this.room.send('|tournament|update|' + JSON.stringify({format: tournament.format}));
this.privateModCommand("(" + user.name + " set the tournament's name to " + tournament.format + ".)");
this.privateModAction("(" + user.name + " set the tournament's name to " + tournament.format + ".)");
this.modlog('TOUR NAME', null, tournament.format);
tournament.update();
},
resetname: 'clearname',
@@ -1161,7 +1168,8 @@ let commands = {
if (tournament.format === tournament.originalFormat) return this.errorReply("The tournament does not have a name.");
tournament.format = tournament.originalFormat;
this.room.send('|tournament|update|' + JSON.stringify({format: tournament.format}));
this.privateModCommand("(" + user.name + " cleared the tournament's name.)");
this.privateModAction("(" + user.name + " cleared the tournament's name.)");
this.modlog('TOUR CLEARNAME');
tournament.update();
},
},
@@ -1185,7 +1193,8 @@ let commands = {
if (reason.length > MAX_REASON_LENGTH) return this.errorReply("The reason is too long. It cannot exceed " + MAX_REASON_LENGTH + " characters.");
}
if (tournament.disqualifyUser(targetUserid, this, reason)) {
this.privateModCommand("(" + (targetUser.name || targetUserid) + " was disqualified from the tournament by " + user.name + (reason ? " (" + reason + ")" : "") + ")");
this.privateModAction("(" + (targetUser.name || targetUserid) + " was disqualified from the tournament by " + user.name + (reason ? " (" + reason + ")" : "") + ")");
this.modlog('TOUR DQ', targetUser, reason, null);
}
},
autostart: 'setautostart',
@@ -1203,7 +1212,8 @@ let commands = {
if (tournament.autostartcap) return this.errorReply("The tournament is already set to autostart when the player cap is reached.");
tournament.autostartcap = true;
this.room.add("The tournament will start once " + tournament.playerCap + " players have joined.");
this.privateModCommand("(The tournament was set to autostart when the player cap is reached by " + user.name + ")");
this.privateModAction("(The tournament was set to autostart when the player cap is reached by " + user.name + ")");
this.modlog('TOUR AUTOSTART', null, 'when playercap is reached');
}
} else {
if (option === '0' || option === 'infinity' || this.meansNo(option) || option === 'stop' || option === 'remove') {
@@ -1213,7 +1223,8 @@ let commands = {
}
let timeout = params[0].toLowerCase() === 'off' ? Infinity : params[0];
if (tournament.setAutoStartTimeout(timeout * 60 * 1000, this)) {
this.privateModCommand("(The tournament auto start timer was set to " + params[0] + " by " + user.name + ")");
this.privateModAction("(The tournament auto start timer was set to " + params[0] + " by " + user.name + ")");
this.modlog('TOUR AUTOSTART', null, timeout === Infinity ? 'off' : params[0]);
}
}
},
@@ -1230,7 +1241,8 @@ let commands = {
let timeout = params[0].toLowerCase() === 'off' ? Infinity : params[0] * 60 * 1000;
if (timeout === tournament.autoDisqualifyTimeout) return this.errorReply("The automatic tournament disqualify timer is already set to " + params[0] + " minute(s).");
if (tournament.setAutoDisqualifyTimeout(timeout, this)) {
this.privateModCommand("(The tournament auto disqualify timer was set to " + params[0] + " by " + user.name + ")");
this.privateModAction("(The tournament auto disqualify timer was set to " + params[0] + " by " + user.name + ")");
this.modlog('TOUR AUTODQ', null, timeout === Infinity ? 'off' : params[0]);
}
},
runautodq: function (tournament, user) {
@@ -1256,13 +1268,15 @@ let commands = {
tournament.scouting = true;
tournament.modjoin = false;
this.room.add('|tournament|scouting|allow');
this.privateModCommand("(The tournament was set to allow scouting by " + user.name + ")");
this.privateModAction("(The tournament was set to allow scouting by " + user.name + ")");
this.modlog('TOUR SCOUT', null, 'allow');
} else if (this.meansNo(option) || option === 'disallow' || option === 'disallowed') {
if (!tournament.scouting) return this.errorReply("Scouting for this tournament is already disabled.");
tournament.scouting = false;
tournament.modjoin = true;
this.room.add('|tournament|scouting|disallow');
this.privateModCommand("(The tournament was set to disallow scouting by " + user.name + ")");
this.privateModAction("(The tournament was set to disallow scouting by " + user.name + ")");
this.modlog('TOUR SCOUT', null, 'disallow');
} else {
return this.sendReply("Usage: " + cmd + " <allow|disallow>");
}
@@ -1282,12 +1296,14 @@ let commands = {
if (tournament.modjoin) return this.errorReply("Modjoining is already allowed for this tournament.");
tournament.modjoin = true;
this.room.add('Modjoining is now allowed (Players can modjoin their tournament battles).');
this.privateModCommand("(The tournament was set to allow modjoin by " + user.name + ")");
this.privateModAction("(The tournament was set to allow modjoin by " + user.name + ")");
this.modlog('TOUR MODJOIN', null, option);
} else if (this.meansNo(option) || option === 'disallow' || option === 'disallowed') {
if (!tournament.modjoin) return this.errorReply("Modjoining is already not allowed for this tournament.");
tournament.modjoin = false;
this.room.add('Modjoining is now banned (Players cannot modjoin their tournament battles).');
this.privateModCommand("(The tournament was set to disallow modjoin by " + user.name + ")");
this.privateModAction("(The tournament was set to disallow modjoin by " + user.name + ")");
this.modlog('TOUR MODJOIN', null, option);
} else {
return this.sendReply("Usage: " + cmd + " <allow|disallow>");
}
@@ -1297,11 +1313,13 @@ let commands = {
if (this.meansYes(option)) {
tournament.forceTimer = true;
this.room.add('Forcetimer is now on for the tournament.');
this.privateModCommand("(The timer was turned on for the tournament by " + user.name + ")");
this.privateModAction("(The timer was turned on for the tournament by " + user.name + ")");
this.modlog('TOUR FORCETIMER', null, 'ON');
} else if (this.meansNo(option) || option === 'stop') {
tournament.forceTimer = false;
this.room.add('Forcetimer is now off for the tournament.');
this.privateModCommand("(The timer was turned off for the tournament by " + user.name + ")");
this.privateModAction("(The timer was turned off for the tournament by " + user.name + ")");
this.modlog('TOUR FORCETIMER', null, 'ON');
} else {
return this.sendReply("Usage: " + cmd + " <on|off>");
}
@@ -1329,8 +1347,9 @@ let commands = {
Punishments.roomPunishName(this.room, targetUser, punishment);
}
tournament.removeBannedUser(targetUser);
this.modlog('TOUR BAN', targetUser, reason);
if (reason) reason = ` (${reason})`;
this.privateModCommand(`${targetUser.name || targetUserid} was banned from joining tournaments by ${user.name}.${reason}`);
this.privateModAction(`${targetUser.name || targetUserid} was banned from joining tournaments by ${user.name}.${reason}`);
},
unbanuser: function (tournament, user, params, cmd) {
if (params.length < 1) {
@@ -1343,7 +1362,8 @@ let commands = {
Punishments.roomUnpunish(this.room, targetUser, 'TOURBAN');
tournament.removeBannedUser(targetUser);
this.privateModCommand(`${targetUser.name || targetUserid} was unbanned from joining tournaments by ${user.name}.`);
this.privateModAction(`${targetUser.name || targetUserid} was unbanned from joining tournaments by ${user.name}.`, `TOURUNBAN: [${targetUser ? targetUser.getLastId() : targetUserid}] by ${user.userid}`);
this.modlog('TOUR UNBAN', targetUser, null, {noip: 1, noalts: 1});
},
},
};
@@ -1419,11 +1439,13 @@ Chat.commands.tournament = function (paramString, room, user, connection) {
if (this.meansYes(option)) {
if (room.tourAnnouncements) return this.errorReply("Tournament announcements are already enabled.");
room.tourAnnouncements = true;
this.privateModCommand("(Tournament announcements were enabled by " + user.name + ")");
this.privateModAction("(Tournament announcements were enabled by " + user.name + ")");
this.modlog('TOUR ANNOUNCEMENTS', null, 'ON');
} else if (this.meansNo(option)) {
if (!room.tourAnnouncements) return this.errorReply("Tournament announcements are already disabled.");
room.tourAnnouncements = false;
this.privateModCommand("(Tournament announcements were disabled by " + user.name + ")");
this.privateModAction("(Tournament announcements were disabled by " + user.name + ")");
this.modlog('TOUR ANNOUNCEMENTS', null, 'OFF');
} else {
return this.sendReply("Usage: " + cmd + " <on|off>");
}
@@ -1448,7 +1470,8 @@ Chat.commands.tournament = function (paramString, room, user, connection) {
let tour = createTournament(room, params.shift(), params.shift(), params.shift(), Config.ratedtours, params, this);
if (tour) {
this.privateModCommand("(" + user.name + " created a tournament in " + tour.format + " format.)");
this.privateModAction("(" + user.name + " created a tournament in " + tour.format + " format.)");
this.modlog('TOUR CREATE', null, tour.format);
if (room.tourAnnouncements) {
let tourRoom = Rooms.search(Config.tourroom || 'tournaments');
if (tourRoom && tourRoom !== room) tourRoom.addRaw('<div class="infobox"><a href="/' + room.id + '" class="ilink"><strong>' + Chat.escapeHTML(Dex.getFormat(tour.format).name) + '</strong> tournament created in <strong>' + Chat.escapeHTML(room.title) + '</strong>.</a></div>').update();