Skip to content
This repository was archived by the owner on Dec 26, 2019. It is now read-only.

Developers

Austin Huang edited this page Aug 3, 2017 · 11 revisions

Participating

If your bot has a global currency (Not guild-specific currency, as they are hard to control) and has joined at least 50 servers, you can apply.

We will value your currency based on methods to earn/use it. Then we'll discuss an exchange rate and issue the token for API use.

Technology

A central API is used so that each participating bot can send requests and receive requests to process transactions.

Let's say a user wants to exchange A bot currency to B bot currency.

  1. The user requests exchanging on A bot
  2. In the API, A bot sends a message indicates that a transaction has been started.
  3. API converts the currency and leaves a message waiting for B bot to pick up.
  4. B bot picks the message up and finishes the transaction.
  5. The user is notified by B bot indicates that the transaction has been finished.

Obligation on participating developers

  1. Participating developers should not abuse their privilege of manipulating the currency, including but not limited to adding a high amount of currency to themselves and convert them into other currencies. Violators will be banned from this program.
  2. When a user requests a transaction on your bot, your bot must send back the full callback content.

API

API source can be found in this repo.

Note

For any request, if you received status code 502 or 503, the API is offline. It'll be back up in a few minutes but please still notify austinhuang#1076.

Start a transaction

GET https://discoin.disnodeteam.com/transaction/:user/:amount/:to

Header

  • Authorization: Your token.
  • Json: Boolean, true = return JSON on success.

Params

  • User: User ID of the user who started the transaction.
  • Amount: Raw amount in your currency
  • To: Destination currency code

Result

Plain text: Either an info starting with Approved., a transaction rejection starting with [Decline] or an error starting with [ERROR]. You can (and you should) send the full text to the user.

JSON: Either a JSON object stated below, or a plaintext error stated above.

{
  "user": "155784937511976960",
  "receipt": "QNJbxRipM4P9lIyRDet1",
  "limitNow": 4999,
  "currency": "EGX"
}

Receive unprocessed transactions

GET https://discoin.disnodeteam.com/transaction

Header

  • Authorization: Your token.

Result

Either a JSON array of unprocessed transactions, or a plain text error starting with [ERROR].

Example

Clone this wiki locally