mautrix-go/event/botcommand.go
Tulir Asokan cd927c2796
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled
event: add types for MSC4332
2025-08-30 19:54:58 +03:00

45 lines
1.7 KiB
Go

// Copyright (c) 2025 Tulir Asokan
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package event
type BotCommandsEventContent struct {
Sigil string `json:"sigil,omitempty"`
Commands []*BotCommand `json:"commands,omitempty"`
}
type BotCommand struct {
Syntax string `json:"syntax"`
Aliases []string `json:"fi.mau.aliases,omitempty"` // Not in MSC (yet)
Arguments []*BotCommandArgument `json:"arguments,omitempty"`
Description *ExtensibleTextContainer `json:"description,omitempty"`
}
type BotArgumentType string
const (
BotArgumentTypeString BotArgumentType = "string"
BotArgumentTypeEnum BotArgumentType = "enum"
BotArgumentTypeInteger BotArgumentType = "integer"
BotArgumentTypeBoolean BotArgumentType = "boolean"
BotArgumentTypeUserID BotArgumentType = "user_id"
BotArgumentTypeRoomID BotArgumentType = "room_id"
BotArgumentTypeRoomAlias BotArgumentType = "room_alias"
BotArgumentTypeEventID BotArgumentType = "event_id"
)
type BotCommandArgument struct {
Type BotArgumentType `json:"type"`
DefaultValue any `json:"fi.mau.default_value,omitempty"` // Not in MSC (yet)
Description *ExtensibleTextContainer `json:"description,omitempty"`
Enum []string `json:"enum,omitempty"`
Variadic bool `json:"variadic,omitempty"`
}
type BotCommandInput struct {
Syntax string `json:"syntax"`
Arguments map[string]any `json:"arguments,omitempty"`
}