Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/pinax-network/substreams-sink-discord

Pipes data extracted from a blockchain to Discord
https://github.com/pinax-network/substreams-sink-discord

Last synced: about 2 months ago
JSON representation

Pipes data extracted from a blockchain to Discord

Lists

README

        

# [`Substreams`](https://substreams.streamingfast.io/) [Discord](https://discord.com/) 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

- [**Substreams** documentation](https://substreams.streamingfast.io)
- [**Discord** API documentation](https://discord.com/developers/docs/intro)

### Protobuf

- [`sf.substreams.entity.v1.EntityChanges`](https://github.com/streamingfast/substreams-entity-change/blob/develop/proto/entity/v1/entity.proto)

## CLI
[**Use pre-built binaries**](https://github.com/pinax-network/substreams-sink-discord/releases)
- [x] MacOS
- [x] Linux
- [x] Windows

**Install** globally via npm
```
$ npm install -g substreams-sink-discord
```

**Run**
```
$ substreams-sink-discord run [options]
```

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

```json
[
{
"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](https://discord.com/) channel or thread with id `1098279427617603636`, as specified in the first json object.

## Features

### Substreams

- Consume `*.spkg` from:
- [x] Load URL or IPFS
- [ ] Read from `*.spkg` local filesystem
- [ ] Read from `substreams.yaml` local filesystem
- [x] Handle `cursor` restart

### Discord
- [x] Handle rate limit
- [x] Markdown message parsing
- [x] Embed message support