1.2.0 • Published 4 years ago

spacebots v1.2.0

Weekly downloads
63
License
MIT
Repository
-
Last release
4 years ago

This is a helper for the SBL API endpoint docs, which can be found here

Endpoints

Stat retrieval

GET /api/bots/:id

Returns information about a single bot whose user ID matches the id url param\

Response

A JSON structures as:

{
  id: string;                // The bot's user ID
  prefix: string;            // The bot's prefix
  owner: Array<string>;      // An array of the bot's owners' IDs, can sometimes be more than one ID
  library: string;           // The library the bot uses
  description: string;       // The bot's short description
  longDescription: string;   // The bot's long description
  certified: boolean;        // Whether the bot is certified or not
  pageURL: string;           // The bot's page on SBL
  website?: string;          // A URL leading to the bot's website
  support?: string;          // The code for the invite to the bot's support server
  github?: string;           // The bot's GitHub repository
  servers?: number;          // The bot's server count, (sometimes doesn't exist)
  users?: number;            // The bot's user count, (sometimes doesn't exist)
  votes: number;             // The amount of users that voted for the bot on the website, can be 0
}

Error

When there's no bot with the specified ID

Status code: 404 Not Found\ Response:

{
  "error": {
    "code": 404,
    "message": "A client with the given ID does not exist!"
  }
}

Stat posting

POST /api/bots/:id

Posts stats for the bot whose user ID matches the id url param\

Headers

  • Authorization | The SBL API key of the bot

Body

Should be a JSON structured as:

{
  guilds: number; // Bot's server count (required, can be 0)
  users?: number; // Bot's user count (optional, can't be 0)
}

Response

A JSON structured as:

{
  servers: number; // The newly-posted server count
  users?: number;  // The newly-posted / already stored user count, if exists
}

Error

When there's no bot with the specified ID

Status code: 404 Not Found\ Response:

{
  "error": {
    "code": 404,
    "message": "A client with the given ID does not exist!"
  }
}
When there's no Authorization header

Status code: 401 Unauthorized\ Response:

{
  "error": {
    "code": 401,
    "message": "No API key in headers!"
  }
}
When the Authorization header doesn't match the bots API key

Status code: 403 Forbidden\ Response:

{
  "error": {
    "code": 403,
    "message": "The provided API key is invalid!"
  }
}
When there's no guild count (guilds field) in the requests body

Status code: 400 Bad Request\ Response:

{
  "error": {
    "code": 400,
    "message": "No guild count in the request's body!"
  }
}
When the guild count (guilds field) in the requests body is not a number

Status code: 400 Bad Request\ Response:

{
  "error": {
    "code": 400,
    "message": "Invallid guild count in the request's body!"
  }
}
When the (optional) user count (users field) in the requests body is present and is not a number

Status code: 400 Bad Request\ Response:

{
  "error": {
    "code": 400,
    "message": "Invallid user count in the request's body!"
  }
}
1.2.0

4 years ago

1.0.0

4 years ago

1.1.0

4 years ago

0.5.0

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago