diff --git a/apps/draupnir/src/appservice/bot/AppserviceBotCommands.ts b/apps/draupnir/src/appservice/bot/AppserviceBotCommands.ts index cf00012..5fc4d95 100644 --- a/apps/draupnir/src/appservice/bot/AppserviceBotCommands.ts +++ b/apps/draupnir/src/appservice/bot/AppserviceBotCommands.ts @@ -17,10 +17,12 @@ import { AppserviceListUnstartedCommand, AppserviceRestartDraupnirCommand, } from "./ListCommand"; +import { AppserviceVersionCommand } from "./VersionCommand"; AppserviceBotCommands.internCommand(AppserviceBotHelpCommand, ["admin", "help"]) .internCommand(AppserviceAllowCommand, ["admin", "allow"]) .internCommand(AppserviceRemoveCommand, ["admin", "remove"]) + .internCommand(AppserviceVersionCommand, ["admin", "version"]) .internCommand(AppserviceRestartDraupnirCommand, ["admin", "restart"]) .internCommand(AppserviceListUnstartedCommand, [ "admin", diff --git a/apps/draupnir/src/appservice/bot/VersionCommand.tsx b/apps/draupnir/src/appservice/bot/VersionCommand.tsx new file mode 100644 index 0000000..b1fc390 --- /dev/null +++ b/apps/draupnir/src/appservice/bot/VersionCommand.tsx @@ -0,0 +1,48 @@ +// Copyright 2026 Catalan Lover +// +// SPDX-License-Identifier: AFL-3.0 + +import { AppserviceAdaptorContext } from "./AppserviceBotPrerequisite"; +import { ActionResult, Ok, isError } from "matrix-protection-suite"; +import { + DeadDocumentJSX, + describeCommand, +} from "@the-draupnir-project/interface-manager"; +import { AppserviceBotInterfaceAdaptor } from "./AppserviceBotInterfaceAdaptor"; +import { CURRENT_BRANCH, SOFTWARE_VERSION } from "../../config"; + +type AppserviceVersionInfo = { + version: string; + branch: string; +}; + +export const AppserviceVersionCommand = describeCommand({ + summary: + "Show Draupnir version and branch information for this appservice deployment.", + parameters: [], + async executor( + _context: AppserviceAdaptorContext + ): Promise> { + return Ok({ + version: SOFTWARE_VERSION, + branch: CURRENT_BRANCH, + }); + }, +}); + +AppserviceBotInterfaceAdaptor.describeRenderer(AppserviceVersionCommand, { + JSXRenderer(result) { + if (isError(result)) { + return Ok(undefined); + } + return Ok( + + Version: + {result.ok.version} +
+ Branch: + {result.ok.branch} +
+ ); + }, +});