|
8 months ago | |
---|---|---|
choin | 8 months ago | |
.gitignore | 1 year ago | |
Dockerfile | 1 year ago | |
README.md | 8 months ago | |
setup.py | 8 months ago |
Falchoin bot and api.
pip3 install git+ssh://git@cfbrk.de/code.mtib.dev/falchoin.git#egg=falchoin
Move into a working directory that falchoin is supposed to use and create a secrets.json file, then run falchoin
.
pip3 install -e .
TAG=0.0.1
docker build -t "falchoin:$TAG" .
You need to create a directory for falchoin to use for storing the database and a file in that directory for configuration. The following commands assume this directory is $PWD/secrets
.
CONF_DIR="$PWD/secrets"
OUT_PORT=7473
TAG=0.0.1
docker run -it -v $CONF_DIR:/app -p 7473:$OUT_PORT --rm falchoin:$TAG
Assuming you have a file "secrets.json" the form:
{
"client_id": "[client_id]",
"client_secret": "[discord-secret]",
"client_token": "<discord-token>"
}
running the container will create a "fcoin.db" in your secrets folder. This allows persistence between runs.
Returns transaction details and status.
Returns user details, balance and outstanding (unaccepted) transactions.
Returns list of all users.
Returns list of all transactions.
Sends money using your secret key.
With body:
{
"from": "sender-id",
"to": "receiver-id",
"key": "sender-key",
"amount": 1337
}
Posts a request for money transfer.
With body:
{
"from": "sender-id",
"to": "receiver-id",
"key": "receiver-key",
"webhook": "url (optional)",
"amount": 1337
}
Will cause the bot to contact the sender with the info and require authentication.
Immediate Response
{
"success": true,
"id": "transaction-id"
}
Then the application will have to regularly check the transaction ID for fulfilment (before sending whatever was paid). The server will send a POST request to the provided webhook as soon as the sender has accepted or refused. The body is identical to the updated /v1/transactions/transaction-id.
Responds to a requested money transfer.
This way if someone requests you to send them money you can programmatically accept. Maybe we could even let users register webhooks for when they receive a request. This uses the secret key of the money-sender. This key can only be received from the discord bot by using the secret
command.
{
"id": "transaction-id",
"key": "sender-key",
"accept": true
}