# computer.spaces.message

> One message in a chat at spaces.computer. Stored in the sender's own repo inside the chat space. Shown in the order of createdAt, then the record key. Deleting it removes it for everyone in the chat. Editing rewrites the record in place and sets editedAt.

- Kind: record
- Record key: tid
- Authority: spaces.computer
- Lexicon: 1
- Published by [spaces.computer](https://lexicon.garden/identity/did:plc:fcup7ltuhyvyayda32fru55z), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:fcup7ltuhyvyayda32fru55z/computer.spaces.message)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:fcup7ltuhyvyayda32fru55z/computer.spaces.message/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:fcup7ltuhyvyayda32fru55z/computer.spaces.message/analytics)

## Record (`computer.spaces.message`)

Type: record · key tid

### Properties

- `attachments` (array): Files sent with the message.
  - Constraints: maxLength: 10
  - `items` (ref)
    - Reference: `#attachment`
- `createdAt` (string · datetime, required): When it was sent.
- `editedAt` (string · datetime): When the text was last changed. Absent when never edited.
- `facets` (array): Links, mentions and tags in the text, each marked by where it starts and ends.
  - Constraints: maxLength: 100
  - `items` (ref)
    - Reference: `#facet`
- `replyTo` (string): The message this one answers: its record URI inside the chat space, at:space/{authority}/computer.spaces.chat/{key}/{writer}/computer.spaces.message/{rkey}.
  - Constraints: maxLength: 2048
- `text` (string, required): The message.
  - Constraints: maxLength: 10000, maxGraphemes: 3000

## #attachment (`computer.spaces.message#attachment`)

Type: object

A file sent with a message.

### Properties

- `alt` (string): A description of the file for people who cannot see it.
  - Constraints: maxLength: 5000, maxGraphemes: 1000
- `file` (blob, required): The file, up to 10 MB.
  - Constraints: maxSize: 10485760, accept: */*
- `name` (string): The filename.
  - Constraints: maxLength: 512, maxGraphemes: 128

## #byteSlice (`computer.spaces.message#byteSlice`)

Type: object

Where a span starts and ends, in UTF-8 bytes of the text: start inclusive, end exclusive.

### Properties

- `byteEnd` (integer, required)
  - Constraints: minimum: 0
- `byteStart` (integer, required)
  - Constraints: minimum: 0

## #facet (`computer.spaces.message#facet`)

Type: object

A span of the text and what it is.

### Properties

- `features` (array, required)
  - Constraints: maxLength: 4
  - `items` (union)
    - One of: `#link`, `#mention`, `#tag`
- `index` (ref, required)
  - Reference: `#byteSlice`

## #link (`computer.spaces.message#link`)

Type: object

The span is a link.

### Properties

- `uri` (string · uri, required)
  - Constraints: maxLength: 2048

## #mention (`computer.spaces.message#mention`)

Type: object

The span names an account.

### Properties

- `did` (string · did, required)

## #tag (`computer.spaces.message#tag`)

Type: object

The span is a tag, written without its leading hash.

### Properties

- `tag` (string, required)
  - Constraints: maxLength: 640, maxGraphemes: 64

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "attachment": {
      "description": "A file sent with a message.",
      "properties": {
        "alt": {
          "description": "A description of the file for people who cannot see it.",
          "maxGraphemes": 1000,
          "maxLength": 5000,
          "type": "string"
        },
        "file": {
          "accept": [
            "*/*"
          ],
          "description": "The file, up to 10 MB.",
          "maxSize": 10485760,
          "type": "blob"
        },
        "name": {
          "description": "The filename.",
          "maxGraphemes": 128,
          "maxLength": 512,
          "type": "string"
        }
      },
      "required": [
        "file"
      ],
      "type": "object"
    },
    "byteSlice": {
      "description": "Where a span starts and ends, in UTF-8 bytes of the text: start inclusive, end exclusive.",
      "properties": {
        "byteEnd": {
          "minimum": 0,
          "type": "integer"
        },
        "byteStart": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "byteStart",
        "byteEnd"
      ],
      "type": "object"
    },
    "facet": {
      "description": "A span of the text and what it is.",
      "properties": {
        "features": {
          "items": {
            "refs": [
              "#link",
              "#mention",
              "#tag"
            ],
            "type": "union"
          },
          "maxLength": 4,
          "type": "array"
        },
        "index": {
          "ref": "#byteSlice",
          "type": "ref"
        }
      },
      "required": [
        "index",
        "features"
      ],
      "type": "object"
    },
    "link": {
      "description": "The span is a link.",
      "properties": {
        "uri": {
          "format": "uri",
          "maxLength": 2048,
          "type": "string"
        }
      },
      "required": [
        "uri"
      ],
      "type": "object"
    },
    "main": {
      "description": "One message in a chat at spaces.computer. Stored in the sender's own repo inside the chat space. Shown in the order of createdAt, then the record key. Deleting it removes it for everyone in the chat. Editing rewrites the record in place and sets editedAt.",
      "key": "tid",
      "record": {
        "properties": {
          "attachments": {
            "description": "Files sent with the message.",
            "items": {
              "ref": "#attachment",
              "type": "ref"
            },
            "maxLength": 10,
            "type": "array"
          },
          "createdAt": {
            "description": "When it was sent.",
            "format": "datetime",
            "type": "string"
          },
          "editedAt": {
            "description": "When the text was last changed. Absent when never edited.",
            "format": "datetime",
            "type": "string"
          },
          "facets": {
            "description": "Links, mentions and tags in the text, each marked by where it starts and ends.",
            "items": {
              "ref": "#facet",
              "type": "ref"
            },
            "maxLength": 100,
            "type": "array"
          },
          "replyTo": {
            "description": "The message this one answers: its record URI inside the chat space, at:space/{authority}/computer.spaces.chat/{key}/{writer}/computer.spaces.message/{rkey}.",
            "maxLength": 2048,
            "type": "string"
          },
          "text": {
            "description": "The message.",
            "maxGraphemes": 3000,
            "maxLength": 10000,
            "type": "string"
          }
        },
        "required": [
          "text",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "mention": {
      "description": "The span names an account.",
      "properties": {
        "did": {
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "did"
      ],
      "type": "object"
    },
    "tag": {
      "description": "The span is a tag, written without its leading hash.",
      "properties": {
        "tag": {
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        }
      },
      "required": [
        "tag"
      ],
      "type": "object"
    }
  },
  "id": "computer.spaces.message",
  "lexicon": 1
}
```
