{ "version": 3, "sources": ["../../../../server/chat-commands/admin.ts"], "sourcesContent": ["/**\n * Administration commands\n * Pokemon Showdown - http://pokemonshowdown.com/\n *\n * These are administration commands, generally only useful for\n * programmers for managing the server.\n *\n * For the API, see chat-plugins/COMMANDS.md\n *\n * @license MIT\n */\n\nimport * as path from 'path';\nimport * as child_process from 'child_process';\nimport {FS, Utils, ProcessManager, SQL} from '../../lib';\n\ninterface ProcessData {\n\tcmd: string;\n\tcpu?: string;\n\ttime?: string;\n\tram?: string;\n}\n\nfunction hasDevAuth(user: User) {\n\tconst devRoom = Rooms.get('development');\n\treturn devRoom && Users.Auth.atLeast(devRoom.auth.getDirect(user.id), '%');\n}\n\nfunction bash(command: string, context: Chat.CommandContext, cwd?: string): Promise<[number, string, string]> {\n\tcontext.stafflog(`$ ${command}`);\n\tif (!cwd) cwd = FS.ROOT_PATH;\n\treturn new Promise(resolve => {\n\t\tchild_process.exec(command, {cwd}, (error, stdout, stderr) => {\n\t\t\tlet log = `[o] ${stdout}[e] ${stderr}`;\n\t\t\tif (error) log = `[c] ${error.code}\\n${log}`;\n\t\t\tcontext.stafflog(log);\n\t\t\tresolve([error?.code || 0, stdout, stderr]);\n\t\t});\n\t});\n}\n\nfunction keysIncludingNonEnumerable(obj: object) {\n\tconst methods = new Set();\n\tlet current = obj;\n\tdo {\n\t\tconst curProps = Object.getOwnPropertyNames(current);\n\t\tfor (const prop of curProps) {\n\t\t\tmethods.add(prop);\n\t\t}\n\t} while ((current = Object.getPrototypeOf(current)));\n\treturn [...methods];\n}\n\nfunction keysToCopy(obj: object) {\n\treturn keysIncludingNonEnumerable(obj).filter(\n\t\t// `__` matches sucrase init methods\n\t\t// prop is excluded because it can hit things like hasOwnProperty that are potentially annoying (?) with\n\t\t// the kind of prototype patching we want to do here - same for constructor and valueOf\n\t\tprop => !(prop.includes('__') || prop.toLowerCase().includes('prop') || ['valueOf', 'constructor'].includes(prop))\n\t);\n}\n\n/**\n * @returns {boolean} Whether or not the rebase failed\n */\nasync function updateserver(context: Chat.CommandContext, codePath: string) {\n\tconst exec = (command: string) => bash(command, context, codePath);\n\n\tcontext.sendReply(`Fetching newest version of code in the repository ${codePath}...`);\n\n\tlet [code, stdout, stderr] = await exec(`git fetch`);\n\tif (code) throw new Error(`updateserver: Crash while fetching - make sure this is a Git repository`);\n\tif (!stdout && !stderr) {\n\t\tcontext.sendReply(`There were no updates.`);\n\t\tMonitor.updateServerLock = false;\n\t\treturn true;\n\t}\n\n\t[code, stdout, stderr] = await exec(`git rev-parse HEAD`);\n\tif (code || stderr) throw new Error(`updateserver: Crash while grabbing hash`);\n\tconst oldHash = String(stdout).trim();\n\n\t[code, stdout, stderr] = await exec(`git stash save \"PS /updateserver autostash\"`);\n\tlet stashedChanges = true;\n\tif (code) throw new Error(`updateserver: Crash while stashing`);\n\tif ((stdout + stderr).includes(\"No local changes\")) {\n\t\tstashedChanges = false;\n\t} else if (stderr) {\n\t\tthrow new Error(`updateserver: Crash while stashing`);\n\t} else {\n\t\tcontext.sendReply(`Saving changes...`);\n\t}\n\n\t// errors can occur while rebasing or popping the stash; make sure to recover\n\ttry {\n\t\tcontext.sendReply(`Rebasing...`);\n\t\t[code] = await exec(`git rebase --no-autostash FETCH_HEAD`);\n\t\tif (code) {\n\t\t\t// conflict while rebasing\n\t\t\tawait exec(`git rebase --abort`);\n\t\t\tthrow new Error(`restore`);\n\t\t}\n\n\t\tif (stashedChanges) {\n\t\t\tcontext.sendReply(`Restoring saved changes...`);\n\t\t\t[code] = await exec(`git stash pop`);\n\t\t\tif (code) {\n\t\t\t\t// conflict while popping stash\n\t\t\t\tawait exec(`git reset HEAD .`);\n\t\t\t\tawait exec(`git checkout .`);\n\t\t\t\tthrow new Error(`restore`);\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t} catch {\n\t\t// failed while rebasing or popping the stash\n\t\tawait exec(`git reset --hard ${oldHash}`);\n\t\tif (stashedChanges) await exec(`git stash pop`);\n\t\treturn false;\n\t}\n}\n\nexport const commands: Chat.ChatCommands = {\n\tpotd(target, room, user) {\n\t\tthis.canUseConsole();\n\t\tconst species = Dex.species.get(target);\n\t\tif (species.id === Config.potd) {\n\t\t\treturn this.errorReply(`The PotD is already set to ${species.name}`);\n\t\t}\n\t\tif (!species.exists) return this.errorReply(`Pokemon \"${target}\" not found.`);\n\t\tif (!Dex.species.getFullLearnset(species.id).length) {\n\t\t\treturn this.errorReply(`That Pokemon has no learnset and cannot be used as the PotD.`);\n\t\t}\n\t\tConfig.potd = species.id;\n\t\tfor (const process of Rooms.PM.processes) {\n\t\t\tprocess.getProcess().send(`EVAL\\n\\nConfig.potd = '${species.id}'`);\n\t\t}\n\t\tthis.addGlobalModAction(`${user.name} set the PotD to ${species.name}.`);\n\t\tthis.globalModlog(`POTD`, null, species.name);\n\t},\n\tpotdhelp: [\n\t\t`/potd [pokemon] - Set the Pokemon of the Day to the given [pokemon]. Requires: &`,\n\t],\n\n\t/*********************************************************\n\t * Bot commands (chat-log manipulation)\n\t *********************************************************/\n\n\thtmlbox(target, room, user) {\n\t\tif (!target) return this.parse('/help htmlbox');\n\t\troom = this.requireRoom();\n\t\tthis.checkHTML(target);\n\t\ttarget = Chat.collapseLineBreaksHTML(target);\n\t\tthis.checkBroadcast(true, '!htmlbox');\n\t\tif (this.broadcastMessage) this.checkCan('declare', null, room);\n\n\t\tif (!this.runBroadcast(true, '!htmlbox')) return;\n\n\t\tif (this.broadcasting) {\n\t\t\treturn `/raw
${target}
`;\n\t\t} else {\n\t\t\tthis.sendReplyBox(target);\n\t\t}\n\t},\n\thtmlboxhelp: [\n\t\t`/htmlbox [message] - Displays a message, parsing HTML code contained.`,\n\t\t`!htmlbox [message] - Shows everyone a message, parsing HTML code contained. Requires: * # &`,\n\t],\n\taddhtmlbox(target, room, user, connection, cmd) {\n\t\tif (!target) return this.parse('/help ' + cmd);\n\t\troom = this.requireRoom();\n\t\tthis.checkChat();\n\t\tthis.checkHTML(target);\n\t\tthis.checkCan('addhtml', null, room);\n\t\ttarget = Chat.collapseLineBreaksHTML(target);\n\t\tif (user.tempGroup !== '*') {\n\t\t\ttarget += Utils.html`
[${user.name}]
`;\n\t\t}\n\n\t\treturn `/raw
${target}
`;\n\t},\n\taddhtmlboxhelp: [\n\t\t`/addhtmlbox [message] - Shows everyone a message, parsing HTML code contained. Requires: * # &`,\n\t],\n\taddrankhtmlbox(target, room, user, connection, cmd) {\n\t\troom = this.requireRoom();\n\t\tif (!target) return this.parse('/help ' + cmd);\n\t\tthis.checkChat();\n\t\tlet [rank, html] = this.splitOne(target);\n\t\tif (!(rank in Config.groups)) return this.errorReply(`Group '${rank}' does not exist.`);\n\t\thtml = this.checkHTML(html);\n\t\tthis.checkCan('addhtml', null, room);\n\t\thtml = Chat.collapseLineBreaksHTML(html);\n\t\tif (user.tempGroup !== '*') {\n\t\t\thtml += Utils.html`
[${user.name}]
`;\n\t\t}\n\n\t\troom.sendRankedUsers(`|html|
${html}
`, rank as GroupSymbol);\n\t},\n\taddrankhtmlboxhelp: [\n\t\t`/addrankhtmlbox [rank], [message] - Shows everyone with the specified rank or higher a message, parsing HTML code contained. Requires: * # &`,\n\t],\n\tchangeuhtml: 'adduhtml',\n\tadduhtml(target, room, user, connection, cmd) {\n\t\troom = this.requireRoom();\n\t\tif (!target) return this.parse('/help ' + cmd);\n\t\tthis.checkChat();\n\n\t\tlet [name, html] = this.splitOne(target);\n\t\tname = toID(name);\n\t\thtml = this.checkHTML(html);\n\t\tthis.checkCan('addhtml', null, room);\n\t\thtml = Chat.collapseLineBreaksHTML(html);\n\t\tif (user.tempGroup !== '*') {\n\t\t\thtml += Utils.html`
[${user.name}]
`;\n\t\t}\n\n\t\tif (cmd === 'changeuhtml') {\n\t\t\troom.attributedUhtmlchange(user, name, html);\n\t\t} else {\n\t\t\treturn `/uhtml ${name},${html}`;\n\t\t}\n\t},\n\tadduhtmlhelp: [\n\t\t`/adduhtml [name], [message] - Shows everyone a message that can change, parsing HTML code contained. Requires: * # &`,\n\t],\n\tchangeuhtmlhelp: [\n\t\t`/changeuhtml [name], [message] - Changes the message previously shown with /adduhtml [name]. Requires: * # &`,\n\t],\n\tchangerankuhtml: 'addrankuhtml',\n\taddrankuhtml(target, room, user, connection, cmd) {\n\t\troom = this.requireRoom();\n\t\tif (!target) return this.parse('/help ' + cmd);\n\t\tthis.checkChat();\n\n\t\tconst [rank, uhtml] = this.splitOne(target);\n\t\tif (!(rank in Config.groups)) return this.errorReply(`Group '${rank}' does not exist.`);\n\t\tlet [name, html] = this.splitOne(uhtml);\n\t\tname = toID(name);\n\t\thtml = this.checkHTML(html);\n\t\tthis.checkCan('addhtml', null, room);\n\t\thtml = Chat.collapseLineBreaksHTML(html);\n\t\tif (user.tempGroup !== '*') {\n\t\t\thtml += Utils.html`
[${user.name}]
`;\n\t\t}\n\n\t\thtml = `|uhtml${(cmd === 'changerankuhtml' ? 'change' : '')}|${name}|${html}`;\n\t\troom.sendRankedUsers(html, rank as GroupSymbol);\n\t},\n\taddrankuhtmlhelp: [\n\t\t`/addrankuhtml [rank], [name], [message] - Shows everyone with the specified rank or higher a message that can change, parsing HTML code contained. Requires: * # &`,\n\t],\n\tchangerankuhtmlhelp: [\n\t\t`/changerankuhtml [rank], [name], [message] - Changes the message previously shown with /addrankuhtml [rank], [name]. Requires: * # &`,\n\t],\n\n\tdeletenamecolor: 'setnamecolor',\n\tsnc: 'setnamecolor',\n\tdnc: 'setnamecolor',\n\tasync setnamecolor(target, room, user, connection, cmd) {\n\t\tthis.checkCan('rangeban');\n\t\tif (!toID(target)) {\n\t\t\treturn this.parse(`/help ${cmd}`);\n\t\t}\n\t\tlet [userid, source] = this.splitOne(target).map(toID);\n\t\tif (cmd.startsWith('d')) {\n\t\t\tsource = '';\n\t\t} else if (!source || source.length > 18) {\n\t\t\treturn this.errorReply(\n\t\t\t\t`Specify a source username to take the color from. Name must be <19 characters.`\n\t\t\t);\n\t\t}\n\t\tif (!userid || userid.length > 18) {\n\t\t\treturn this.errorReply(`Specify a valid name to set a new color for. Names must be <19 characters.`);\n\t\t}\n\t\tconst [res, error] = await LoginServer.request('updatenamecolor', {\n\t\t\tuserid,\n\t\t\tsource,\n\t\t\tby: user.id,\n\t\t});\n\t\tif (error) {\n\t\t\treturn this.errorReply(error.message);\n\t\t}\n\t\tif (!res || res.actionerror) {\n\t\t\treturn this.errorReply(res?.actionerror || \"The loginserver is currently disabled.\");\n\t\t}\n\t\tif (source) {\n\t\t\treturn this.sendReply(\n\t\t\t\t`|html|${userid}'s namecolor was ` +\n\t\t\t\t`successfully updated to match '${source}'. ` +\n\t\t\t\t`Refresh your browser for it to take effect.`\n\t\t\t);\n\t\t} else {\n\t\t\treturn this.sendReply(`${userid}'s namecolor was removed.`);\n\t\t}\n\t},\n\tsetnamecolorhelp: [\n\t\t`/setnamecolor OR /snc [username], [source name] - Set [username]'s name color to match the [source name]'s color.`,\n\t\t`Requires: &`,\n\t],\n\tdeletenamecolorhelp: [\n\t\t`/deletenamecolor OR /dnc [username] - Remove [username]'s namecolor.`,\n\t\t`Requires: &`,\n\t],\n\n\tpline(target, room, user) {\n\t\t// Secret console admin command\n\t\tthis.canUseConsole();\n\t\tconst message = target.length > 30 ? target.slice(0, 30) + '...' : target;\n\t\tthis.checkBroadcast(true, `!pline ${message}`);\n\t\tthis.runBroadcast(true);\n\t\tthis.sendReply(target);\n\t},\n\tplinehelp: [\n\t\t`/pline [protocol lines] - Adds the given [protocol lines] to the current room. Requires: & console access`,\n\t],\n\n\tpminfobox(target, room, user, connection) {\n\t\tthis.checkChat();\n\t\troom = this.requireRoom();\n\t\tthis.checkCan('addhtml', null, room);\n\t\tif (!target) return this.parse(\"/help pminfobox\");\n\n\t\tconst {targetUser, rest: html} = this.requireUser(target);\n\t\tthis.checkHTML(html);\n\t\tthis.checkPMHTML(targetUser);\n\n\t\tconst message = `|pm|${user.getIdentity()}|${targetUser.getIdentity()}|` +\n\t\t\t`/raw
${html}
`;\n\n\t\tuser.send(message);\n\t\tif (targetUser !== user) targetUser.send(message);\n\t\ttargetUser.lastPM = user.id;\n\t\tuser.lastPM = targetUser.id;\n\t},\n\tpminfoboxhelp: [`/pminfobox [user], [html]- PMs an [html] infobox to [user]. Requires * # &`],\n\n\tpmuhtmlchange: 'pmuhtml',\n\tpmuhtml(target, room, user, connection, cmd) {\n\t\tthis.checkChat();\n\t\troom = this.requireRoom();\n\t\tthis.checkCan('addhtml', null, room);\n\t\tif (!target) return this.parse(\"/help \" + cmd);\n\n\t\tconst {targetUser, rest: html} = this.requireUser(target);\n\t\tthis.checkHTML(html);\n\t\tthis.checkPMHTML(targetUser);\n\n\t\tconst message = `|pm|${user.getIdentity()}|${targetUser.getIdentity()}|` +\n\t\t\t`/uhtml${(cmd === 'pmuhtmlchange' ? 'change' : '')} ${html}`;\n\n\t\tuser.send(message);\n\t\tif (targetUser !== user) targetUser.send(message);\n\t\ttargetUser.lastPM = user.id;\n\t\tuser.lastPM = targetUser.id;\n\t},\n\tpmuhtmlhelp: [`/pmuhtml [user], [name], [html] - PMs [html] that can change to [user]. Requires * # &`],\n\tpmuhtmlchangehelp: [\n\t\t`/pmuhtmlchange [user], [name], [html] - Changes html that was previously PMed to [user] to [html]. Requires * # &`,\n\t],\n\n\tclosehtmlpage: 'sendhtmlpage',\n\tchangehtmlpageselector: 'sendhtmlpage',\n\tsendhtmlpage(target, room, user, connection, cmd) {\n\t\troom = this.requireRoom();\n\t\tthis.checkCan('addhtml', null, room);\n\n\t\tconst closeHtmlPage = cmd === 'closehtmlpage';\n\n\t\tconst {targetUser, rest} = this.requireUser(target);\n\t\tlet [pageid, content] = this.splitOne(rest);\n\t\tlet selector: string | undefined;\n\t\tif (cmd === 'changehtmlpageselector') {\n\t\t\t[selector, content] = this.splitOne(content);\n\t\t\tif (!selector) return this.parse(`/help ${cmd}`);\n\t\t}\n\t\tif (!pageid || (closeHtmlPage ? content : !content)) {\n\t\t\treturn this.parse(`/help ${cmd}`);\n\t\t}\n\n\t\tpageid = `${user.id}-${toID(pageid)}`;\n\n\t\tif (targetUser.locked && !this.user.can('lock')) {\n\t\t\tthis.errorReply(\"This user is currently locked, so you cannot send them HTML.\");\n\t\t\treturn false;\n\t\t}\n\n\t\tlet targetConnections = [];\n\t\t// find if a connection has specifically requested this page\n\t\tfor (const c of targetUser.connections) {\n\t\t\tif (c.lastRequestedPage === pageid) {\n\t\t\t\ttargetConnections.push(c);\n\t\t\t}\n\t\t}\n\t\tif (!targetConnections.length) {\n\t\t\t// no connection has requested it - verify that we share a room\n\t\t\tthis.checkPMHTML(targetUser);\n\t\t\ttargetConnections = targetUser.connections;\n\t\t}\n\n\t\tcontent = this.checkHTML(content);\n\n\t\tfor (const targetConnection of targetConnections) {\n\t\t\tconst context = new Chat.PageContext({\n\t\t\t\tuser: targetUser,\n\t\t\t\tconnection: targetConnection,\n\t\t\t\tpageid: `view-bot-${pageid}`,\n\t\t\t});\n\t\t\tif (closeHtmlPage) {\n\t\t\t\tcontext.send(`|deinit|`);\n\t\t\t} else if (selector) {\n\t\t\t\tcontext.send(`|selectorhtml|${selector}|${content}`);\n\t\t\t} else {\n\t\t\t\tcontext.title = `[${user.name}] ${pageid}`;\n\t\t\t\tcontext.setHTML(content);\n\t\t\t}\n\t\t}\n\n\t\tif (closeHtmlPage) {\n\t\t\tthis.sendReply(`Closed the bot page ${pageid} for ${targetUser.name}.`);\n\t\t} else {\n\t\t\tthis.sendReply(`Sent ${targetUser.name}${selector ? ` the selector ${selector} on` : ''} the bot page ${pageid}.`);\n\t\t}\n\t},\n\tsendhtmlpagehelp: [\n\t\t`/sendhtmlpage [userid], [pageid], [html] - Sends [userid] the bot page [pageid] with the content [html]. Requires: * # &`,\n\t],\n\tchangehtmlpageselectorhelp: [\n\t\t`/changehtmlpageselector [userid], [pageid], [selector], [html] - Sends [userid] the content [html] for the selector [selector] on the bot page [pageid]. Requires: * # &`,\n\t],\n\tclosehtmlpagehelp: [\n\t\t`/closehtmlpage [userid], [pageid], - Closes the bot page [pageid] for [userid]. Requires: * # &`,\n\t],\n\n\thighlighthtmlpage(target, room, user) {\n\t\tconst {targetUser, rest} = this.requireUser(target);\n\t\tlet [pageid, title, highlight] = Utils.splitFirst(rest, ',', 2);\n\n\t\tpageid = `${user.id}-${toID(pageid)}`;\n\t\tif (!pageid || !target) return this.parse(`/help highlighthtmlpage`);\n\t\tif (targetUser.locked && !this.user.can('lock')) {\n\t\t\tthrow new Chat.ErrorMessage(\"This user is currently locked, so you cannot send them highlights.\");\n\t\t}\n\n\t\tconst buf = `|tempnotify|bot-${pageid}|${title} [from ${user.name}]|${highlight ? highlight : ''}`;\n\t\tlet targetConnections = [];\n\t\tthis.checkPMHTML(targetUser);\n\t\t// try to locate connections that have requested the page recently\n\t\tfor (const c of targetUser.connections) {\n\t\t\tif (c.lastRequestedPage === pageid) {\n\t\t\t\ttargetConnections.push(c);\n\t\t\t}\n\t\t}\n\t\t// there are none, default to the first connection\n\t\tif (!targetConnections.length) {\n\t\t\ttargetConnections = [targetUser.connections[0]];\n\t\t}\n\t\tfor (const conn of targetConnections) {\n\t\t\tconn.send(`>view-bot-${pageid}\\n${buf}`);\n\t\t}\n\n\t\tthis.sendReply(`Sent a highlight to ${targetUser.name} on the bot page ${pageid}.`);\n\t},\n\thighlighthtmlpagehelp: [\n\t\t`/highlighthtmlpage [userid], [pageid], [title], [optional highlight] - Sends a highlight to [userid] if they're viewing the bot page [pageid].`,\n\t\t`If a [highlight] is specified, only highlights them if they have that term on their highlight list.`,\n\t],\n\n\tchangeprivateuhtml: 'sendprivatehtmlbox',\n\tsendprivateuhtml: 'sendprivatehtmlbox',\n\tsendprivatehtmlbox(target, room, user, connection, cmd) {\n\t\troom = this.requireRoom();\n\t\tthis.checkCan('addhtml', null, room);\n\n\t\tconst {targetUser, rest} = this.requireUser(target);\n\n\t\tif (targetUser.locked && !this.user.can('lock')) {\n\t\t\tthrow new Chat.ErrorMessage(\"This user is currently locked, so you cannot send them private HTML.\");\n\t\t}\n\n\t\tif (!(targetUser.id in room.users)) {\n\t\t\tthrow new Chat.ErrorMessage(\"You cannot send private HTML to users who are not in this room.\");\n\t\t}\n\n\t\tlet html: string;\n\t\tlet messageType: string;\n\t\tlet name: string | undefined;\n\t\tconst plainHtml = cmd === 'sendprivatehtmlbox';\n\t\tif (plainHtml) {\n\t\t\thtml = rest;\n\t\t\tmessageType = 'html';\n\t\t} else {\n\t\t\t[name, html] = this.splitOne(rest);\n\t\t\tif (!name) return this.parse('/help sendprivatehtmlbox');\n\n\t\t\tmessageType = `uhtml${(cmd === 'changeprivateuhtml' ? 'change' : '')}|${name}`;\n\t\t}\n\n\t\thtml = this.checkHTML(html);\n\t\tif (!html) return this.parse('/help sendprivatehtmlbox');\n\n\t\thtml = `${Utils.html`
[Private from ${user.name}]
`}${Chat.collapseLineBreaksHTML(html)}`;\n\t\tif (plainHtml) html = `
${html}
`;\n\n\t\ttargetUser.sendTo(room, `|${messageType}|${html}`);\n\n\t\tthis.sendReply(`Sent private HTML to ${targetUser.name}.`);\n\t},\n\tsendprivatehtmlboxhelp: [\n\t\t`/sendprivatehtmlbox [userid], [html] - Sends [userid] the private [html]. Requires: * # &`,\n\t\t`/sendprivateuhtml [userid], [name], [html] - Sends [userid] the private [html] that can change. Requires: * # &`,\n\t\t`/changeprivateuhtml [userid], [name], [html] - Changes the message previously sent with /sendprivateuhtml [userid], [name], [html]. Requires: * # &`,\n\t],\n\n\tbotmsg(target, room, user, connection) {\n\t\tif (!target || !target.includes(',')) {\n\t\t\treturn this.parse('/help botmsg');\n\t\t}\n\t\tthis.checkRecursion();\n\n\t\tlet {targetUser, rest: message} = this.requireUser(target);\n\n\t\tconst auth = this.room ? this.room.auth : Users.globalAuth;\n\t\tif (!['*', '#'].includes(auth.get(targetUser))) {\n\t\t\treturn this.popupReply(`The user \"${targetUser.name}\" is not a bot in this room.`);\n\t\t}\n\t\tthis.room = null; // shouldn't be in a room\n\t\tthis.pmTarget = targetUser;\n\n\t\tmessage = this.checkChat(message);\n\t\tif (!message) return;\n\t\tChat.PrivateMessages.send(`/botmsg ${message}`, user, targetUser, targetUser);\n\t},\n\tbotmsghelp: [`/botmsg [username], [message] - Send a private message to a bot without feedback. For room bots, must use in the room the bot is auth in.`],\n\n\tnick() {\n\t\tthis.sendReply(`||New to the Pok\u00E9mon Showdown protocol? Your client needs to get a signed assertion from the login server and send /trn`);\n\t\tthis.sendReply(`||https://github.com/smogon/pokemon-showdown/blob/master/PROTOCOL.md#global-messages`);\n\t\tthis.sendReply(`||Follow the instructions for handling |challstr| in this documentation`);\n\t},\n\n\t/*********************************************************\n\t * Server management commands\n\t *********************************************************/\n\n\tmemusage: 'memoryusage',\n\tmemoryusage(target, room, user) {\n\t\tif (!hasDevAuth(user)) this.checkCan('lockdown');\n\t\tconst memUsage = process.memoryUsage();\n\t\tconst resultNums = [memUsage.rss, memUsage.heapUsed, memUsage.heapTotal];\n\t\tconst units = [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\"];\n\t\tconst results = resultNums.map(num => {\n\t\t\tconst unitIndex = Math.floor(Math.log2(num) / 10); // 2^10 base log\n\t\t\treturn `${(num / Math.pow(2, 10 * unitIndex)).toFixed(2)} ${units[unitIndex]}`;\n\t\t});\n\t\tthis.sendReply(`||[Main process] RSS: ${results[0]}, Heap: ${results[1]} / ${results[2]}`);\n\t},\n\tmemoryusagehelp: [\n\t\t`/memoryusage OR /memusage - Get the current memory usage of the server. Requires: &`,\n\t],\n\n\tforcehotpatch: 'hotpatch',\n\tasync hotpatch(target, room, user, connection, cmd) {\n\t\tif (!target) return this.parse('/help hotpatch');\n\t\tthis.canUseConsole();\n\n\t\tif (Monitor.updateServerLock) {\n\t\t\treturn this.errorReply(\"Wait for /updateserver to finish before hotpatching.\");\n\t\t}\n\n\t\tawait this.parse(`/rebuild`);\n\t\tconst lock = Monitor.hotpatchLock;\n\t\tconst hotpatches = [\n\t\t\t'chat', 'formats', 'loginserver', 'punishments', 'dnsbl', 'modlog',\n\t\t\t'processmanager', 'roomsp', 'usersp',\n\t\t];\n\n\t\ttarget = toID(target);\n\t\ttry {\n\t\t\tUtils.clearRequireCache({exclude: ['/lib/process-manager']});\n\t\t\tif (target === 'all') {\n\t\t\t\tif (lock['all']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching all has been disabled by ${lock['all'].by} (${lock['all'].reason})`);\n\t\t\t\t}\n\t\t\t\tif (Config.disablehotpatchall) {\n\t\t\t\t\treturn this.errorReply(\"This server does not allow for the use of /hotpatch all\");\n\t\t\t\t}\n\n\t\t\t\tfor (const hotpatch of hotpatches) {\n\t\t\t\t\tawait this.parse(`/hotpatch ${hotpatch}`);\n\t\t\t\t}\n\t\t\t} else if (target === 'chat' || target === 'commands') {\n\t\t\t\tif (lock['tournaments']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching tournaments has been disabled by ${lock['tournaments'].by} (${lock['tournaments'].reason})`);\n\t\t\t\t}\n\t\t\t\tif (lock['chat']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching chat has been disabled by ${lock['chat'].by} (${lock['chat'].reason})`);\n\t\t\t\t}\n\n\t\t\t\tthis.sendReply(\"Hotpatching chat commands...\");\n\n\t\t\t\tconst disabledCommands = Chat.allCommands().filter(c => c.disabled).map(c => `/${c.fullCmd}`);\n\t\t\t\tif (cmd !== 'forcehotpatch' && disabledCommands.length) {\n\t\t\t\t\tthis.errorReply(`${Chat.count(disabledCommands.length, \"commands\")} are disabled right now.`);\n\t\t\t\t\tthis.errorReply(`Hotpatching will enable them. Use /forcehotpatch chat if you're sure.`);\n\t\t\t\t\treturn this.errorReply(`Currently disabled: ${disabledCommands.join(', ')}`);\n\t\t\t\t}\n\n\t\t\t\tconst oldPlugins = Chat.plugins;\n\t\t\t\tChat.destroy();\n\n\t\t\t\tconst processManagers = ProcessManager.processManagers;\n\t\t\t\tfor (const manager of processManagers.slice()) {\n\t\t\t\t\tif (manager.filename.startsWith(FS(__dirname + '/../chat-plugins/').path)) {\n\t\t\t\t\t\tvoid manager.destroy();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvoid Chat.PM.destroy();\n\n\t\t\t\tglobal.Chat = require('../chat').Chat;\n\t\t\t\tglobal.Tournaments = require('../tournaments').Tournaments;\n\n\t\t\t\tthis.sendReply(\"Reloading chat plugins...\");\n\t\t\t\tChat.loadPlugins(oldPlugins);\n\t\t\t\tthis.sendReply(\"DONE\");\n\t\t\t} else if (target === 'processmanager') {\n\t\t\t\tif (lock['processmanager']) {\n\t\t\t\t\treturn this.errorReply(\n\t\t\t\t\t\t`Hot-patching formats has been disabled by ${lock['processmanager'].by} ` +\n\t\t\t\t\t\t`(${lock['processmanager'].reason})`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.sendReply('Hotpatching processmanager prototypes...');\n\n\t\t\t\t// keep references\n\t\t\t\tconst cache = {...require.cache};\n\t\t\t\tUtils.clearRequireCache();\n\t\t\t\tconst newPM = require('../../lib/process-manager');\n\t\t\t\trequire.cache = cache;\n\n\t\t\t\tconst protos = [\n\t\t\t\t\t[ProcessManager.QueryProcessManager, newPM.QueryProcessManager],\n\t\t\t\t\t[ProcessManager.StreamProcessManager, newPM.StreamProcessManager],\n\t\t\t\t\t[ProcessManager.ProcessManager, newPM.ProcessManager],\n\t\t\t\t\t[ProcessManager.RawProcessManager, newPM.RawProcessManager],\n\t\t\t\t\t[ProcessManager.QueryProcessWrapper, newPM.QueryProcessWrapper],\n\t\t\t\t\t[ProcessManager.StreamProcessWrapper, newPM.StreamProcessWrapper],\n\t\t\t\t\t[ProcessManager.RawProcessManager, newPM.RawProcessWrapper],\n\t\t\t\t].map(part => part.map(constructor => constructor.prototype));\n\n\t\t\t\tfor (const [oldProto, newProto] of protos) {\n\t\t\t\t\tconst newKeys = keysToCopy(newProto);\n\t\t\t\t\tconst oldKeys = keysToCopy(oldProto);\n\t\t\t\t\tfor (const key of oldKeys) {\n\t\t\t\t\t\tif (!newProto[key]) {\n\t\t\t\t\t\t\tdelete oldProto[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const key of newKeys) {\n\t\t\t\t\t\toldProto[key] = newProto[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.sendReply('DONE');\n\t\t\t} else if (target === 'usersp' || target === 'roomsp') {\n\t\t\t\tif (lock[target]) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching ${target} has been disabled by ${lock[target].by} (${lock[target].reason})`);\n\t\t\t\t}\n\t\t\t\tlet newProto: any, oldProto: any, message: string;\n\t\t\t\tswitch (target) {\n\t\t\t\tcase 'usersp':\n\t\t\t\t\tnewProto = require('../users').User.prototype;\n\t\t\t\t\toldProto = Users.User.prototype;\n\t\t\t\t\tmessage = 'user prototypes';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'roomsp':\n\t\t\t\t\tnewProto = require('../rooms').BasicRoom.prototype;\n\t\t\t\t\toldProto = Rooms.BasicRoom.prototype;\n\t\t\t\t\tmessage = 'rooms prototypes';\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis.sendReply(`Hotpatching ${message}...`);\n\t\t\t\tconst newKeys = keysToCopy(newProto);\n\t\t\t\tconst oldKeys = keysToCopy(oldProto);\n\n\t\t\t\tconst counts = {\n\t\t\t\t\tadded: 0,\n\t\t\t\t\tupdated: 0,\n\t\t\t\t\tdeleted: 0,\n\t\t\t\t};\n\n\t\t\t\tfor (const key of oldKeys) {\n\t\t\t\t\tif (!newProto[key]) {\n\t\t\t\t\t\tcounts.deleted++;\n\t\t\t\t\t\tdelete oldProto[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const key of newKeys) {\n\t\t\t\t\tif (!oldProto[key]) {\n\t\t\t\t\t\tcounts.added++;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// compare source code\n\t\t\t\t\t\ttypeof oldProto[key] !== 'function' || oldProto[key].toString() !== newProto[key].toString()\n\t\t\t\t\t) {\n\t\t\t\t\t\tcounts.updated++;\n\t\t\t\t\t}\n\n\t\t\t\t\toldProto[key] = newProto[key];\n\t\t\t\t}\n\t\t\t\tthis.sendReply(`DONE`);\n\t\t\t\tthis.sendReply(\n\t\t\t\t\t`Updated ${Chat.count(counts.updated, 'methods')}` +\n\t\t\t\t\t(counts.added ? `, added ${Chat.count(counts.added, 'new methods')} to ${message}` : '') +\n\t\t\t\t\t(counts.deleted ? `, and removed ${Chat.count(counts.deleted, 'methods')}.` : '.')\n\t\t\t\t);\n\t\t\t} else if (target === 'tournaments') {\n\t\t\t\tif (lock['tournaments']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching tournaments has been disabled by ${lock['tournaments'].by} (${lock['tournaments'].reason})`);\n\t\t\t\t}\n\t\t\t\tthis.sendReply(\"Hotpatching tournaments...\");\n\n\t\t\t\tglobal.Tournaments = require('../tournaments').Tournaments;\n\t\t\t\tChat.loadPlugin(Tournaments, 'tournaments');\n\t\t\t\tthis.sendReply(\"DONE\");\n\t\t\t} else if (target === 'formats' || target === 'battles') {\n\t\t\t\tif (lock['formats']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching formats has been disabled by ${lock['formats'].by} (${lock['formats'].reason})`);\n\t\t\t\t}\n\t\t\t\tif (lock['battles']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching battles has been disabled by ${lock['battles'].by} (${lock['battles'].reason})`);\n\t\t\t\t}\n\t\t\t\tif (lock['validator']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching the validator has been disabled by ${lock['validator'].by} (${lock['validator'].reason})`);\n\t\t\t\t}\n\t\t\t\tthis.sendReply(\"Hotpatching formats...\");\n\n\t\t\t\t// reload .sim-dist/dex.js\n\t\t\t\tglobal.Dex = require('../../sim/dex').Dex;\n\t\t\t\t// rebuild the formats list\n\t\t\t\tRooms.global.formatList = '';\n\t\t\t\t// respawn validator processes\n\t\t\t\tvoid TeamValidatorAsync.PM.respawn();\n\t\t\t\t// respawn simulator processes\n\t\t\t\tvoid Rooms.PM.respawn();\n\t\t\t\t// respawn datasearch processes (crashes otherwise, since the Dex data in the PM can be out of date)\n\t\t\t\tvoid Chat.plugins.datasearch?.PM?.respawn();\n\t\t\t\t// update teams global\n\t\t\t\tglobal.Teams = require('../../sim/teams').Teams;\n\t\t\t\t// broadcast the new formats list to clients\n\t\t\t\tRooms.global.sendAll(Rooms.global.formatListText);\n\t\t\t\tthis.sendReply(\"DONE\");\n\t\t\t} else if (target === 'loginserver') {\n\t\t\t\tthis.sendReply(\"Hotpatching loginserver...\");\n\t\t\t\tFS('config/custom.css').unwatch();\n\t\t\t\tglobal.LoginServer = require('../loginserver').LoginServer;\n\t\t\t\tthis.sendReply(\"DONE. New login server requests will use the new code.\");\n\t\t\t} else if (target === 'learnsets' || target === 'validator') {\n\t\t\t\tif (lock['validator']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching the validator has been disabled by ${lock['validator'].by} (${lock['validator'].reason})`);\n\t\t\t\t}\n\t\t\t\tif (lock['formats']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching formats has been disabled by ${lock['formats'].by} (${lock['formats'].reason})`);\n\t\t\t\t}\n\n\t\t\t\tthis.sendReply(\"Hotpatching validator...\");\n\t\t\t\tvoid TeamValidatorAsync.PM.respawn();\n\t\t\t\t// update teams global too while we're at it\n\t\t\t\tglobal.Teams = require('../../sim/teams').Teams;\n\t\t\t\tthis.sendReply(\"DONE. Any battles started after now will have teams be validated according to the new code.\");\n\t\t\t} else if (target === 'punishments') {\n\t\t\t\tif (lock['punishments']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching punishments has been disabled by ${lock['punishments'].by} (${lock['punishments'].reason})`);\n\t\t\t\t}\n\n\t\t\t\tthis.sendReply(\"Hotpatching punishments...\");\n\t\t\t\tglobal.Punishments = require('../punishments').Punishments;\n\t\t\t\tthis.sendReply(\"DONE\");\n\t\t\t} else if (target === 'dnsbl' || target === 'datacenters' || target === 'iptools') {\n\t\t\t\tthis.sendReply(\"Hotpatching ip-tools...\");\n\n\t\t\t\tglobal.IPTools = require('../ip-tools').IPTools;\n\t\t\t\tvoid IPTools.loadHostsAndRanges();\n\t\t\t\tthis.sendReply(\"DONE\");\n\t\t\t} else if (target === 'modlog') {\n\t\t\t\tif (lock['modlog']) {\n\t\t\t\t\treturn this.errorReply(`Hot-patching modlogs has been disabled by ${lock['modlog'].by} (${lock['modlog'].reason})`);\n\t\t\t\t}\n\t\t\t\tthis.sendReply(\"Hotpatching modlog...\");\n\n\t\t\t\tvoid Rooms.Modlog.database.destroy();\n\t\t\t\tconst {mainModlog} = require('../modlog');\n\t\t\t\tif (mainModlog.readyPromise) {\n\t\t\t\t\tthis.sendReply(\"Waiting for the new SQLite database to be ready...\");\n\t\t\t\t\tawait mainModlog.readyPromise;\n\t\t\t\t} else {\n\t\t\t\t\tthis.sendReply(\"The new SQLite database is ready!\");\n\t\t\t\t}\n\t\t\t\tRooms.Modlog.destroyAllSQLite();\n\n\t\t\t\tRooms.Modlog = mainModlog;\n\t\t\t\tthis.sendReply(\"DONE\");\n\t\t\t} else if (target.startsWith('disable')) {\n\t\t\t\tthis.sendReply(\"Disabling hot-patch has been moved to its own command:\");\n\t\t\t\treturn this.parse('/help nohotpatch');\n\t\t\t} else {\n\t\t\t\treturn this.errorReply(\"Your hot-patch command was unrecognized.\");\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\tRooms.global.notifyRooms(\n\t\t\t\t['development', 'staff'] as RoomID[],\n\t\t\t\t`|c|${user.getIdentity()}|/log ${user.name} used /hotpatch ${target} - but something failed while trying to hot-patch.`\n\t\t\t);\n\t\t\treturn this.errorReply(`Something failed while trying to hot-patch ${target}: \\n${e.stack}`);\n\t\t}\n\t\tRooms.global.notifyRooms(\n\t\t\t['development', 'staff'] as RoomID[],\n\t\t\t`|c|${user.getIdentity()}|/log ${user.name} used /hotpatch ${target}`\n\t\t);\n\t},\n\thotpatchhelp: [\n\t\t`Hot-patching the game engine allows you to update parts of Showdown without interrupting currently-running battles. Requires: console access`,\n\t\t`Hot-patching has greater memory requirements than restarting`,\n\t\t`You can disable various hot-patches with /nohotpatch. For more information on this, see /help nohotpatch`,\n\t\t`/hotpatch chat - reloads the chat-commands and chat-plugins directories`,\n\t\t`/hotpatch validator - spawn new team validator processes`,\n\t\t`/hotpatch formats - reload the sim/dex.ts tree, reload the formats list, and spawn new simulator and team validator processes`,\n\t\t`/hotpatch dnsbl - reloads IPTools datacenters`,\n\t\t`/hotpatch punishments - reloads new punishments code`,\n\t\t`/hotpatch loginserver - reloads new loginserver code`,\n\t\t`/hotpatch tournaments - reloads new tournaments code`,\n\t\t`/hotpatch modlog - reloads new modlog code`,\n\t\t`/hotpatch all - hot-patches chat, tournaments, formats, login server, punishments, modlog, and dnsbl`,\n\t\t`/forcehotpatch [target] - as above, but performs the update regardless of whether the history has changed in git`,\n\t],\n\n\thotpatchlock: 'nohotpatch',\n\tyeshotpatch: 'nohotpatch',\n\tallowhotpatch: 'nohotpatch',\n\tnohotpatch(target, room, user, connection, cmd) {\n\t\tthis.checkCan('gdeclare');\n\t\tif (!target) return this.parse('/help nohotpatch');\n\n\t\tconst separator = ' ';\n\n\t\tconst hotpatch = toID(target.substr(0, target.indexOf(separator)));\n\t\tconst reason = target.substr(target.indexOf(separator), target.length).trim();\n\t\tif (!reason || !target.includes(separator)) return this.parse('/help nohotpatch');\n\n\t\tconst lock = Monitor.hotpatchLock;\n\t\tconst validDisable = [\n\t\t\t'roomsp', 'usersp', 'chat', 'battles', 'formats', 'validator',\n\t\t\t'tournaments', 'punishments', 'modlog', 'all', 'processmanager',\n\t\t];\n\n\t\tif (!validDisable.includes(hotpatch)) {\n\t\t\treturn this.errorReply(`Disabling hotpatching \"${hotpatch}\" is not supported.`);\n\t\t}\n\t\tconst enable = ['allowhotpatch', 'yeshotpatch'].includes(cmd);\n\n\t\tif (enable) {\n\t\t\tif (!lock[hotpatch]) return this.errorReply(`Hot-patching ${hotpatch} is not disabled.`);\n\n\t\t\tdelete lock[hotpatch];\n\t\t\tthis.sendReply(`You have enabled hot-patching ${hotpatch}.`);\n\t\t} else {\n\t\t\tif (lock[hotpatch]) {\n\t\t\t\treturn this.errorReply(`Hot-patching ${hotpatch} has already been disabled by ${lock[hotpatch].by} (${lock[hotpatch].reason})`);\n\t\t\t}\n\t\t\tlock[hotpatch] = {\n\t\t\t\tby: user.name,\n\t\t\t\treason,\n\t\t\t};\n\t\t\tthis.sendReply(`You have disabled hot-patching ${hotpatch}.`);\n\t\t}\n\t\tRooms.global.notifyRooms(\n\t\t\t['development', 'staff', 'upperstaff'] as RoomID[],\n\t\t\t`|c|${user.getIdentity()}|/log ${user.name} has ${enable ? 'enabled' : 'disabled'} hot-patching ${hotpatch}. Reason: ${reason}`\n\t\t);\n\t},\n\tnohotpatchhelp: [\n\t\t`/nohotpatch [chat|formats|battles|validator|tournaments|punishments|modlog|all] [reason] - Disables hotpatching the specified part of the simulator. Requires: &`,\n\t\t`/allowhotpatch [chat|formats|battles|validator|tournaments|punishments|modlog|all] [reason] - Enables hotpatching the specified part of the simulator. Requires: &`,\n\t],\n\n\tasync processes(target, room, user) {\n\t\tif (!hasDevAuth(user)) this.checkCan('lockdown');\n\n\t\tconst processes = new Map();\n\t\tconst ramUnits = [\"KiB\", \"MiB\", \"GiB\", \"TiB\"];\n\n\t\tconst cwd = FS.ROOT_PATH;\n\t\tawait new Promise(resolve => {\n\t\t\tconst child = child_process.exec('ps -o pid,%cpu,time,rss,command', {cwd}, (err, stdout) => {\n\t\t\t\tif (err) throw err;\n\t\t\t\tconst rows = stdout.split('\\n').slice(1); // first line is the table header\n\t\t\t\tfor (const row of rows) {\n\t\t\t\t\tif (!row.trim()) continue;\n\t\t\t\t\tconst [pid, cpu, time, ram, ...rest] = row.split(' ').filter(Boolean);\n\t\t\t\t\tif (pid === `${child.pid}`) continue; // ignore this process\n\t\t\t\t\tconst entry: ProcessData = {cmd: rest.join(' ')};\n\t\t\t\t\t// at the point of 0:00.[num], it's in so few seconds we don't care, so\n\t\t\t\t\t// we don't need to clutter the display\n\t\t\t\t\tif (time && !time.startsWith('0:00')) {\n\t\t\t\t\t\tentry.time = time;\n\t\t\t\t\t}\n\t\t\t\t\tif (cpu && cpu !== '0.0') entry.cpu = `${cpu}%`;\n\t\t\t\t\tconst ramNum = parseInt(ram);\n\t\t\t\t\tif (!isNaN(ramNum)) {\n\t\t\t\t\t\tconst unitIndex = Math.floor(Math.log2(ramNum) / 10); // 2^10 base log\n\t\t\t\t\t\tentry.ram = `${(ramNum / Math.pow(2, 10 * unitIndex)).toFixed(2)} ${ramUnits[unitIndex]}`;\n\t\t\t\t\t}\n\t\t\t\t\tprocesses.set(pid, entry);\n\t\t\t\t}\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\n\t\tlet buf = `${process.pid} - Main `;\n\t\tconst mainDisplay = [];\n\t\tconst mainProcess = processes.get(`${process.pid}`)!;\n\t\tif (mainProcess.cpu) mainDisplay.push(`CPU ${mainProcess.cpu}`);\n\t\tif (mainProcess.time) mainDisplay.push(`time: ${mainProcess.time})`);\n\t\tif (mainProcess.ram) {\n\t\t\tmainDisplay.push(`RAM: ${mainProcess.ram}`);\n\t\t}\n\t\tif (mainDisplay.length) buf += ` (${mainDisplay.join(', ')})`;\n\t\tbuf += `

Process managers:
`;\n\t\tprocesses.delete(`${process.pid}`);\n\n\t\tfor (const manager of ProcessManager.processManagers) {\n\t\t\tfor (const [i, process] of manager.processes.entries()) {\n\t\t\t\tconst pid = process.getProcess().pid;\n\t\t\t\tlet managerName = manager.basename;\n\t\t\t\tif (managerName.startsWith('index.')) { // doesn't actually tell us anything abt the process\n\t\t\t\t\tmanagerName = manager.filename.split(path.sep).slice(-2).join(path.sep);\n\t\t\t\t}\n\t\t\t\tbuf += `${pid} - ${managerName} ${i} (load ${process.getLoad()}`;\n\t\t\t\tconst info = processes.get(`${pid}`)!;\n\t\t\t\tconst display = [];\n\t\t\t\tif (info.cpu) display.push(`CPU: ${info.cpu}`);\n\t\t\t\tif (info.time) display.push(`time: ${info.time}`);\n\t\t\t\tif (info.ram) display.push(`RAM: ${info.ram}`);\n\t\t\t\tif (display.length) buf += `, ${display.join(', ')})`;\n\t\t\t\tbuf += `
`;\n\t\t\t\tprocesses.delete(`${pid}`);\n\t\t\t}\n\t\t\tfor (const [i, process] of manager.releasingProcesses.entries()) {\n\t\t\t\tconst pid = process.getProcess().pid;\n\t\t\t\tbuf += `${pid} - PENDING RELEASE ${manager.basename} ${i} (load ${process.getLoad()}`;\n\t\t\t\tconst info = processes.get(`${pid}`);\n\t\t\t\tif (info) {\n\t\t\t\t\tconst display = [];\n\t\t\t\t\tif (info.cpu) display.push(`CPU: ${info.cpu}`);\n\t\t\t\t\tif (info.time) display.push(`time: ${info.time}`);\n\t\t\t\t\tif (info.ram) display.push(`RAM: ${info.ram}`);\n\t\t\t\t\tif (display.length) buf += `, ${display.join(', ')})`;\n\t\t\t\t}\n\t\t\t\tbuf += `
`;\n\t\t\t\tprocesses.delete(`${pid}`);\n\t\t\t}\n\t\t}\n\t\tbuf += `
`;\n\t\tbuf += `
Other processes:`;\n\n\t\tfor (const [pid, info] of processes) {\n\t\t\tbuf += `${pid} - ${info.cmd}`;\n\t\t\tconst display = [];\n\t\t\tif (info.cpu) display.push(`CPU: ${info.cpu}`);\n\t\t\tif (info.time) display.push(`time: ${info.time}`);\n\t\t\tif (info.ram) display.push(`RAM: ${info.ram}`);\n\t\t\tif (display.length) buf += `(${display.join(', ')})`;\n\t\t\tbuf += `
`;\n\t\t}\n\t\tbuf += `
`;\n\t\tthis.sendReplyBox(buf);\n\t},\n\tprocesseshelp: [\n\t\t`/processes - Get information about the running processes on the server. Requires: &.`,\n\t],\n\n\tasync savelearnsets(target, room, user, connection) {\n\t\tthis.canUseConsole();\n\t\tthis.sendReply(\"saving...\");\n\t\tawait FS('data/learnsets.js').write(`'use strict';\\n\\nexports.Learnsets = {\\n` +\n\t\t\tObject.entries(Dex.data.Learnsets).map(([id, entry]) => (\n\t\t\t\t`\\t${id}: {learnset: {\\n` +\n\t\t\t\tUtils.sortBy(\n\t\t\t\t\tObject.entries(Dex.species.getLearnsetData(id as ID).learnset!),\n\t\t\t\t\t([moveid]) => moveid\n\t\t\t\t).map(([moveid, sources]) => (\n\t\t\t\t\t`\\t\\t${moveid}: [\"` + sources.join(`\", \"`) + `\"],\\n`\n\t\t\t\t)).join('') +\n\t\t\t\t`\\t}},\\n`\n\t\t\t)).join('') +\n\t\t`};\\n`);\n\t\tthis.sendReply(\"learnsets.js saved.\");\n\t},\n\tsavelearnsetshelp: [\n\t\t`/savelearnsets - Saves the learnset list currently active on the server. Requires: &`,\n\t],\n\n\ttoggleripgrep(target, room, user) {\n\t\tthis.checkCan('rangeban');\n\t\tConfig.disableripgrep = !Config.disableripgrep;\n\t\tthis.addGlobalModAction(`${user.name} ${Config.disableripgrep ? 'disabled' : 'enabled'} Ripgrep-related functionality.`);\n\t},\n\ttoggleripgrephelp: [`/toggleripgrep - Disable/enable all functionality depending on Ripgrep. Requires: &`],\n\n\tdisablecommand(target, room, user) {\n\t\tthis.checkCan('makeroom');\n\t\tif (!toID(target)) {\n\t\t\treturn this.parse(`/help disablecommand`);\n\t\t}\n\t\tif (['!', '/'].some(c => target.startsWith(c))) target = target.slice(1);\n\t\tconst parsed = Chat.parseCommand(`/${target}`);\n\t\tif (!parsed) {\n\t\t\treturn this.errorReply(`Command \"/${target}\" is in an invalid format.`);\n\t\t}\n\t\tconst {handler, fullCmd} = parsed;\n\t\tif (!handler) {\n\t\t\treturn this.errorReply(`Command \"/${target}\" not found.`);\n\t\t}\n\t\tif (handler.disabled) {\n\t\t\treturn this.errorReply(`Command \"/${target}\" is already disabled`);\n\t\t}\n\t\thandler.disabled = true;\n\t\tthis.addGlobalModAction(`${user.name} disabled the command /${fullCmd}.`);\n\t\tthis.globalModlog(`DISABLECOMMAND`, null, target);\n\t},\n\tdisablecommandhelp: [`/disablecommand [command] - Disables the given [command]. Requires: &`],\n\n\twidendatacenters: 'adddatacenters',\n\tadddatacenters() {\n\t\tthis.errorReply(\"This command has been replaced by /datacenter add\");\n\t\treturn this.parse('/help datacenters');\n\t},\n\n\tdisableladder(target, room, user) {\n\t\tthis.checkCan('disableladder');\n\t\tif (Ladders.disabled) {\n\t\t\treturn this.errorReply(`/disableladder - Ladder is already disabled.`);\n\t\t}\n\n\t\tLadders.disabled = true;\n\n\t\tthis.modlog(`DISABLELADDER`);\n\t\tMonitor.log(`The ladder was disabled by ${user.name}.`);\n\n\t\tconst innerHTML = (\n\t\t\t`Due to technical difficulties, the ladder has been temporarily disabled.
` +\n\t\t\t`Rated games will no longer update the ladder. It will be back momentarily.`\n\t\t);\n\n\t\tfor (const curRoom of Rooms.rooms.values()) {\n\t\t\tif (curRoom.type === 'battle') curRoom.rated = 0;\n\t\t\tcurRoom.addRaw(`
${innerHTML}
`).update();\n\t\t}\n\t\tfor (const u of Users.users.values()) {\n\t\t\tif (u.connected) u.send(`|pm|&|${u.tempGroup}${u.name}|/raw
${innerHTML}
`);\n\t\t}\n\t},\n\tdisableladderhelp: [`/disableladder - Stops all rated battles from updating the ladder. Requires: &`],\n\n\tenableladder(target, room, user) {\n\t\tthis.checkCan('disableladder');\n\t\tif (!Ladders.disabled) {\n\t\t\treturn this.errorReply(`/enable - Ladder is already enabled.`);\n\t\t}\n\t\tLadders.disabled = false;\n\n\t\tthis.modlog('ENABLELADDER');\n\t\tMonitor.log(`The ladder was enabled by ${user.name}.`);\n\n\t\tconst innerHTML = (\n\t\t\t`The ladder is now back.
` +\n\t\t\t`Rated games will update the ladder now..`\n\t\t);\n\n\t\tfor (const curRoom of Rooms.rooms.values()) {\n\t\t\tcurRoom.addRaw(`
${innerHTML}
`).update();\n\t\t}\n\t\tfor (const u of Users.users.values()) {\n\t\t\tif (u.connected) u.send(`|pm|&|${u.tempGroup}${u.name}|/raw
${innerHTML}
`);\n\t\t}\n\t},\n\tenableladderhelp: [`/enable - Allows all rated games to update the ladder. Requires: &`],\n\n\tlockdown(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\n\t\tconst disabledCommands = Chat.allCommands().filter(c => c.disabled).map(c => `/${c.fullCmd}`);\n\t\tif (disabledCommands.length) {\n\t\t\tthis.sendReply(`${Chat.count(disabledCommands.length, \"commands\")} are disabled right now.`);\n\t\t\tthis.sendReply(`Be aware that restarting will re-enable them.`);\n\t\t\tthis.sendReply(`Currently disabled: ${disabledCommands.join(', ')}`);\n\t\t}\n\t\tRooms.global.startLockdown();\n\n\t\tthis.stafflog(`${user.name} used /lockdown`);\n\t},\n\tlockdownhelp: [\n\t\t`/lockdown - locks down the server, which prevents new battles from starting so that the server can eventually be restarted. Requires: &`,\n\t],\n\n\tautolockdown: 'autolockdownkill',\n\tautolockdownkill(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\t\tif (Config.autolockdown === undefined) Config.autolockdown = true;\n\t\tif (this.meansYes(target)) {\n\t\t\tif (Config.autolockdown) {\n\t\t\t\treturn this.errorReply(\"The server is already set to automatically kill itself upon the final battle finishing.\");\n\t\t\t}\n\t\t\tConfig.autolockdown = true;\n\t\t\tthis.privateGlobalModAction(`${user.name} used /autolockdownkill on (autokill on final battle finishing)`);\n\t\t} else if (this.meansNo(target)) {\n\t\t\tif (!Config.autolockdown) {\n\t\t\t\treturn this.errorReply(\"The server is already set to not automatically kill itself upon the final battle finishing.\");\n\t\t\t}\n\t\t\tConfig.autolockdown = false;\n\t\t\tthis.privateGlobalModAction(`${user.name} used /autolockdownkill off (no autokill on final battle finishing)`);\n\t\t} else {\n\t\t\treturn this.parse('/help autolockdownkill');\n\t\t}\n\t},\n\tautolockdownkillhelp: [\n\t\t`/autolockdownkill on - Turns on the setting to enable the server to automatically kill itself upon the final battle finishing. Requires &`,\n\t\t`/autolockdownkill off - Turns off the setting to enable the server to automatically kill itself upon the final battle finishing. Requires &`,\n\t],\n\n\tprelockdown(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\t\tRooms.global.lockdown = 'pre';\n\n\t\tthis.privateGlobalModAction(`${user.name} used /prelockdown (disabled tournaments in preparation for server restart)`);\n\t},\n\tprelockdownhelp: [`/prelockdown - Prevents new tournaments from starting so that the server can be restarted. Requires: &`],\n\n\tslowlockdown(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\n\t\tRooms.global.startLockdown(undefined, true);\n\n\t\tthis.privateGlobalModAction(`${user.name} used /slowlockdown (lockdown without auto-restart)`);\n\t},\n\tslowlockdownhelp: [\n\t\t`/slowlockdown - Locks down the server, but disables the automatic restart after all battles end.`,\n\t\t`Requires: &`,\n\t],\n\n\tcrashfixed: 'endlockdown',\n\tendlockdown(target, room, user, connection, cmd) {\n\t\tthis.checkCan('lockdown');\n\n\t\tif (!Rooms.global.lockdown) {\n\t\t\treturn this.errorReply(\"We're not under lockdown right now.\");\n\t\t}\n\t\tif (Rooms.global.lockdown !== true && cmd === 'crashfixed') {\n\t\t\treturn this.errorReply('/crashfixed - There is no active crash.');\n\t\t}\n\n\t\tconst message = cmd === 'crashfixed' ?\n\t\t\t`
We fixed the crash without restarting the server!
` :\n\t\t\t`
The server restart was canceled.
`;\n\t\tif (Rooms.global.lockdown === true) {\n\t\t\tfor (const curRoom of Rooms.rooms.values()) {\n\t\t\t\tcurRoom.addRaw(message).update();\n\t\t\t}\n\t\t\tfor (const curUser of Users.users.values()) {\n\t\t\t\tcurUser.send(`|pm|&|${curUser.tempGroup}${curUser.name}|/raw ${message}`);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.sendReply(\"Preparation for the server shutdown was canceled.\");\n\t\t}\n\t\tRooms.global.lockdown = false;\n\n\t\tthis.stafflog(`${user.name} used /endlockdown`);\n\t},\n\tendlockdownhelp: [\n\t\t`/endlockdown - Cancels the server restart and takes the server out of lockdown state. Requires: &`,\n\t\t`/crashfixed - Ends the active lockdown caused by a crash without the need of a restart. Requires: &`,\n\t],\n\n\temergency(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\n\t\tif (Config.emergency) {\n\t\t\treturn this.errorReply(\"We're already in emergency mode.\");\n\t\t}\n\t\tConfig.emergency = true;\n\t\tfor (const curRoom of Rooms.rooms.values()) {\n\t\t\tcurRoom.addRaw(`
The server has entered emergency mode. Some features might be disabled or limited.
`).update();\n\t\t}\n\n\t\tthis.stafflog(`${user.name} used /emergency.`);\n\t},\n\temergencyhelp: [\n\t\t`/emergency - Turns on emergency mode and enables extra logging. Requires: &`,\n\t],\n\n\tendemergency(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\n\t\tif (!Config.emergency) {\n\t\t\treturn this.errorReply(\"We're not in emergency mode.\");\n\t\t}\n\t\tConfig.emergency = false;\n\t\tfor (const curRoom of Rooms.rooms.values()) {\n\t\t\tcurRoom.addRaw(`
The server is no longer in emergency mode.
`).update();\n\t\t}\n\n\t\tthis.stafflog(`${user.name} used /endemergency.`);\n\t},\n\tendemergencyhelp: [\n\t\t`/endemergency - Turns off emergency mode. Requires: &`,\n\t],\n\n\tremainingbattles() {\n\t\tthis.checkCan('lockdown');\n\n\t\tif (!Rooms.global.lockdown) {\n\t\t\treturn this.errorReply(\"The server is not under lockdown right now.\");\n\t\t}\n\n\t\tconst battleRooms = [...Rooms.rooms.values()].filter(x => x.battle?.rated && !x.battle?.ended);\n\t\tlet buf = `Total remaining rated battles: ${battleRooms.length}`;\n\t\tif (battleRooms.length > 10) buf += `
View all battles`;\n\t\tfor (const battle of battleRooms) {\n\t\t\tbuf += `
`;\n\t\t\tbuf += `${battle.title}`;\n\t\t\tif (battle.settings.isPrivate) buf += ' (Private)';\n\t\t}\n\t\tif (battleRooms.length > 10) buf += `
`;\n\t\tthis.sendReplyBox(buf);\n\t},\n\tremainingbattleshelp: [\n\t\t`/remainingbattles - View a list of the remaining battles during lockdown. Requires: &`,\n\t],\n\n\tasync savebattles(target, room, user) {\n\t\tthis.checkCan('rangeban'); // admins can restart, so they should be able to do this if needed\n\t\tthis.sendReply(`Saving battles...`);\n\t\tconst count = await Rooms.global.saveBattles();\n\t\tthis.sendReply(`DONE.`);\n\t\tthis.sendReply(`${count} battles saved.`);\n\t\tthis.addModAction(`${user.name} used /savebattles`);\n\t},\n\n\tasync kill(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\t\tlet noSave = toID(target) === 'nosave';\n\t\tif (!Config.usepostgres) noSave = true;\n\n\t\tif (Rooms.global.lockdown !== true && noSave) {\n\t\t\treturn this.errorReply(\"For safety reasons, using /kill without saving battles can only be done during lockdown.\");\n\t\t}\n\n\t\tif (Monitor.updateServerLock) {\n\t\t\treturn this.errorReply(\"Wait for /updateserver to finish before using /kill.\");\n\t\t}\n\n\t\tif (!noSave) {\n\t\t\tthis.sendReply('Saving battles...');\n\t\t\tRooms.global.lockdown = true; // we don't want more battles starting while we save\n\t\t\tfor (const u of Users.users.values()) {\n\t\t\t\tu.send(\n\t\t\t\t\t`|pm|&|${u.getIdentity()}|/raw
The server is restarting soon.
` +\n\t\t\t\t\t`While battles are being saved, no more can be started. If you're in a battle, it will be paused during saving.
` +\n\t\t\t\t\t`After the restart, you will be able to resume your battles from where you left off.`\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst count = await Rooms.global.saveBattles();\n\t\t\tthis.sendReply(`DONE.`);\n\t\t\tthis.sendReply(`${count} battles saved.`);\n\t\t}\n\n\t\tconst logRoom = Rooms.get('staff') || Rooms.lobby || room;\n\n\t\tif (!logRoom?.log.roomlogStream) return process.exit();\n\n\t\tlogRoom.roomlog(`${user.name} used /kill`);\n\n\t\tvoid logRoom.log.roomlogStream.writeEnd().then(() => {\n\t\t\tprocess.exit();\n\t\t});\n\n\t\t// In the case the above never terminates\n\t\tsetTimeout(() => {\n\t\t\tprocess.exit();\n\t\t}, 10000);\n\t},\n\tkillhelp: [\n\t\t`/kill - kills the server. Use the argument \\`nosave\\` to prevent the saving of battles.`,\n\t\t` If this argument is used, the server must be in lockdown. Requires: &`,\n\t],\n\n\tloadbanlist(target, room, user, connection) {\n\t\tthis.checkCan('lockdown');\n\n\t\tconnection.sendTo(room, \"Loading ipbans.txt...\");\n\t\tPunishments.loadBanlist().then(\n\t\t\t() => connection.sendTo(room, \"ipbans.txt has been reloaded.\"),\n\t\t\terror => connection.sendTo(room, `Something went wrong while loading ipbans.txt: ${error}`)\n\t\t);\n\t},\n\tloadbanlisthelp: [\n\t\t`/loadbanlist - Loads the bans located at ipbans.txt. The command is executed automatically at startup. Requires: &`,\n\t],\n\n\trefreshpage(target, room, user) {\n\t\tthis.checkCan('lockdown');\n\t\tif (user.lastCommand !== 'refreshpage') {\n\t\t\tuser.lastCommand = 'refreshpage';\n\t\t\tthis.errorReply(`Are you sure you wish to refresh the page for every user online?`);\n\t\t\treturn this.errorReply(`If you are sure, please type /refreshpage again to confirm.`);\n\t\t}\n\t\tRooms.global.sendAll('|refresh|');\n\t\tthis.stafflog(`${user.name} used /refreshpage`);\n\t},\n\trefreshpagehelp: [\n\t\t`/refreshpage - refreshes the page for every user online. Requires: &`,\n\t],\n\n\tasync updateserver(target, room, user, connection) {\n\t\tthis.canUseConsole();\n\t\tif (Monitor.updateServerLock) {\n\t\t\treturn this.errorReply(`/updateserver - Another update is already in progress (or a previous update crashed).`);\n\t\t}\n\n\t\tconst validPrivateCodePath = Config.privatecodepath && path.isAbsolute(Config.privatecodepath);\n\t\ttarget = toID(target);\n\t\tMonitor.updateServerLock = true;\n\n\n\t\tlet success = true;\n\t\tif (target === 'private') {\n\t\t\tif (!validPrivateCodePath) {\n\t\t\t\tMonitor.updateServerLock = false;\n\t\t\t\tthrow new Chat.ErrorMessage(\"`Config.privatecodepath` must be set to an absolute path before using /updateserver private.\");\n\t\t\t}\n\t\t\tsuccess = await updateserver(this, Config.privatecodepath);\n\t\t\tthis.addGlobalModAction(`${user.name} used /updateserver private`);\n\t\t} else {\n\t\t\tif (target !== 'public' && validPrivateCodePath) {\n\t\t\t\tsuccess = await updateserver(this, Config.privatecodepath);\n\t\t\t}\n\t\t\tsuccess = success && await updateserver(this, FS.ROOT_PATH);\n\t\t\tthis.addGlobalModAction(`${user.name} used /updateserver${target === 'public' ? ' public' : ''}`);\n\t\t}\n\n\t\tthis.sendReply(success ? `DONE` : `FAILED, old changes restored.`);\n\n\t\tMonitor.updateServerLock = false;\n\t},\n\tupdateserverhelp: [\n\t\t`/updateserver - Updates the server's code from its Git repository, including private code if present. Requires: console access`,\n\t\t`/updateserver private - Updates only the server's private code. Requires: console access`,\n\t],\n\n\tasync updateloginserver(target, room, user) {\n\t\tthis.canUseConsole();\n\t\tthis.sendReply('Restarting...');\n\t\tconst [result, err] = await LoginServer.request('restart');\n\t\tif (err) {\n\t\t\tRooms.global.notifyRooms(\n\t\t\t\t['staff', 'development'],\n\t\t\t\t`|c|${user.getIdentity()}|/log ${user.name} used /updateloginserver - but something failed while updating.`\n\t\t\t);\n\t\t\treturn this.errorReply(err.message + '\\n' + err.stack);\n\t\t}\n\t\tif (!result) return this.errorReply('No result received.');\n\t\tthis.stafflog(`[o] ${result.success || \"\"} [e] ${result.actionerror || \"\"}`);\n\t\tif (result.actionerror) {\n\t\t\treturn this.errorReply(result.actionerror);\n\t\t}\n\t\tlet message = `${user.name} used /updateloginserver`;\n\t\tif (result.updated) {\n\t\t\tthis.sendReply(`DONE. Server updated and restarted.`);\n\t\t} else {\n\t\t\tmessage += ` - but something failed while updating.`;\n\t\t\tthis.errorReply(`FAILED. Conflicts were found while updating - the restart was aborted.`);\n\t\t}\n\t\tRooms.global.notifyRooms(\n\t\t\t['staff', 'development'], `|c|${user.getIdentity()}|/log ${message}`\n\t\t);\n\t},\n\tupdateloginserverhelp: [\n\t\t`/updateloginserver - Updates and restarts the loginserver. Requires: console access`,\n\t],\n\n\tasync updateclient(target, room, user) {\n\t\tthis.canUseConsole();\n\t\tthis.sendReply('Restarting...');\n\t\tconst [result, err] = await LoginServer.request('rebuildclient', {\n\t\t\tfull: toID(target) === 'full',\n\t\t});\n\t\tif (err) {\n\t\t\tRooms.global.notifyRooms(\n\t\t\t\t['staff', 'development'],\n\t\t\t\t`|c|${user.getIdentity()}|/log ${user.name} used /updateclient - but something failed while updating.`\n\t\t\t);\n\t\t\treturn this.errorReply(err.message + '\\n' + err.stack);\n\t\t}\n\t\tif (!result) return this.errorReply('No result received.');\n\t\tthis.stafflog(`[o] ${result.success || \"\"} [e] ${result.actionerror || \"\"}`);\n\t\tif (result.actionerror) {\n\t\t\treturn this.errorReply(result.actionerror);\n\t\t}\n\t\tlet message = `${user.name} used /updateclient`;\n\t\tif (result.updated) {\n\t\t\tthis.sendReply(`DONE. Client updated.`);\n\t\t} else {\n\t\t\tmessage += ` - but something failed while updating.`;\n\t\t\tthis.errorReply(`FAILED. Conflicts were found while updating.`);\n\t\t}\n\t\tRooms.global.notifyRooms(\n\t\t\t['staff', 'development'], `|c|${user.getIdentity()}|/log ${message}`\n\t\t);\n\t},\n\tupdateclienthelp: [\n\t\t`/updateclient [full] - Update the client source code. Provide the argument 'full' to make it a full rebuild.`,\n\t\t`Requires: & console access`,\n\t],\n\n\tasync rebuild() {\n\t\tthis.canUseConsole();\n\t\tconst [, , stderr] = await bash('node ./build', this);\n\t\tif (stderr) {\n\t\t\tthrow new Chat.ErrorMessage(`Crash while rebuilding: ${stderr}`);\n\t\t}\n\t\tthis.sendReply('Rebuilt.');\n\t},\n\n\t/*********************************************************\n\t * Low-level administration commands\n\t *********************************************************/\n\n\tasync bash(target, room, user, connection) {\n\t\tthis.canUseConsole();\n\t\tif (!target) return this.parse('/help bash');\n\t\tthis.sendReply(`$ ${target}`);\n\t\tconst [, stdout, stderr] = await bash(target, this);\n\t\tthis.runBroadcast();\n\t\tthis.sendReply(`${stdout}${stderr}`);\n\t},\n\tbashhelp: [`/bash [command] - Executes a bash command on the server. Requires: & console access`],\n\n\tasync eval(target, room, user, connection) {\n\t\tthis.canUseConsole();\n\t\tif (!this.runBroadcast(true)) return;\n\t\tconst logRoom = Rooms.get('upperstaff') || Rooms.get('staff');\n\n\t\tif (this.message.startsWith('>>') && room) {\n\t\t\tthis.broadcasting = true;\n\t\t\tthis.broadcastToRoom = true;\n\t\t}\n\t\tconst generateHTML = (direction: string, contents: string) => (\n\t\t\t`
` +\n\t\t\t\tUtils.escapeHTML(direction).repeat(2) +\n\t\t\t\t` ${Chat.getReadmoreCodeBlock(contents)}
`\n\t\t);\n\t\tthis.sendReply(`|html|${generateHTML('>', target)}`);\n\t\tlogRoom?.roomlog(`>> ${target}`);\n\t\tlet uhtmlId = null;\n\t\ttry {\n\t\t\t/* eslint-disable no-eval, @typescript-eslint/no-unused-vars */\n\t\t\tconst battle = room?.battle;\n\t\t\tconst me = user;\n\t\t\tlet result = eval(target);\n\t\t\t/* eslint-enable no-eval, @typescript-eslint/no-unused-vars */\n\n\t\t\tif (result?.then) {\n\t\t\t\tuhtmlId = `eval-${Date.now().toString().slice(-6)}-${Math.random().toFixed(6).slice(-6)}`;\n\t\t\t\tthis.sendReply(`|uhtml|${uhtmlId}|${generateHTML('<', 'Promise pending')}`);\n\t\t\t\tthis.update();\n\t\t\t\tresult = `Promise -> ${Utils.visualize(await result)}`;\n\t\t\t\tthis.sendReply(`|uhtmlchange|${uhtmlId}|${generateHTML('<', result)}`);\n\t\t\t} else {\n\t\t\t\tresult = Utils.visualize(result);\n\t\t\t\tthis.sendReply(`|html|${generateHTML('<', result)}`);\n\t\t\t}\n\t\t\tlogRoom?.roomlog(`<< ${result}`);\n\t\t} catch (e: any) {\n\t\t\tconst message = ('' + e.stack).replace(/\\n *at CommandContext\\.eval [\\s\\S]*/m, '');\n\t\t\tconst command = uhtmlId ? `|uhtmlchange|${uhtmlId}|` : '|html|';\n\t\t\tthis.sendReply(`${command}${generateHTML('<', message)}`);\n\t\t\tlogRoom?.roomlog(`<< ${message}`);\n\t\t}\n\t},\n\tevalhelp: [\n\t\t`/eval [code] - Evaluates the code given and shows results. Requires: & console access.`,\n\t],\n\n\tasync evalsql(target, room) {\n\t\tthis.canUseConsole();\n\t\tthis.runBroadcast(true);\n\t\tif (!Config.usesqlite) return this.errorReply(`SQLite is disabled.`);\n\t\tconst logRoom = Rooms.get('upperstaff') || Rooms.get('staff');\n\t\tif (!target) return this.errorReply(`Specify a database to access and a query.`);\n\t\tconst [db, query] = Utils.splitFirst(target, ',').map(item => item.trim());\n\t\tif (!FS('./databases').readdirSync().includes(`${db}.db`)) {\n\t\t\treturn this.errorReply(`The database file ${db}.db was not found.`);\n\t\t}\n\t\tif (room && this.message.startsWith('>>sql')) {\n\t\t\tthis.broadcasting = true;\n\t\t\tthis.broadcastToRoom = true;\n\t\t}\n\t\tthis.sendReply(\n\t\t\t`|html|
` +\n\t\t\t`
SQLite> [${db}.db]  ${Chat.getReadmoreCodeBlock(query)}
`\n\t\t);\n\t\tlogRoom?.roomlog(`SQLite> ${target}`);\n\t\tconst database = SQL(module, {\n\t\t\tfile: `./databases/${db}.db`,\n\t\t\tonError(err) {\n\t\t\t\treturn {err: err.message, stack: err.stack};\n\t\t\t},\n\t\t});\n\t\tfunction formatResult(result: any[] | string) {\n\t\t\tif (!Array.isArray(result)) {\n\t\t\t\treturn (\n\t\t\t\t\t`
` +\n\t\t\t\t\t`SQLite< ${Chat.getReadmoreCodeBlock(result)}
`\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet buffer = '
`;\n\t\t\t\treturn buffer;\n\t\t\t}\n\t\t\tbuffer += Object.keys(result[0]).join('`;\n\t\t\tbuffer += result.map(item => (\n\t\t\t\t``\n\t\t\t)).join('');\n\t\t\tbuffer += `
';\n\t\t\t// header\n\t\t\tif (!result.length) {\n\t\t\t\tbuffer += `No data in table.
');\n\t\t\tbuffer += `
${Object.values(item).map(val => Utils.escapeHTML(val as string)).join('')}
`;\n\t\t\treturn buffer;\n\t\t}\n\n\t\tfunction parseError(res: any): never {\n\t\t\tconst err = new Error(res.err);\n\t\t\terr.stack = res.stack;\n\t\t\tthrow err;\n\t\t}\n\n\t\tlet result;\n\t\ttry {\n\t\t\t// presume it's attempting to get data first\n\t\t\tresult = await database.all(query, []);\n\t\t\tif ((result as any).err) parseError(result as any);\n\t\t} catch (err: any) {\n\t\t\t// it's not getting data, but it might still be a valid statement - try to run instead\n\t\t\tif (err.stack?.includes(`Use run() instead`)) {\n\t\t\t\ttry {\n\t\t\t\t\tresult = await database.run(query, []);\n\t\t\t\t\tif ((result as any).err) parseError(result as any);\n\t\t\t\t\tresult = Utils.visualize(result);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tresult = ('' + e.stack).replace(/\\n *at CommandContext\\.evalsql [\\s\\S]*/m, '');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresult = ('' + err.stack).replace(/\\n *at CommandContext\\.evalsql [\\s\\S]*/m, '');\n\t\t\t}\n\t\t}\n\t\tawait database.destroy();\n\t\tconst formattedResult = `|html|${formatResult(result)}`;\n\t\tlogRoom?.roomlog(formattedResult);\n\t\tthis.sendReply(formattedResult);\n\t},\n\tevalsqlhelp: [\n\t\t`/evalsql [database], [query] - Evaluates the given SQL [query] in the given [database].`,\n\t\t`Requires: & console access`,\n\t],\n\n\tevalbattle(target, room, user, connection) {\n\t\troom = this.requireRoom();\n\t\tthis.canUseConsole();\n\t\tif (!this.runBroadcast(true)) return;\n\t\tif (!room.battle) {\n\t\t\treturn this.errorReply(\"/evalbattle - This isn't a battle room.\");\n\t\t}\n\n\t\tvoid room.battle.stream.write(`>eval ${target.replace(/\\n/g, '\\f')}`);\n\t},\n\tevalbattlehelp: [\n\t\t`/evalbattle [code] - Evaluates the code in the battle stream of the current room. Requires: & console access.`,\n\t],\n\n\tebat: 'editbattle',\n\teditbattle(target, room, user) {\n\t\troom = this.requireRoom();\n\t\tthis.checkCan('forcewin');\n\t\tif (!target) return this.parse('/help editbattle');\n\t\tif (!room.battle) {\n\t\t\tthis.errorReply(\"/editbattle - This is not a battle room.\");\n\t\t\treturn false;\n\t\t}\n\t\tconst battle = room.battle;\n\t\tlet cmd;\n\t\t[cmd, target] = Utils.splitFirst(target, ' ');\n\t\tif (cmd.endsWith(',')) cmd = cmd.slice(0, -1);\n\t\tconst targets = target.split(',');\n\t\tif (targets.length === 1 && targets[0] === '') targets.pop();\n\t\tlet player, pokemon, move, stat, value;\n\t\tswitch (cmd) {\n\t\tcase 'hp':\n\t\tcase 'h':\n\t\t\tif (targets.length !== 3) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[player, pokemon, value] = targets.map(f => f.trim());\n\t\t\t[player, pokemon] = [player, pokemon].map(toID);\n\t\t\tvoid battle.stream.write(\n\t\t\t\t`>eval let p=pokemon('${player}', '${pokemon}');p.sethp(${parseInt(value)});` +\n\t\t\t\t`if (p.isActive)battle.add('-damage',p,p.getHealth);`\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'status':\n\t\tcase 's':\n\t\t\tif (targets.length !== 3) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[player, pokemon, value] = targets.map(toID);\n\t\t\tvoid battle.stream.write(\n\t\t\t\t`>eval let pl=player('${player}');let p=pokemon(pl,'${pokemon}');p.setStatus('${value}');if (!p.isActive){battle.add('','please ignore the above');battle.add('-status',pl.active[0],pl.active[0].status,'[silent]');}`\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'pp':\n\t\t\tif (targets.length !== 4) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[player, pokemon, move, value] = targets.map(f => f.trim());\n\t\t\t[player, pokemon, move] = [player, pokemon, move].map(toID);\n\t\t\tvoid battle.stream.write(\n\t\t\t\t`>eval pokemon('${player}','${pokemon}').getMoveData('${move}').pp = ${parseInt(value)};`\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'boost':\n\t\tcase 'b':\n\t\t\tif (targets.length !== 4) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[player, pokemon, stat, value] = targets.map(f => f.trim());\n\t\t\t[player, pokemon, stat] = [player, pokemon, stat].map(toID);\n\t\t\tvoid battle.stream.write(\n\t\t\t\t`>eval let p=pokemon('${player}','${pokemon}');battle.boost({${stat}:${parseInt(value)}},p)`\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'volatile':\n\t\tcase 'v':\n\t\t\tif (targets.length !== 3) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[player, pokemon, value] = targets.map(toID);\n\t\t\tvoid battle.stream.write(\n\t\t\t\t`>eval pokemon('${player}','${pokemon}').addVolatile('${value}')`\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'sidecondition':\n\t\tcase 'sc':\n\t\t\tif (targets.length !== 2) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[player, value] = targets.map(toID);\n\t\t\tvoid battle.stream.write(`>eval player('${player}').addSideCondition('${value}', 'debug')`);\n\t\t\tbreak;\n\t\tcase 'fieldcondition': case 'pseudoweather':\n\t\tcase 'fc':\n\t\t\tif (targets.length !== 1) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[value] = targets.map(toID);\n\t\t\tvoid battle.stream.write(`>eval battle.field.addPseudoWeather('${value}', 'debug')`);\n\t\t\tbreak;\n\t\tcase 'weather':\n\t\tcase 'w':\n\t\t\tif (targets.length !== 1) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[value] = targets.map(toID);\n\t\t\tvoid battle.stream.write(`>eval battle.field.setWeather('${value}', 'debug')`);\n\t\t\tbreak;\n\t\tcase 'terrain':\n\t\tcase 't':\n\t\t\tif (targets.length !== 1) {\n\t\t\t\tthis.errorReply(\"Incorrect command use\");\n\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t}\n\t\t\t[value] = targets.map(toID);\n\t\t\tvoid battle.stream.write(`>eval battle.field.setTerrain('${value}', 'debug')`);\n\t\t\tbreak;\n\t\tcase 'reseed':\n\t\t\tif (targets.length !== 0) {\n\t\t\t\tif (targets.length !== 4) {\n\t\t\t\t\tthis.errorReply(\"Seed must have 4 parts\");\n\t\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t\t}\n\t\t\t\t// this just tests for a 5-digit number, close enough to uint16\n\t\t\t\tif (!targets.every(val => /^[0-9]{1,5}$/.test(val))) {\n\t\t\t\t\tthis.errorReply(\"Seed parts much be unsigned 16-bit integers\");\n\t\t\t\t\treturn this.parse('/help editbattle');\n\t\t\t\t}\n\t\t\t}\n\t\t\tvoid battle.stream.write(`>reseed ${targets.join(',')}`);\n\t\t\tif (targets.length) this.sendReply(`Reseeded to ${targets.join(',')}`);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthis.errorReply(`Unknown editbattle command: ${cmd}`);\n\t\t\treturn this.parse('/help editbattle');\n\t\t}\n\t},\n\teditbattlehelp: [\n\t\t`/editbattle hp [player], [pokemon], [hp]`,\n\t\t`/editbattle status [player], [pokemon], [status]`,\n\t\t`/editbattle pp [player], [pokemon], [move], [pp]`,\n\t\t`/editbattle boost [player], [pokemon], [stat], [amount]`,\n\t\t`/editbattle volatile [player], [pokemon], [volatile]`,\n\t\t`/editbattle sidecondition [player], [sidecondition]`,\n\t\t`/editbattle fieldcondition [fieldcondition]`,\n\t\t`/editbattle weather [weather]`,\n\t\t`/editbattle terrain [terrain]`,\n\t\t`/editbattle reseed [optional seed]`,\n\t\t`Short forms: /ebat h OR s OR pp OR b OR v OR sc OR fc OR w OR t`,\n\t\t`[player] must be a username or number, [pokemon] must be species name or party slot number (not nickname), [move] must be move name.`,\n\t],\n};\n\nexport const pages: Chat.PageTable = {\n\tbot(args, user, connection) {\n\t\tconst [botid, ...pageArgs] = args;\n\t\tconst pageid = pageArgs.join('-');\n\t\tif (pageid.length > 300) {\n\t\t\treturn this.errorReply(`The page ID specified is too long.`);\n\t\t}\n\t\tconst bot = Users.get(botid);\n\t\tif (!bot) {\n\t\t\treturn `

The bot \"${bot}\" is not available.

`;\n\t\t}\n\t\tlet canSend = Users.globalAuth.get(bot) === '*';\n\t\tlet room;\n\t\tfor (const curRoom of Rooms.global.chatRooms) {\n\t\t\tif (['*', '#'].includes(curRoom.auth.getDirect(bot.id))) {\n\t\t\t\tcanSend = true;\n\t\t\t\troom = curRoom;\n\t\t\t}\n\t\t}\n\t\tif (!canSend) {\n\t\t\treturn `

\"${bot}\" is not a bot.

`;\n\t\t}\n\t\tconnection.lastRequestedPage = `${bot.id}-${pageid}`;\n\t\tbot.sendTo(\n\t\t\troom ? room.roomid : 'lobby',\n\t\t\t`|pm|${user.getIdentity()}|${bot.getIdentity()}||requestpage|${user.name}|${pageid}`\n\t\t);\n\t},\n};\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,WAAsB;AACtB,oBAA+B;AAC/B,iBAA6C;AAd7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBA,SAAS,WAAWA,OAAY;AAC/B,QAAM,UAAU,MAAM,IAAI,aAAa;AACvC,SAAO,WAAW,MAAM,KAAK,QAAQ,QAAQ,KAAK,UAAUA,MAAK,EAAE,GAAG,GAAG;AAC1E;AAEA,SAAS,KAAK,SAAiB,SAA8B,KAAiD;AAC7G,UAAQ,SAAS,KAAK,SAAS;AAC/B,MAAI,CAAC;AAAK,UAAM,cAAG;AACnB,SAAO,IAAI,QAAQ,aAAW;AAC7B,kBAAc,KAAK,SAAS,EAAC,IAAG,GAAG,CAAC,OAAO,QAAQ,WAAW;AAC7D,UAAI,MAAM,OAAO,aAAa;AAC9B,UAAI;AAAO,cAAM,OAAO,MAAM;AAAA,EAAS;AACvC,cAAQ,SAAS,GAAG;AACpB,cAAQ,CAAC,OAAO,QAAQ,GAAG,QAAQ,MAAM,CAAC;AAAA,IAC3C,CAAC;AAAA,EACF,CAAC;AACF;AAEA,SAAS,2BAA2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