mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-06-04 06:41:18 +00:00
Make displaynames with spaces work
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { defineInterfaceCommand, findTableCommand } from "./interface-manager/InterfaceCommand";
|
||||
import { ParsedKeywords, findPresentationType, parameters } from "./interface-manager/ParameterParsing";
|
||||
import { ParsedKeywords, RestDescription, findPresentationType, parameters } from "./interface-manager/ParameterParsing";
|
||||
import { MjolnirContext } from "./CommandHandler";
|
||||
import { CommandError, CommandResult } from "./interface-manager/Validation";
|
||||
import { tickCrossRenderer } from "./interface-manager/MatrixHelpRenderer";
|
||||
@@ -10,19 +10,19 @@ defineInterfaceCommand({
|
||||
table: "mjolnir",
|
||||
designator: ["displayname"],
|
||||
summary: "Sets the displayname of the draupnir instance to the specified value in all rooms.",
|
||||
parameters: parameters([
|
||||
{
|
||||
name: 'displayname',
|
||||
acceptor: findPresentationType("string"),
|
||||
description: 'The displayname to set.'
|
||||
}
|
||||
]),
|
||||
parameters: parameters(
|
||||
[],
|
||||
new RestDescription<MjolnirContext>(
|
||||
"displayname",
|
||||
findPresentationType("string"),
|
||||
),
|
||||
),
|
||||
command: execSetDisplayNameCommand
|
||||
})
|
||||
|
||||
// !draupnir displayname <displayname>
|
||||
export async function execSetDisplayNameCommand(this: MjolnirContext, _keywords: ParsedKeywords, displayname: string): Promise<CommandResult<any>> {
|
||||
|
||||
export async function execSetDisplayNameCommand(this: MjolnirContext, _keywords: ParsedKeywords, displaynameParts: string[]): Promise<CommandResult<any>> {
|
||||
const displayname = displaynameParts.join(' ');
|
||||
try {
|
||||
await this.client.setDisplayName(displayname);
|
||||
} catch (e) {
|
||||
@@ -30,7 +30,6 @@ export async function execSetDisplayNameCommand(this: MjolnirContext, _keywords:
|
||||
return CommandError.Result(`Failed to set displayname to ${displayname}: ${message}`)
|
||||
}
|
||||
|
||||
|
||||
return CommandResult.Ok(undefined);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user