0.1.1 • Published 11 months ago

substreams-sink-discord v0.1.1

Weekly downloads
-
License
MIT OR Apache-2.0
Repository
github
Last release
11 months ago

Substreams Discord CLI Node.js

substreams-sink-discord is a tool that allows developers to pipe data extracted from a blockchain to the Discord messaging social platform.

📖 Documentation

Further resources

Protobuf

CLI

Use pre-built binaries

  • MacOS
  • Linux
  • Windows

Install globally via npm

$ npm install -g substreams-sink-discord

Run

$ substreams-sink-discord run [options] <spkg>

Formatting

Supports JSON and YAML format for configuration file. Example of config.json format configuration file:

[
    {
        "entity": "Transfer",
        "type": "channel",
        "tts": true,
        "chat_ids": [
            "1098279427617603636"
        ],
        "message": "Hello channel! This **{user_id}** made a __transaction__ with id `{trx_id}`"
    },
    {
        "entity": "Transfer",
        "type": "user",
        "chat_ids": [
            "969082968410816632"
        ],
        "message": "Hello user! This **{user_id}** made a __transaction__ with id `{trx_id}`"
    },
    {
        "entity": "Grant",
        "chat_ids": [
            "1098279427617603636"
        ],
        "message": "This ||{grant}||",
        "embed": {
            "title": "Embed message title {user_id}",
            "description": "Embed message description {user_id}"
        }
    }
]

Text between {} are field names and are used as labels for message templating. In the example above, all EntityChanges messages coming from the substream with entity key having Transfer as value, will be sent to Discord channel or thread with id 1098279427617603636, as specified in the first json object.

Features

Substreams

  • Consume *.spkg from:
    • Load URL or IPFS
    • Read from *.spkg local filesystem
    • Read from substreams.yaml local filesystem
  • Handle cursor restart

Discord

  • Handle rate limit
  • Markdown message parsing
  • Embed message support