Falchoin bot and api. https://sh.cfbrk.de/fc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Markus Becker 536343718a Order falchoin list by balance 1 month ago
choin Order falchoin list by balance 1 month ago
.gitignore Documentation and docker 2 months ago
Dockerfile Documentation and docker 2 months ago
README.md HTTP API 2 months ago
setup.py Templating fixes #16 #15 #11 #9 #6 #5 #2 2 months ago

README.md

falchoin

Falchoin bot and api.

Usage

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.

Contributing

  1. Check out the repo.
pip3 install -e .
  1. Create a feature branch.
  2. Do changes.
  3. Commit.
  4. Create a merge request.

Docker

Build

TAG=0.0.1
docker build -t "falchoin:$TAG" .

Run

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.

API

All of this API is subject to change. The urls respond to GET requests and respond in json or plaintext.

Users can either be identified by their id, discord id or aliases. Note that users cannot currently be identified by aliases which contain a “#", “?” or “&".

/get/balance/user

Returns the current balance.

/get/logs

Returns json containing all transfers.

/get/user/user

Returns json about a single user.

/get/users

Returns json about all users.

/post/transfer/from/to/amount/key

Triggers a transfer. The key has to be the current valid key of the from-user. This will fail if any of the users cannot be found or the from-user has insufficient funds. This endpoint will very likely change soon. The key can be generated with the secret discord command, it will also automatically invalidate any old key.