Skip to content

Instantly share code, notes, and snippets.

@zinntikumugai
Last active July 19, 2018 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinntikumugai/0f3b386f2426150354378da2017a207b to your computer and use it in GitHub Desktop.
Save zinntikumugai/0f3b386f2426150354378da2017a207b to your computer and use it in GitHub Desktop.
DOSANCOIN BOT Core

対応プラットホームをDiscordのみとする(とりま)
下記はCore部分のみ
ETHもトークンとして扱う
$***は変数

class Token
    name: 名前
    code: 通貨コード
    balance: 残高

class User 
    id:unique
    discordId:ディスコードのid
    ETH: $Token (めんどいのでETHもトークンとして扱う)
    tokens: Array $Token
    last_commands:Array 最後のコマンド実行日時(コマンドごと)
    address:入金用ETHアドレス

response

{
    "status": "OK", //コマンドが実行できたか
    "command": "$CommandName"
    "$CommandName" : $CommandData,
    "user": $UserData
}
{
    "status": "Faild",
    "errer": {
        "errer_type": "CommandNotFound"
    },
    "user": $UserData
}

errers

  • CommandNotFound
  • IdNotFound

GET /search/$discordId

システム上id検索、なければ新規作成

"search": {
    "status": "found",
    "id": 12
}
"search": {
    "status": "regsted",
    "id": 13
}

GET /balance/$id

残高表示

"balance": {
    "eth": 123,
    "dos": 5555555
}

GET /tip/$id/$price/$tipUserId

投げ銭 $id が $price分 $tipuserId に投げる

"tip": {
    "send_id": 12,
    "token": {
        "name": "eth",
        "price": 12
    },
    "resive_id": 13
}

GET /rain/$id/$price

$idが $price 対象ユーザーに対し 撒き銭
(受け取りは確定、フィルターは受取時、バラマキ額は受け取り人数のみ、余剰分は戻される)
1354 dos を 123人で 一人あたり 11 dos ばら撒き

"rain": {
    "send_id": 12,
    "token": {
        "name": "dos",
        "price": 1354
    },
    "resive": {
        "length": 123,
        "price": 11
    }
}

GET /depsit/$id/

アドレス取得

"depsit": {
    "address": "0x123456ef7...43"
}

GET /withdraw/$id/$price/$tokenCode/$address

$id の残高より $price 分 $address に出金

"withdraw": {
    "tokens": [
        {
            "name": "dos",
            "price": 123456
        },
        {
            "name": "eth",  //多分手数料
            "price": 0.0001
        }
    ],
    "tx": "0x132036464f6a4...f6a4865efafda"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment