> For the complete documentation index, see [llms.txt](https://docs.kuthulu.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kuthulu.xyz/contracts/messagedata.md).

# MessageData

### Table of Contents

1. [Events](#events)
2. [Public Functions](#public-functions)

***

## <mark style="color:purple;">Events</mark>

### logNewMsg

This event is triggered when a new message is posted. It logs the details of the message.

### logRemoveMsg

This event is triggered when a message is removed. It logs the ID of the message that was removed.

### logUpdateMsgStats

This event is triggered when the statistics of a message are updated. It logs the type of statistic, message ID, the updated value of the statistic, and tips.

***

### <mark style="color:purple;">Public Function</mark>

### getPoster

This function returns the address of the user or group that posted a specific message.

**Inputs**

| Name  | Type    | Description                                             | Example |
| ----- | ------- | ------------------------------------------------------- | ------- |
| msgID | uint256 | The ID of the message to check for the poster's address | 1       |

**Outputs**

| Name | Type    | Description                                       |
| ---- | ------- | ------------------------------------------------- |
|      | address | The address of the member that posted the message |

**Example**

Using ethers.js to call the `getPoster` function:

```javascript
const contract = new ethers.Contract(contractAddress, contractABI, provider);

let msgID = 1;

async function getPoster() {
    const poster = await contract.getPoster(msgID);
    console.log(`The message was posted by: ${poster}`);
}

getPoster();
```

***

### getInGroups

This function returns a list of group IDs in which a specific message was posted.

**Inputs**

| Name  | Type    | Description                        | Example |
| ----- | ------- | ---------------------------------- | ------- |
| msgID | uint256 | The ID of the message to check for | 1       |

**Outputs**

| Name | Type       | Description                                          |
| ---- | ---------- | ---------------------------------------------------- |
|      | uint256\[] | An array of group IDs that the message was posted in |

**Example**

Using ethers.js to call the `getInGroups` function:

```javascript
const contract = new ethers.Contract(contractAddress, contractABI, provider);

let msgID = 1;

async function getInGroups() {
    const groups = await contract.getInGroups(msgID);
    console.log(`The message was posted in groups: ${groups}`);
}

getInGroups();
```

***

### getMsgCommentLevel

This function returns the comment level of a post. If the return value is 0, comments are open. If the return value is 1, comments are closed.

**Inputs**

| Name  | Type    | Description                        | Example |
| ----- | ------- | ---------------------------------- | ------- |
| msgID | uint256 | The ID of the message to check for | 1       |

**Outputs**

| Name | Type    | Description                      |
| ---- | ------- | -------------------------------- |
|      | uint256 | The comment level of the message |

**Example**

Using ethers.js to call the `getMsgCommentLevel` function:

```javascript
const contract = new ethers.Contract(contractAddress, contractABI, provider);

let msgID = 1;

async function getMsgCommentLevel() {
    const commentLevel = await contract.getMsgCommentLevel(msgID);
    console.log(`The comment level of the message is: ${commentLevel}`);
}

getMsgCommentLevel();
```
