()
| 189 | } |
| 190 | |
| 191 | async loadLuaScripts() { |
| 192 | if (this.client.bootConfig.disableSpaceLua) { |
| 193 | console.info("Space Lua scripts are disabled, skipping loading scripts"); |
| 194 | return; |
| 195 | } |
| 196 | if (!(await this.objectIndex.isIndexAvailable())) { |
| 197 | console.info( |
| 198 | "Not loading space scripts, since no index is available yet", |
| 199 | ); |
| 200 | return; |
| 201 | } |
| 202 | this.client.config.clear(); |
| 203 | try { |
| 204 | await this.spaceLuaEnv.reload(); |
| 205 | } catch (e: any) { |
| 206 | console.error("Error loading Lua script:", e.message); |
| 207 | } |
| 208 | |
| 209 | // Reset the space script commands |
| 210 | this.scriptCommands.clear(); |
| 211 | for (const [name, command] of Object.entries( |
| 212 | this.client.config.get<Record<string, Command>>("commands", {}), |
| 213 | )) { |
| 214 | this.scriptCommands.set(name, command); |
| 215 | } |
| 216 | |
| 217 | // Make scripted (slash) commands available |
| 218 | this.commandHook.throttledBuildAllCommandsAndEmit(); |
| 219 | this.slashCommandHook.throttledBuildAllCommands(); |
| 220 | this.mqHook.throttledReloadQueues(); |
| 221 | |
| 222 | this.scriptsLoaded = true; |
| 223 | this.client.maybeDispatchWidgetsReady(); |
| 224 | } |
| 225 | |
| 226 | async loadPlugFromPath(path: string, lastModified: number) { |
| 227 | await this.system.loadPlug( |
no test coverage detected