diff --git a/src/Draupnir.ts b/src/Draupnir.ts index 6010c56d..b876fe7f 100644 --- a/src/Draupnir.ts +++ b/src/Draupnir.ts @@ -60,7 +60,7 @@ export class Draupnir implements Client { */ public unlistedUserRedactionQueue = new UnlistedUserRedactionQueue(); - private readonly commandTable = findCommandTable("mjolnir"); + private readonly commandTable = findCommandTable("draupnir"); public taskQueue: ThrottlingQueue; /** * Reporting back to the management room. diff --git a/src/commands/Ban.tsx b/src/commands/Ban.tsx index cc9280b1..5dcb55ed 100644 --- a/src/commands/Ban.tsx +++ b/src/commands/Ban.tsx @@ -86,7 +86,7 @@ async function ban( defineInterfaceCommand({ designator: ["ban"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "entity", @@ -126,6 +126,6 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "ban"), + interfaceCommand: findTableCommand("draupnir", "ban"), renderer: tickCrossRenderer }) diff --git a/src/commands/CommandHandler.ts b/src/commands/CommandHandler.ts index 34c1c815..67bbe34a 100644 --- a/src/commands/CommandHandler.ts +++ b/src/commands/CommandHandler.ts @@ -48,7 +48,7 @@ import "./DeactivateCommand"; import "./HijackRoomCommand"; import "./ShutdownRoomCommand"; -defineCommandTable("mjolnir").importTable(findCommandTable("synapse admin")); +defineCommandTable("draupnir").importTable(findCommandTable("synapse admin")); import "./Ban"; import "./CreateBanListCommand"; import "./Help"; @@ -79,7 +79,7 @@ export async function handleCommand( const readItems = readCommand(normalisedCommand) const stream = new ArgumentStream(readItems); const command = commandTable.findAMatchingCommand(stream) - ?? findTableCommand("mjolnir", "help"); + ?? findTableCommand("draupnir", "help"); const adaptor = findMatrixInterfaceAdaptor(command); const draupnirContext: DraupnirContext = { ...draupnir.commandContext, diff --git a/src/commands/CreateBanListCommand.ts b/src/commands/CreateBanListCommand.ts index afb1de36..0f86856e 100644 --- a/src/commands/CreateBanListCommand.ts +++ b/src/commands/CreateBanListCommand.ts @@ -63,7 +63,7 @@ export async function createList( defineInterfaceCommand({ designator: ["list", "create"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "shortcode", @@ -79,7 +79,7 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "list", "create"), + interfaceCommand: findTableCommand("draupnir", "list", "create"), renderer: tickCrossRenderer }) diff --git a/src/commands/Help.tsx b/src/commands/Help.tsx index 558f4395..54b9a279 100644 --- a/src/commands/Help.tsx +++ b/src/commands/Help.tsx @@ -53,16 +53,16 @@ function renderMjolnirHelp(mjolnirTable: CommandTable): DocumentNode { defineInterfaceCommand({ parameters: parameters([], new RestDescription('command parts', findPresentationType("any"))), - table: "mjolnir", + table: "draupnir", command: async function() { - return Ok(findCommandTable("mjolnir")) + return Ok(findCommandTable("draupnir")) }, designator: ["help"], summary: "Display this message" }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "help"), + interfaceCommand: findTableCommand("draupnir", "help"), renderer: async function(client, commandRoomId, event, result: ActionResult) { if (isError(result)) { throw new TypeError("This command isn't supposed to fail"); diff --git a/src/commands/ImportCommand.ts b/src/commands/ImportCommand.ts index 5fe9fbb5..a4e2afc8 100644 --- a/src/commands/ImportCommand.ts +++ b/src/commands/ImportCommand.ts @@ -85,7 +85,7 @@ export async function importCommand( defineInterfaceCommand({ designator: ["import"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "import from room", @@ -101,6 +101,6 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "import"), + interfaceCommand: findTableCommand("draupnir", "import"), renderer: tickCrossRenderer }) diff --git a/src/commands/KickCommand.tsx b/src/commands/KickCommand.tsx index d23eeef9..9e62e019 100644 --- a/src/commands/KickCommand.tsx +++ b/src/commands/KickCommand.tsx @@ -103,7 +103,7 @@ export async function kickCommand( defineInterfaceCommand({ designator: ["kick"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "user", @@ -137,7 +137,7 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "kick"), + interfaceCommand: findTableCommand("draupnir", "kick"), renderer: async function (this, client, commandRoomdID, event, result: ActionResult) { tickCrossRenderer.call(this, client, commandRoomdID, event, result); if (isError(result)) { diff --git a/src/commands/PermissionCheckCommand.ts b/src/commands/PermissionCheckCommand.ts index b9173604..ef6cb808 100644 --- a/src/commands/PermissionCheckCommand.ts +++ b/src/commands/PermissionCheckCommand.ts @@ -34,7 +34,7 @@ import { tickCrossRenderer } from "./interface-manager/MatrixHelpRenderer"; defineInterfaceCommand({ designator: ["verify"], - table: "mjolnir", + table: "draupnir", parameters: parameters([]), command: async function (this: DraupnirContext, _keywords: ParsedKeywords): Promise> { const enabledProtection = this.draupnir.protectedRoomsSet.protections.allProtections; @@ -53,6 +53,6 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "verify"), + interfaceCommand: findTableCommand("draupnir", "verify"), renderer: tickCrossRenderer }) diff --git a/src/commands/ProtectionsCommands.tsx b/src/commands/ProtectionsCommands.tsx index c8d9f018..9d3b9350 100644 --- a/src/commands/ProtectionsCommands.tsx +++ b/src/commands/ProtectionsCommands.tsx @@ -39,7 +39,7 @@ import { renderMatrixAndSend } from "./interface-manager/DeadDocumentMatrix"; defineInterfaceCommand({ designator: ["protections", "enable"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: 'protection name', @@ -75,13 +75,13 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "protections", "enable"), + interfaceCommand: findTableCommand("draupnir", "protections", "enable"), renderer: tickCrossRenderer }); defineInterfaceCommand({ designator: ["protections", "disable"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: 'protection name', @@ -104,7 +104,7 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "protections", "disable"), + interfaceCommand: findTableCommand("draupnir", "protections", "disable"), renderer: tickCrossRenderer }); @@ -127,7 +127,7 @@ interface SettingChangeSummary> { const enabledProtections = this.draupnir.protectedRoomsSet.protections.allProtections; @@ -357,7 +357,7 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "protections"), + interfaceCommand: findTableCommand("draupnir", "protections"), renderer: async function(client, commandRoomID, event, result: ActionResult) { await tickCrossRenderer.call(this, client, commandRoomID, event, result); if (isError(result)) { diff --git a/src/commands/RedactCommand.ts b/src/commands/RedactCommand.ts index 63670c29..bfb3f030 100644 --- a/src/commands/RedactCommand.ts +++ b/src/commands/RedactCommand.ts @@ -79,7 +79,7 @@ export async function redactCommand( defineInterfaceCommand({ designator: ["redact"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "entity", @@ -117,6 +117,6 @@ defineInterfaceCommand({ }); defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "redact"), + interfaceCommand: findTableCommand("draupnir", "redact"), renderer: tickCrossRenderer }) diff --git a/src/commands/ResolveAlias.tsx b/src/commands/ResolveAlias.tsx index a0dca9d8..01fecf13 100644 --- a/src/commands/ResolveAlias.tsx +++ b/src/commands/ResolveAlias.tsx @@ -44,7 +44,7 @@ async function resolveAliasCommand( } defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["resolve"], parameters: parameters([{ name: "alias", @@ -55,7 +55,7 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "resolve"), + interfaceCommand: findTableCommand("draupnir", "resolve"), renderer: async function(this, client, commandRoomID, event, result: ActionResult) { if (isError(result)) { await tickCrossRenderer.call(this, client, commandRoomID, event, result); diff --git a/src/commands/Rooms.tsx b/src/commands/Rooms.tsx index aabbaccd..906dd5d5 100644 --- a/src/commands/Rooms.tsx +++ b/src/commands/Rooms.tsx @@ -37,7 +37,7 @@ import { ActionException, ActionExceptionKind, ActionResult, MatrixRoomID, Matri import { resolveRoomReferenceSafe } from "matrix-protection-suite-for-matrix-bot-sdk"; defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["rooms"], summary: "List all of the protected rooms.", parameters: parameters([]), @@ -58,7 +58,7 @@ function renderProtectedRooms(rooms: MatrixRoomID[]): DocumentNode { } defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "rooms"), + interfaceCommand: findTableCommand("draupnir", "rooms"), renderer: async function (client, commandRoomId, event, result: ActionResult) { tickCrossRenderer.call(this, ...arguments); if (isError(result)) { @@ -72,7 +72,7 @@ defineMatrixInterfaceAdaptor({ }) defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["rooms", "add"], summary: "Protect the room using the watched policy lists, banning users and synchronizing server ACL.", parameters: parameters([ @@ -96,7 +96,7 @@ defineInterfaceCommand({ }) defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["rooms", "remove"], summary: "Stop protecting the room and leave.", parameters: parameters([ @@ -132,7 +132,7 @@ defineInterfaceCommand({ for (const designator of [["rooms", "add"], ["rooms", "remove"]]) { defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", ...designator), + interfaceCommand: findTableCommand("draupnir", ...designator), renderer: tickCrossRenderer, }) } diff --git a/src/commands/Rules.tsx b/src/commands/Rules.tsx index eb150c76..154948df 100644 --- a/src/commands/Rules.tsx +++ b/src/commands/Rules.tsx @@ -83,7 +83,7 @@ export interface ListMatches { defineInterfaceCommand({ designator: ["rules"], - table: "mjolnir", + table: "draupnir", parameters: parameters([]), command: async function (this: DraupnirContext): Promise> { const infoResult = await listInfo(this.draupnir); @@ -102,13 +102,13 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "rules"), + interfaceCommand: findTableCommand("draupnir", "rules"), renderer: renderListMatches }) defineInterfaceCommand({ designator: ["rules", "matching"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "entity", @@ -140,6 +140,6 @@ defineInterfaceCommand({ // I'm pretty sure that both commands could merge and use the same rendeer. defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "rules", "matching"), + interfaceCommand: findTableCommand("draupnir", "rules", "matching"), renderer: renderListMatches }) diff --git a/src/commands/SetDisplayNameCommand.ts b/src/commands/SetDisplayNameCommand.ts index 97355782..2183a86d 100644 --- a/src/commands/SetDisplayNameCommand.ts +++ b/src/commands/SetDisplayNameCommand.ts @@ -7,7 +7,7 @@ import { ActionError, ActionResult, Ok } from "matrix-protection-suite"; defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["displayname"], summary: "Sets the displayname of the draupnir instance to the specified value in all rooms.", parameters: parameters( @@ -34,6 +34,6 @@ export async function execSetDisplayNameCommand(this: DraupnirContext, _keywords } defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "displayname"), + interfaceCommand: findTableCommand("draupnir", "displayname"), renderer: tickCrossRenderer }) diff --git a/src/commands/SetPowerLevelCommand.ts b/src/commands/SetPowerLevelCommand.ts index 369b862e..0f825837 100644 --- a/src/commands/SetPowerLevelCommand.ts +++ b/src/commands/SetPowerLevelCommand.ts @@ -56,7 +56,7 @@ async function setPowerLevelCommand( } defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["powerlevel"], parameters: parameters([ { diff --git a/src/commands/StatusCommand.tsx b/src/commands/StatusCommand.tsx index aea7a489..732d4689 100644 --- a/src/commands/StatusCommand.tsx +++ b/src/commands/StatusCommand.tsx @@ -39,7 +39,7 @@ import { DocumentNode } from "./interface-manager/DeadDocument"; defineInterfaceCommand({ designator: ["status"], - table: "mjolnir", + table: "draupnir", parameters: parameters([]), command: async function (this: DraupnirContext): Promise> { return Ok(await draupnirStatusInfo(this.draupnir)) @@ -121,7 +121,7 @@ export function renderStatusInfo(info: StatusInfo): DocumentNode { } defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "status"), + interfaceCommand: findTableCommand("draupnir", "status"), renderer: async function (this, client, commandRoomID, event, result: ActionResult): Promise { if (isError(result)) { await tickCrossRenderer.call(this, client, commandRoomID, event, result); diff --git a/src/commands/Unban.ts b/src/commands/Unban.ts index 03c0d5d6..6214c35c 100644 --- a/src/commands/Unban.ts +++ b/src/commands/Unban.ts @@ -110,7 +110,7 @@ async function unban( defineInterfaceCommand({ designator: ["unban"], - table: "mjolnir", + table: "draupnir", parameters: parameters([ { name: "entity", @@ -150,6 +150,6 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "unban"), + interfaceCommand: findTableCommand("draupnir", "unban"), renderer: tickCrossRenderer }) diff --git a/src/commands/WatchUnwatchCommand.ts b/src/commands/WatchUnwatchCommand.ts index a4affbc5..fdec298d 100644 --- a/src/commands/WatchUnwatchCommand.ts +++ b/src/commands/WatchUnwatchCommand.ts @@ -34,7 +34,7 @@ import { ActionResult, MatrixRoomReference, PropagationType, isError } from "mat import { resolveRoomReferenceSafe } from "matrix-protection-suite-for-matrix-bot-sdk"; defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["watch"], summary: "Watches a list and applies the list's assocated policies to draupnir's protected rooms.", parameters: parameters([ @@ -53,12 +53,12 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "watch"), + interfaceCommand: findTableCommand("draupnir", "watch"), renderer: tickCrossRenderer, }) defineInterfaceCommand({ - table: "mjolnir", + table: "draupnir", designator: ["unwatch"], summary: "Unwatches a list and stops applying the list's assocated policies to draupnir's protected rooms.", parameters: parameters([ @@ -77,6 +77,6 @@ defineInterfaceCommand({ }) defineMatrixInterfaceAdaptor({ - interfaceCommand: findTableCommand("mjolnir", "unwatch"), + interfaceCommand: findTableCommand("draupnir", "unwatch"), renderer: tickCrossRenderer, })