https://github.com/drewolson/bridge-diagrams
Generate plain text bridge diagrams
https://github.com/drewolson/bridge-diagrams
Last synced: 8 months ago
JSON representation
Generate plain text bridge diagrams
- Host: GitHub
- URL: https://github.com/drewolson/bridge-diagrams
- Owner: drewolson
- License: other
- Created: 2021-10-23T20:01:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-26T01:02:18.000Z (over 1 year ago)
- Last Synced: 2024-11-26T02:18:10.023Z (over 1 year ago)
- Language: Haskell
- Size: 123 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```