"use strict";
// SPDX-FileCopyrightText: 2026 Catalan Lover <catalanlover@protonmail.com>
//
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppserviceDisplaynameCommand = void 0;
const matrix_protection_suite_1 = require("matrix-protection-suite");
const interface_manager_1 = require("@the-draupnir-project/interface-manager");
const AppserviceBotInterfaceAdaptor_1 = require("./AppserviceBotInterfaceAdaptor");
const matrix_protection_suite_for_matrix_bot_sdk_1 = require("matrix-protection-suite-for-matrix-bot-sdk");
exports.AppserviceDisplaynameCommand = (0, interface_manager_1.describeCommand)({
    summary: "Sets the displayname of the main appservice admin bot.",
    parameters: [],
    rest: {
        name: "displayname",
        acceptor: interface_manager_1.StringPresentationType,
    },
    async executor(context, _info, _keywords, displaynameParts) {
        const displayname = displaynameParts.join(" ");
        const setDisplaynameResult = await context.client
            .setDisplayName(displayname)
            .then((_) => (0, matrix_protection_suite_1.Ok)(undefined), matrix_protection_suite_for_matrix_bot_sdk_1.resultifyBotSDKRequestError);
        if ((0, matrix_protection_suite_1.isError)(setDisplaynameResult)) {
            return setDisplaynameResult.elaborate(`Failed to set appservice bot displayname to ${displayname}`);
        }
        return setDisplaynameResult;
    },
});
AppserviceBotInterfaceAdaptor_1.AppserviceBotInterfaceAdaptor.describeRenderer(exports.AppserviceDisplaynameCommand, {
    isAlwaysSupposedToUseDefaultRenderer: true,
});
//# sourceMappingURL=DisplaynameCommand.js.map