Skip to main content

Streamplace rpg.actor game chatbot (Hopper)

Be your own Streamplace chatbot to reply the game data from someone, using rpg.actor data

place.stream.chat.message
Lexicon
place.stream.chat.message
Operations
Record created
Watched repos
All repos

Steps (6)

Variablegame
Value
hopper
Note
The game name/code (must match the lexicon object)
Conditionbranch
  • If event.commit.record.streamer equals {{self}} - Chat message was sent in my channel
  • and event.commit.record.text equals !{{game}} - Command trigger
Then
Fetch recordGameData- Fetches the game data
Lookup
at://{{event.did}}/actor.rpg.stats/{{game}}
Conditionbranch
  • If GameData.found equals true - The game data exists
Then

Create a recordAction 1ReplyMessage

Target Collection
place.stream.chat.message
Record Template
{
  "$type": "place.stream.chat.message",
  "createdAt": "{{now}}",
  "reply": {
    "parent": {
      "cid": "{{event.commit.cid}}",
      "uri": "{{event.uri}}"
    },
    "root": {
      "cid": "{{event.commit.cid}}",
      "uri": "{{event.uri}}"
    }
  },
  "streamer": "{{self}}",
  "text": "Your {{game}} highscore - Fast: {{GameData.record.data.fast.best}} | Faster: {{GameData.record.data.faster.best}}"
}
$type is set to the target collection when the record is written.
Otherwise

Create a recordAction 2NoDataMessage

Target Collection
place.stream.chat.message
Record Template
{
  "$type": "place.stream.chat.message",
  "createdAt": "{{now}}",
  "reply": {
    "parent": {
      "cid": "{{event.commit.cid}}",
      "uri": "{{event.uri}}"
    },
    "root": {
      "cid": "{{event.commit.cid}}",
      "uri": "{{event.uri}}"
    }
  },
  "streamer": "{{self}}",
  "text": "Looks like you never played {{game}}, no data found."
}
$type is set to the target collection when the record is written.