Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/drewolson/bridge-diagrams

Generate plain text bridge diagrams
https://github.com/drewolson/bridge-diagrams

Last synced: 1 day ago
JSON representation

Generate plain text bridge diagrams

Awesome Lists containing this project

README

        

# Bridge Diagrams

A CLI, Discord bot, and Slack bot for generating plain-text bridge diagrams.

## Build

```
$ stack build
```

## Test

```
$ stack test
```

## Run

### CLI

The CLI reads input from `stdin`:

```
$ stack run bridge-cli-exe -- --help
```

```
$ stack run bridge-cli-exe <<< 'akxxx qtx - qjxxx'
♠AKxxx
♥QTx

♣QJxxx

$ stack run bridge-cli-exe <<< 't987 6543 - 76532; akqj akqj ak kj9; - - q8765432 aqt84; 65432 t9872 jt9 -, r/r, imps'
Vul: R/R ♠T987
IMPs ♥6543

♣76532
♠65432 ----- ♠AKQJ
♥T9872 | N | ♥AKQJ
♦JT9 |W E| ♦AK
♣ | S | ♣KJ9
-----


♦Q8765432
♣AQT84
```

### Discord

The Discord bot needs a `DISCORD_TOKEN` with scopes that allow for connecting to
the server, sending messages, and managing messages.

```
DISCORD_TOKEN= stack run bridge-discord-exe
```

Once associated with a server, messages prefixed with `!bridge` will be handled
by the bot.

```
!bridge akxxx qtx - qjxxx
```

### Slack

The Slack bot uses [socket mode](https://api.slack.com/apis/connections/socket)
and needs a [bot token](https://api.slack.com/authentication/token-types#bot)
and a [user token](https://api.slack.com/authentication/token-types#user).

The bot token needs the following scopes:

* chat:write
* chat:write.customize
* chat:write.public
* commands

The user token needs the following scopes:

* chat:write

```
SLACK_TOKEN= SLACK_USER_TOKEN= stack run bridge-slack-exe
```

The bot should be installed as a slash command. I tend to choose `/bridge` as
the command. Messages can then be sent to the bot via the slash command.

```
/bridge akxxx qtx - qjxxx
```