├── README.md └── READMEv2.md /README.md: -------------------------------------------------------------------------------- 1 | # client-websocket 2 | ## Overview 3 | Documentation for the DeepBot Client WebSocket Library added in version 0.7.0 4 | 5 | ## Connection 6 | 7 | The DeepBot WebSocket server runs on port 3337 on the machine that is running DeepBot. Simply connect to this server using any websocket module to establish a connection. 8 | 9 | To authenticate as an API consumer, you will need the client API secret. This can be found in the master settings on DeepBot. 10 | 11 | Responses from the API will always be json objects in the following format: 12 | ``` 13 | { 14 | "function": "", 15 | "param": "", 16 | "msg": "" 17 | } 18 | ``` 19 | 20 | To authenticate as an API consumer, send the below message. This is needed for most functions. 21 | 22 | ## `"api|register|{secret}"` 23 | 24 | A successful authentication response would be a json object. 25 | ```json 26 | { 27 | "function": "register", 28 | "param": "register", 29 | "msg": "success" 30 | } 31 | ``` 32 | ##Users 33 | 34 | ## `api|get_user|:user` 35 | 36 | ```json 37 | { 38 | "function": "get_user", 39 | "param": "expertsonline", 40 | "msg": { 41 | "user": "expertsonline", 42 | "points": 720.0, 43 | "watch_time": 13125.0, 44 | "vip": 10, 45 | "mod": 5, 46 | "join_date": "2014-07-05T18:09:10.3156084Z", 47 | "last_seen": "2015-03-01T04:17:09.545139Z", 48 | "vip_expiry": "2014-12-09T00:00:00+08:00" 49 | } 50 | } 51 | ``` 52 | 53 | ## `api|get_users|:offset|:limit` 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
NameTypeDescription
:offsetintegeroptional. (Default = 0)
:limitintegeroptional.(Default = 100, max = 100)
75 | 76 | ```json 77 | { 78 | "function": "get_users", 79 | "param": "users", 80 | "msg": { 81 | { 82 | "user": "tom", 83 | "points": 720.0, 84 | "watch_time": 13125.0, 85 | "vip": 10, 86 | "mod": 5, 87 | "join_date": "2014-07-05T18:09:10.3156084Z", 88 | "last_seen": "2015-03-01T04:17:09.545139Z", 89 | "vip_expiry": "2014-12-09T00:00:00+08:00" 90 | }, 91 | { 92 | "user": "expertsonline", 93 | "points": 320.0, 94 | "watch_time": 3125.0, 95 | "vip": 10, 96 | "mod": 5, 97 | "join_date": "2014-07-05T18:09:10.3156084Z", 98 | "last_seen": "2015-03-01T04:17:09.545139Z", 99 | "vip_expiry": "2014-12-09T00:00:00+08:00" 100 | }, 101 | { 102 | "user": "jon", 103 | "points": 120.0, 104 | "watch_time": 3125.0, 105 | "vip": 10, 106 | "mod": 5, 107 | "join_date": "2014-07-05T18:09:10.3156084Z", 108 | "last_seen": "2015-03-01T04:17:09.545139Z", 109 | "vip_expiry": "2014-12-09T00:00:00+08:00" 110 | } 111 | } 112 | } 113 | ``` 114 | 115 | ## `api|get_top_users|:offset|:limit` 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
NameTypeDescription
:offsetintegeroptional. (Default = 0)
:limitintegeroptional.(Default = 100, max = 100)
137 | 138 | Users sorted by decending order of points. 139 | ```json 140 | { 141 | "function": "get_top_users", 142 | "param": "users", 143 | "msg": { 144 | { 145 | "user": "tom", 146 | "points": 720.0, 147 | "watch_time": 13125.0, 148 | "vip": 10, 149 | "mod": 5, 150 | "join_date": "2014-07-05T18:09:10.3156084Z", 151 | "last_seen": "2015-03-01T04:17:09.545139Z", 152 | "vip_expiry": "2014-12-09T00:00:00+08:00" 153 | }, 154 | { 155 | "user": "expertsonline", 156 | "points": 320.0, 157 | "watch_time": 3125.0, 158 | "vip": 10, 159 | "mod": 5, 160 | "join_date": "2014-07-05T18:09:10.3156084Z", 161 | "last_seen": "2015-03-01T04:17:09.545139Z", 162 | "vip_expiry": "2014-12-09T00:00:00+08:00" 163 | }, 164 | { 165 | "user": "jon", 166 | "points": 120.0, 167 | "watch_time": 3125.0, 168 | "vip": 10, 169 | "mod": 5, 170 | "join_date": "2014-07-05T18:09:10.3156084Z", 171 | "last_seen": "2015-03-01T04:17:09.545139Z", 172 | "vip_expiry": "2014-12-09T00:00:00+08:00" 173 | } 174 | } 175 | } 176 | ``` 177 | 178 | ## `api|get_users_count` 179 | 180 | ```json 181 | { 182 | "function": "get_users_count", 183 | "param": "users", 184 | "msg": "250" 185 | } 186 | ``` 187 | 188 | ## `api|get_points|:user` 189 | 190 | ```json 191 | { 192 | "function": "get_points", 193 | "param": "expertsonline", 194 | "msg": "720.00" 195 | } 196 | ``` 197 | 198 | ## `api|get_hours|:user` 199 | 200 | ```json 201 | { 202 | "function": "get_hours", 203 | "param": "expertsonline", 204 | "msg": "218.75" 205 | } 206 | ``` 207 | 208 | ## `api|get_rank|:user` 209 | 210 | ```json 211 | { 212 | "function": "get_rank", 213 | "param": "expertsonline", 214 | "msg": "Sergeant - Star 2" 215 | } 216 | ``` 217 | 218 | ## `api|set_points|:user|:points` 219 | 220 | ```json 221 | { 222 | "function": "set_points", 223 | "param": "expertsonline", 224 | "msg": "success" 225 | } 226 | ``` 227 | 228 | ## `api|add_points|:user|:points` 229 | 230 | ```json 231 | { 232 | "function": "add_points", 233 | "param": "expertsonline", 234 | "msg": "success" 235 | } 236 | ``` 237 | ## `api|del_points|:user|:points|:fail_if_insufficient` 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 |
NameTypeDescription
:userstringUser to remove points from
:pointsintegerAmount of points to remove.
:fail_if_insufficient0 or 1Optional (Default = 0). If set to 1, fail when user does not have enough points. If set to 0, bring user down to 0.
265 | 266 | ```json 267 | { 268 | "function": "del_points", 269 | "param": "expertsonline", 270 | "msg": "success" 271 | } 272 | ``` 273 | ## `api|add_to_escrow|:user|:points` 274 | 275 | ```json 276 | { 277 | "function": "add_to_escrow", 278 | "param": "expertsonline", 279 | "msg": "success" or "Not enough points" or "points should be a positive number" or "user not found" 280 | } 281 | ``` 282 | ## `api|commit_user_escrow|:user` 283 | 284 | ```json 285 | { 286 | "function": "commit_user_escrow", 287 | "param": "expertsonline", 288 | "msg": "success" or "No points in escrow" or "user not found" 289 | } 290 | ``` 291 | ## `api|cancel_escrow|:user` 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 |
NameTypeDescription
:userstringusername or 'all'
309 | 310 | ```json 311 | { 312 | "function": "cancel_escrow", 313 | "param": "expertsonline", 314 | "msg": "success" or "No points in escrow" or "user not found" 315 | } 316 | ``` 317 | ## `api|set_vip|:user|:level|:days` 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 |
NameTypeDescription
:levelintegerDesired VIP Level. 0 or 10 = Normal user. 1 = VIP Bronze, 2 = Silver, 3 = Gold
:daysintegerNumber of days to add to VIP Expiry.
340 | 341 | ```json 342 | { 343 | "function": "set_vip", 344 | "param": "expertsonline", 345 | "msg": "success" 346 | } 347 | ``` 348 | 349 | ## `api|get_song_count` 350 | 351 | ```json 352 | { 353 | "function": "get_song_count", 354 | "param": "songs", 355 | "msg": "250" 356 | } 357 | ``` 358 | 359 | ## `api|get_command_count` 360 | 361 | ```json 362 | { 363 | "function": "get_command_count", 364 | "param": "commands", 365 | "msg": "250" 366 | } 367 | ``` 368 | 369 | ## `api|get_quote_count` 370 | 371 | ```json 372 | { 373 | "function": "get_quote_count", 374 | "param": "quote", 375 | "msg": "250" 376 | } 377 | ``` 378 | 379 | ## `api|get_songs|:offset|:limit` 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 |
NameTypeDescription
:offsetintegeroptional (Default = 0)
:limitintegeroptional (Default = 100)
401 | 402 | ```json 403 | { 404 | "function":"get_songs", 405 | "param":"songs", 406 | "msg":[ 407 | { 408 | "songPosition":"2", 409 | "songID":"8d7F5ikbajU", 410 | "songName":"Study Music Project - Ever Eternity (Study Music Concentration)", 411 | "songDuration":"541", 412 | "requestedBy":"expertsonline" 413 | }, 414 | { 415 | "songPosition":"3", 416 | "songID":"V6HB_6ltwSA", 417 | "songName":"We Could Happen by AJ Rafael (Lyrics Video)", 418 | "songDuration":"216", 419 | "requestedBy":"expertsonline" 420 | }, 421 | { 422 | "songPosition":"4", 423 | "songID":"7hKeiIwypE0", 424 | "songName":"Krewella", 425 | "songDuration":"191", 426 | "requestedBy":"expertsonline" 427 | }] 428 | } 429 | ``` 430 | 431 | 432 | ## `api|get_quotes|:offset|:limit` 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 |
NameTypeDescription
:offsetintegeroptional (Default = 0)
:limitintegeroptional (Default = 100, max = 100)
454 | 455 | ```json 456 | { 457 | "function":"get_quotes", 458 | "param":"quotes", 459 | "msg":[ 460 | { 461 | "quoteID":"1", 462 | "quotedUser":"mercury3rd", 463 | "Quote":"This is a test quote", 464 | "addedOn":"2015-10-28T19:40:19.3655576+08:00", 465 | "addedBy":"doktorpeng", 466 | "lastDisplayed":"2015-10-28T20:55:14.7852188+08:00" 467 | }, 468 | { 469 | "quoteID":"2", 470 | "quotedUser":"mercury3rd", 471 | "Quote":"This is another test quote", 472 | "addedOn":"2015-10-28T19:41:12.6709951+08:00", 473 | "addedBy":"doktorpeng", 474 | "lastDisplayed":"2015-10-28T20:55:57.0029763+08:00" 475 | } 476 | ] 477 | } 478 | ``` 479 | 480 | ## `api|get_commands|:offset|:limit` 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 |
NameTypeDescription
:offsetintegeroptional (Default = 0)
:limitintegeroptional (Default = 100, max = 100)
502 | 503 | ```json 504 | { 505 | "function":"get_commands", 506 | "param":"commands", 507 | "msg":[ 508 | { 509 | "command":"!test", 510 | "group":"", 511 | "status":true, 512 | "message":"!test2 @target@ @editpoints@[expertsonline|10]", 513 | "access":"1", 514 | "channelUseAllowed":true, 515 | "whisperUseAllowed":true, 516 | "showInList":false 517 | }, 518 | { 519 | "command":"!test2", 520 | "group":"", 521 | "status":true, 522 | "message":"@target@", 523 | "access":"1", 524 | "channelUseAllowed":true, 525 | "whisperUseAllowed":true, 526 | "showInList":true 527 | }, 528 | { 529 | "command":"!test3", 530 | "group":"", 531 | "status":true, 532 | "message":"It's an issue.", 533 | "access":"1", 534 | "channelUseAllowed":true, 535 | "whisperUseAllowed":true, 536 | "showInList":true 537 | }, 538 | { 539 | "command":"!playgame", 540 | "group":"Game", 541 | "status":true, 542 | "message":"Play Game", 543 | "access":"1", 544 | "channelUseAllowed":true, 545 | "whisperUseAllowed":true, 546 | "showInList":true 547 | }, 548 | { 549 | "command":"!22", 550 | "group":"Game2", 551 | "status":true, 552 | "message":"22", 553 | "access":"1", 554 | "channelUseAllowed":true, 555 | "whisperUseAllowed":true, 556 | "showInList":true 557 | } 558 | ] 559 | } 560 | ``` 561 | 562 | ## `api|get_command|:commandName` 563 | 564 | ```json 565 | { 566 | "function":"get_command", 567 | "param":"!apitest", 568 | "msg":{ 569 | "command":"!apitest", 570 | "group":"api", 571 | "status":true, 572 | "message":"This is a test API message", 573 | "access":1, 574 | "channelUseAllowed":true, 575 | "whisperUseAllowed":true, 576 | "showInList":true, 577 | "cooldown":5, 578 | "sound":"F:\\DeepBot\\NewSub1.wav", 579 | "volume":100, 580 | "runAs":0, 581 | "widgetName":"APIWidget", 582 | "widgetTitle":"Test Widget", 583 | "widgetMessage":"@target@", 584 | "widgetImage":"www.twitch.tv/Kappa.png", 585 | "widgetAnimMode":1, 586 | "accessDeniedMessage":"Boo Hoo ... go away!", 587 | "insufficientPointsMessage":"You are too cheap for me ... go away!", 588 | "costAll":0, 589 | "costViewer":100, 590 | "costStreamer":0, 591 | "costMods":40, 592 | "costVIPBronze":80, 593 | "costVIPSilver":70, 594 | "costVIPGold":50, 595 | "OBSAction":3, 596 | "OBSTarget":"ShowCam", 597 | "chainCommand":"!chainCmd", 598 | "chainDelay":0, 599 | "chainAdminAccess":false, 600 | "counter":0, 601 | "countdown":"2016-05-07T11:58:26.6088803+08:00", 602 | "modVIPIfViewer":2, 603 | "modVIPIfBronze":3, 604 | "modVIPIfSilver":4, 605 | "modVIPIfGold":0, 606 | "numVIPDaysAdd":30 607 | } 608 | } 609 | ``` 610 | 611 | ## `api|run_command|:commandName` 612 | You can run a command as the bot! 613 | -------------------------------------------------------------------------------- /READMEv2.md: -------------------------------------------------------------------------------- 1 | # client-websocket 2 | ## Overview 3 | Documentation for the DeepBot JSON Client WebSocket Library added in version 0.11.5 4 | 5 | ## Connection 6 | 7 | The DeepBot WebSocket server runs on port 3337 on the machine that is running DeepBot. Simply connect to this server using any websocket module to establish a connection. 8 | 9 | To authenticate as an API consumer, you will need the client API secret. This can be found in the master settings on DeepBot. 10 | 11 | Responses from the API will always be json objects. You can add a nonce property that will be returned back to you to identify the request. 12 | 13 | 14 | To authenticate as an API consumer, send the below message. This is needed for most functions. 15 | 16 | ## register 17 | ```json 18 | { 19 | "module": "api", 20 | "function": "register", 21 | "secret": "" 22 | } 23 | ``` 24 | 25 | A successful authentication response would be a json object. 26 | ```json 27 | { 28 | "function": "register", 29 | "msg": "success" 30 | } 31 | ``` 32 | Failed authentication attempts will return an error message. 33 | ```json 34 | { 35 | "function": "register", 36 | "msg": "incorrect api secret", 37 | "error": true 38 | } 39 | ``` 40 | 41 | ##Users 42 | 43 | ## get_user 44 | 45 | Request: 46 | ```json 47 | { 48 | "module": "api", 49 | "function": "get_user", 50 | "user": "username" 51 | } 52 | ``` 53 | 54 | Response: 55 | ```json 56 | { 57 | "function": "get_user", 58 | "user": { 59 | "user": "expertsonline", 60 | "points": 720.0, 61 | "watch_time": 13125.0, 62 | "vip": 10, 63 | "mod": 5, 64 | "join_date": "2014-07-05T18:09:10.3156084Z", 65 | "last_seen": "2015-03-01T04:17:09.545139Z", 66 | "vip_expiry": "2014-12-09T00:00:00+08:00" 67 | } 68 | } 69 | ``` 70 | 71 | ## add_points 72 | 73 | Request: 74 | ```json 75 | { 76 | "module": "api", 77 | "function": "add_points", 78 | "user": "username", 79 | "points": 2 80 | } 81 | ``` 82 | Points to be added or removed must be a valid integer 83 | 84 | Response: 85 | ```json 86 | { 87 | "function": "add_points", 88 | "user": "username", 89 | "message": "success", 90 | "old_points": 12, 91 | "new_points": 14 92 | } 93 | ``` 94 | --------------------------------------------------------------------------------