# Class TextMessage

文本消息

#### Version

1.0.0

#### Hierarchy (View Summary)

- MessageContent
  - TextMessage

- Defined in message/content/normal/TextMessage.ts:23

##### Index

### Constructors

constructor

### Properties

extra?
userInfo?
mentionedInfo?
rawString?
destructDuration?
content

### Methods

encodeBaseData
decodeBaseData
encode
decode
getClassName
getSearchableWord

## Constructors

### constructor

- new TextMessage(): TextMessage

  无参构造方法

  #### Returns TextMessage

  Overrides MessageContent.constructor

  - Defined in message/content/normal/TextMessage.ts:32

## Properties

### `Optional` extra

extra?: string

消息的附加信息，会随着消息发送出去

#### See

Message.extra

Inherited from MessageContent.extra

- Defined in message/content/MessageContent.ts:120

### `Optional` userInfo

userInfo?: UserInfo

消息携带的用户信息

Inherited from MessageContent.userInfo

- Defined in message/content/MessageContent.ts:124

### `Optional` mentionedInfo

mentionedInfo?: MentionedInfo

消息的 @ 信息

Inherited from MessageContent.mentionedInfo

- Defined in message/content/MessageContent.ts:128

### `Optional` rawString

rawString?: string

消息的原始内容

SDK 执行消息的 decode 方法正常时，会将数据解析到消息的各个字段，rawString 将会为空

如果 decode 方法异常时会将消息的原始数据保存在 rawString 中

Inherited from MessageContent.rawString

- Defined in message/content/MessageContent.ts:137

### `Optional` destructDuration

destructDuration?: number

阅后即焚时长，单位秒

    destructDuration <= 0 代表是普通消息
    destructDuration > 0 代表是阅后即焚消息，该消息已读后，经过 destructDuration 时间后销毁

#### Version

1.3.0

Inherited from MessageContent.destructDuration

- Defined in message/content/MessageContent.ts:147

### content

content: string = ''

文本内容

- Defined in message/content/normal/TextMessage.ts:27

## Methods

### encodeBaseData

- encodeBaseData(): HashMap<string, Object>

  将基类的基础数据保存到 map 中

  #### Returns HashMap<string, Object>

  Inherited from MessageContent.encodeBaseData

  - Defined in message/content/MessageContent.ts:195

### decodeBaseData

- decodeBaseData(map: HashMap<string, Object>): void

  将基类的基础数据从 map 中解析出来

  #### Parameters

  - map: HashMap<string, Object>

  #### Returns void

  Inherited from MessageContent.decodeBaseData

  - Defined in message/content/MessageContent.ts:216

### encode

- encode(): string

  编码方法，将消息转为 json 字符串

  #### Returns string

  json 字符串

  Overrides MessageContent.encode

  - Defined in message/content/normal/TextMessage.ts:40

### decode

- decode(contentString: string): void

  解码方法，将 json 字符串转为消息

  #### Parameters

  - contentString: string

    json 字符串

  #### Returns void

  Overrides MessageContent.decode

  - Defined in message/content/normal/TextMessage.ts:55

### getClassName

- getClassName(): string

  获取类名

  #### Returns string

  类名

  Overrides MessageContent.getClassName

  - Defined in message/content/normal/TextMessage.ts:67

### getSearchableWord

- getSearchableWord(): any

  实现搜索方法

  #### Returns any

  需要搜索的内容

  Overrides MessageContent.getSearchableWord

  - Defined in message/content/normal/TextMessage.ts:75