# $awaitMessage

### Usage

```php
$awaitMessage[channelID;userFilter;time;errorMessage;response1;output1;response2;output2;...etc]
```

This function has five params.

| Param        | Description                                                                                                               | Type                | Required |
| ------------ | ------------------------------------------------------------------------------------------------------------------------- | ------------------- | -------- |
| channelID    | The channel to await messages in.                                                                                         | Snowflake           | Yes      |
| userFilter   | List of user IDs that the bot awaits the message for (separated by commas). Use `everyone` to await any incoming message. | Snowflake \| String | Yes      |
| time         | How long to await the user's message, before returning `errorMessage`.                                                    | Time                | Yes      |
| errorMessage | The error to return when `time` is up, and no response has been provided.                                                 | String              | No       |
| output       | The message response followed by the code to execute.                                                                     | String              | Yes      |

### Example

```javascript
bot.commands.add({
    type: "basicCommand",
    name: "example",
    code: `
$awaitMessage[$channelID;everyone;1m;
        $channelSendMessage[$channelID;$makeReturn[
                No one replied with a valid input.
            ]]
        ;hello;
            $channelSendMessage[$channelID;$makeReturn[
                Hello, <@$get[message_author_id]>!
            ]]
        ;uwu;
            $channelSendMessage[$channelID;$makeReturn[
                UwU, <@$get[message_author_id]>!
            ]]
        ]
`
})
```


---

# 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://dbd-ts.gitbook.io/dbdts/functions/awaitmessage.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.
