# callback\_DiscordMessageReceived()

## Description

This async function is called when a message is sent in a Discord Server you have integrated with Rocket Networking. Edit this function to change its functionality.

#### Syntax

```
callback_DiscordMessageReceived(channelId , authorStruct , messageBody)
```

| Argument       | Description                                                                         |
| -------------- | ----------------------------------------------------------------------------------- |
| `channelId`    | <p>The id of the channel where the message was received.<br>This is an String .</p> |
| `authorStruct` | A struct that returns all the information about the author of this message.         |
| `messageBody`  | <p>Message body.<br>This is a string.</p>                                           |

#### Author Struct Example

```json
{
  "bot": 0,
  "system": 0,
  "flags": 0,
  "username": "lilshake21",
  "globalName": "lilshake",
  "discriminator": "0",
  "avatar": "330e1da8c68f4b84e902b369b7bb482a",
  "avatarDecoration": null,
  "createdTimestamp": 1502806211501.00,
  "defaultAvatarURL": "https://cdn.discordapp.com/embed/avatars/5.png",
  "tag": "lilshake21",
  "avatarURL": "https://cdn.discordapp.com/avatars/347019145122152448/330e1da8c68f4b84e902b369b7bb482a.webp",
  "displayAvatarURL": "https://cdn.discordapp.com/avatars/347019145122152448/330e1da8c68f4b84e902b369b7bb482a.webp",
  "id": "347019145122152448"
}

```

#### Returns

```
N/A
```

## Example Implementation

```
function callback_DiscordMessageReceived(channelId , authorStruct , messageBody){
	show_message("Received a message "+messageBody+" from author")
	show_message(authorStruct)

}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rocket-networking.gitbook.io/docs/rocket-networking-code/discord-integration/callback_discordmessagereceived.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
