-
-
Notifications
You must be signed in to change notification settings - Fork 26
6. REST
ByteBlaze provide an rest system to control the bot through http. This is for developing dashboard with an easy way for middle developer.
This doc will explain, providing example clearly for each endpoints
- Most routes require the
authorization
header with the configured password. - Example header:
authorization: youshallnotpass
- If the field title have
?
, that means data can nullable - If the endpoints have
[no-auth]
in the title, that means it can access withoutauthorization
header
This endpoints is for health check
Response:
Field | Type | Description |
---|---|---|
byteblaze | string | The random string |
Example response:
{
"byteblaze": "💀"
}
This endpoints is for get all command that avaliable on this bot
Response:
Field | Type | Description |
---|---|---|
data | Command array | The command array |
Example response:
{
"data": [
{
"name": "avatar",
"description": "Show your or someone else's profile picture",
"category": "Image",
"accessableby": "Member",
"usage": "<mention>",
"aliases": []
},
]
}
This endpoints is for get current player from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
guildId | string | The discord guild id have player |
loop | Mode string | The current loop mode |
member | isIn string | The status of current member (if user in voice or not) |
position | number | The current position |
current | Track object | The current track info |
queue | Track array | The current track queue |
Example response:
{
"guildId": "1027945618347397220",
"loop": "none",
"pause": false,
"member": "true",
"position": 90120,
"current": {
"title": "Bruno Mars - That’s What I Like [Official Music Video]",
"uri": "https://www.youtube.com/watch?v=PMivT7MJ41M",
"length": 211000,
"thumbnail": "https://i.ytimg.com/vi/PMivT7MJ41M/mqdefault.jpg",
"author": "Bruno Mars",
"requester": {
"id": "898728768791789628",
"username": "rainyxeon",
"globalName": "rainy w/🌧",
"defaultAvatarURL": "https://cdn.discordapp.com/embed/avatars/3.png"
}
},
"queue": []
}
This endpoints is for get current player loop state from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
data | Mode string | The current loop mode |
Example response:
{
"data": "none"
}
This endpoints is for get current player pause state from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
data | boolean | The current pause mode |
Example response:
{
"data": false
}
This endpoints is for get current player pause state from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
data | boolean | The current pause mode |
Example response:
{
"data": false
}
This endpoints is for get current player position state from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
data | number | The current position |
Example response:
{
"data": 5880
}
This endpoints is for get current track from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
data | Track object | The current track data |
Example response:
{
"data": {
"title": "Bruno Mars - That’s What I Like [Official Music Video]",
"uri": "https://www.youtube.com/watch?v=PMivT7MJ41M",
"length": 211000,
"thumbnail": "https://i.ytimg.com/vi/PMivT7MJ41M/mqdefault.jpg",
"author": "Bruno Mars",
"requester": {
"id": "898728768791789628",
"username": "rainyxeon",
"globalName": "rainy w/🌧",
"defaultAvatarURL": "https://cdn.discordapp.com/embed/avatars/3.png"
}
}
}
This endpoints is for get current queue from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response:
Field | Type | Description |
---|---|---|
data | Track array | The current queue data |
Example response:
{
"data": [
{
"title": "Bruno Mars - That’s What I Like [Official Music Video]",
"uri": "https://www.youtube.com/watch?v=PMivT7MJ41M",
"length": 211000,
"thumbnail": "https://i.ytimg.com/vi/PMivT7MJ41M/mqdefault.jpg",
"author": "Bruno Mars",
"requester": {
"id": "898728768791789628",
"username": "rainyxeon",
"globalName": "rainy w/🌧",
"defaultAvatarURL": "https://cdn.discordapp.com/embed/avatars/3.png"
}
}
]
}
This endpoints is for get current queue from given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
- userId: The discord user id
Response:
Field | Type | Description |
---|---|---|
data | boolean | The user voice state (if user in voice or not) |
Example response:
{
"data": true
}
This endpoints with DELETE method will destroy the current player with given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Response: No context: 204
This endpoints with POST method will create player with given guild
Body
Field | Type | Description |
---|---|---|
guildId | string | The given discord guild id |
userId | string | The given discord user id |
Response:
Field | Type | Description |
---|---|---|
guildId | string | The created player discord guild id |
voiceId | string | The created player discord voice channel id |
shardId | number | The created player discord shard id |
textId | string | The created player discord text channel id |
volume | number | The created player volume |
deaf | boolean | The created player deaf state (always true) |
Example response:
{
"guildId": "1027945618347397220",
"voiceId": 1216669628374450186,
"textId": "",
"shardId": 0,
"deaf": true,
"volume": 100,
}
This endpoints with PATCH method will modify the player with given guild (remove {} before requesting)
Params
- guildId: The discord guild id have player
Body
Field | Type | Description |
---|---|---|
loop? | Mode string | The given loop mode |
skipMode? | Mode string | The given skip mode |
position? | number | The given given track position |
volume? | number | The given volume (0 to 1000) |
add? | Array | The given track url array (Must be URL) |
Response:
Field | Type | Description |
---|---|---|
loop | Mode string | The patched loop mode |
skiped | boolean | If the skip mode is choosen |
previous | boolean | If the previous mode is choosen |
position | number | The patched position |
volume | number | The patched volume |
add | Track array | The patched track array |
Example response:
{
"loop": "queue",
"skiped": false,
"previous": false,
"position": 0,
"volume": 70,
"added": [
{
"title": "タイニーリトル・アジアンタム",
"uri": "https://www.youtube.com/watch?v=rB7XFQgJHBI",
"length": 351000,
"thumbnail": "https://i.ytimg.com/vi/rB7XFQgJHBI/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGD0gZSghMA8=&rs=AOn4CLAygSsC50atX7sQ9qI6iIpXRToR1A",
"author": "Shibayan Records",
"requester": null
}
]
}
Thanks for reading! Below are my social media!
- Discord: rainyxeon
- Facebook: https://www.facebook.com/rainy.xeon/
- Email: [email protected]
- Instagram: @rainy.xeon