Streamplace rpg.actor game chatbot (Clun's Cannon)

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

Steps (6)

Variablegame
Value
clunscannon
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 !cannon - 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 1#1ReplyMessage

Target Collection
place.stream.chat.message
Record Template
{
  "createdAt": "{{now}}",
  "reply": {
    "parent": {
      "cid": "{{event.commit.cid}}",
      "uri": "{{event.uri}}"
    },
    "root": {
      "cid": "{{event.commit.cid}}",
      "uri": "{{event.uri}}"
    }
  },
  "streamer": "{{self}}",
  "text": "Your Clun's Cannon highscore: {{GameData.record.data.best}} ({{GameData.record.data.tries}} tries)"
}
Otherwise

Create a recordAction 2#2NoDataMessage

Target Collection
place.stream.chat.message
Record Template
{
  "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 Clun's Cannon, no data found."
}