Add HS capability check

This commit is contained in:
bxdxnn
2026-05-29 18:18:12 +00:00
parent 64b6a1523d
commit 4c1a167e2b
@@ -99,6 +99,14 @@ class DefaultSlashCommandService(
override suspend fun proceedAdmin(
slashCommand: SlashCommand.SlashCommandAdmin,
): Result<Unit> {
if (slashCommand is SlashCommand.ChangeDisplayNameForRoom) {
val canUserChangeDisplayName = withTimeoutOrNull(5.seconds) {
capabilitiesProvider.canChangeDisplayName().getOrNull()
} ?: false
if (!canUserChangeDisplayName) {
return Result.failure(Exception("Changing display name is not allowed"))
}
}
return commandExecutor.proceedAdmin(
slashCommand = slashCommand,
)