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

27 lines
558 B
Markdown
Raw Normal View History

# 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.