botserver/docs/src/chapter-05/keyword-get-bot-memory.md

26 lines
558 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GET_BOT_MEMORY Keyword
**Syntax**
```
GET_BOT_MEMORY "key"
```
**Parameters**
- `"key"` The memory key to retrieve.
**Description**
`GET_BOT_MEMORY` reads a value stored in the bots persistent memory table (`bot_memories`). It returns the stored string or an empty string if the key does not exist.
**Example (from `auth.bas`)**
```basic
SET attempts = GET_BOT_MEMORY "login_attempts"
IF attempts = "" THEN
SET attempts = "0"
ENDIF
```
The script fetches the number of previous login attempts, defaulting to zero if the key is missing.