◢███◤      ◢██◤                            ◢██◤                            
     ◢██◤       ◢██◤                            ◢██◤                             
    ◢██◤       ◢██◤                            ◢██◤                              
   ◢██◤       ◢██◤                            ◢██◤                               
  ◢██◤       ◢██◤                            ◢██◤                                
◢███◤       ◢██◤                            ◢██◤                          ◥██◣   
◥███       ◢█████◣    ◢████████◤ ◢███████◤ ◢██◤ ◢██◤                 ◢██◤   ██◣  
 ███      ◢███████◣        ◢██◤ ◢██◤ ◢██◤ ◢███████◤                 ◢██◤    ███  
 ███     ◢██◤  ◢██◤ ◢████████◤ ◢██◤      ◢█████◣                   ◢██◤     ███  
 ███    ◢██◤  ◢██◤ ◢██◤  ███◤ ◢██◤ ◢██◤ ◢██◤◥███◣                 ◢██◤      ███  
 ◥██   ◢██◤  ◢██◤ ◢████████◤ ◢███████◤ ◢██◤  ◥███◣               ◢██◤       ███◣ 
  ◥██◣                                                          ◢██◤       ◢███◤ 
                                 ◢███◤ ◢███◤ ◢██◤  ◢██◤ ◢█████████◤       ◢██◤   
                                ◢█████████◤ ◢██◤  ◢██◤ ◢██◤  ████◤       ◢██◤    
                               ◢██◤◢█◤◢██◤ ◢██◤  ◢██◤ ◢██◤   ███◤       ◢██◤     
                              ◢██◤   ◢██◤ ◢████████◤ ◢█████████◤       ◢██◤      
                             ◢██◤   ◢██◤ ◢████████◤ ◢█████████◤      ◢███◤       

0008
Chat API Documentation
sz5c0q
Chat API documentation. If you have any ideas for changes, contact me on Discord. (mogery#3420) Credits to bool and Jake, the makers of the documentations that this post was made from! `2=====` `FEndpoints` `2=====` Every endpoint's host is "`2www.hackmud.com`". `FHTTPS is required.` So for example, when I write "`FPOST` `2/mobile/get_token.json`", it means that you should send a `FPOST` request to "`2https://www.hackmud.com/mobile/get_token.json`". The header `V"Content-Type: application/json"` is needed for every request. A `Cruby timestamp` is float seconds since epoch (or a JS timestamp divided by 1000). `2===` `Fget_token` `2===` `FPOST` `2/mobile/get_token.json` This converts your password (from chat_pass in hackmud) to a token. Tokens expire in 45 days, unless revoked with chat_revoke_tokens. `FBODY` `1{` `N"pass"`:`V"``C<password from chat_pass>``V"` `1}` `FRESPONSE` `1{` `N"ok"`: `Vtrue`, `N"chat_token"`: `V"``C<chat token>``V"` `1}` `2===` `Faccount_data` `2===` `FPOST` `2/mobile/account_data.json` Returns users and their joined channels, along with other users in those channels. `FRATELIMIT:` This endpoint can only be called once every 5 seconds. `FBODY` `1{` `N"chat_token"`: `V"``C<chat token>``V"` `1}` `FRESPONSE` `1{` `N"ok"`: `Vtrue`, `N"users"`: `1{` `N"com"`: `1{` `N"0000"`: `1[` `V"sans_comedy"`, `V"n00b"` `1]`, `N"town"`: `1[` `V"seanmakesgames"`, `V"dtr"`, `V"sybil"`, `V"matr1x"` `1]` `N"com1killer"`: `1{}` `1}` `1}` `2===` `Fchats` `2===` `FPOST` `2/mobile/chats.json` Gets received chat messages from the joined channels and tells of the specified users. `FRATELIMIT:` This endpoint can only be called once every 700 ms, but it's recommended to poll every 2 seconds or slower. `FBODY` `1{` `N"chat_token"`: `V"``C<chat token>``V"`, `N"usernames"`: `1[``C<usernames>``1]`, `N"before"`: `C<see ``lnote``C below, messages before this ruby timestamp>`, `N"after"`: `C<see ``lnote``C below, messages after this ruby timestamp>` `1}` `l// before *or* after must be specified when polling` `l// also note that after and before are capped at 10 minutes(?). for example, if you specify 13:00 for after, then you’re only gonna get messages that were sent between 13:00 and 13:10.` `FRESPONSE` `1{` `N"ok"`: `Vtrue`, `N"chats"`: `1{` `N"``C<username>``N"`: `1[` `1{` `N"id"`: `V"3598b8a024e394b691559a8c"`, `N"t"`: `V1515984653.345`, `N"from_user"`: `V"sans_comedy"`, `N"msg"`: `V"user joined channel"`, `N"is_join"`: `Vtrue`, `N"channel"`: `V"0000"` `1}`, `1{` `N"id"`: `V"5a5c170f7b97fd4315e14842"`, `N"t"`: `V1515984655.629`, `N"from_user"`: `V"sans_comedy"`, `N"msg"`: `V"its petra-fying"`, `N"channel"`: `V"0000"` `1}`, `1{` `N"id"`: `V"8393b5e73a021ac084090aad"`, `N"t"`: `V1515984657.234`, `N"from_user"`: `V"sans_comedy"`, `N"msg"`: `V"user left channel"`, `N"is_leave"`: `Vtrue`, `N"channel"`: `V"0000"` `1}`, `1{` `N"id"`: `V"8393b5e73a021ac084090aad"`, `N"t"`: `V1515984660.132`, `N"from_user"`: `V"com"`, `N"msg"`: `V"psst, this is a tell"` `1}`, `2...` `1]`, `N"``C<username>``N"`: `1[]` `1}` `1}` `2===` `Fsend` `2===` `FPOST` `2/mobile/create_chat.json` Sends a message to a channel. `FBODY` `1{` `N"chat_token"`: `V"``C<chat token>``V"`, `N"username"`: `V"``C<sender username>``V"`, `N"channel"`: `V"``C<channel name>``V"`, `N"msg"`: `V"``C<message>``V"` `1}` `FRESPONSE` `1{` `N"ok"`: `Vtrue` `1}` `2===` `Ftell` `2===` `FPOST` `2/mobile/create_chat.json` Sends a message to a user. `FBODY` `1{` `N"chat_token"`: `V"``C<chat token>``V"`, `N"username"`: `V"``C<sender username>``V"`, `N"tell"`: `V"``C<target username>``V"`, `N"msg"`: `V"``C<message>``V"` `1}` `FRESPONSE` `1{` `N"ok"`: `Vtrue` `1}` `2===` `0chat_history` `2===` Broken, see https://www.hackmud.com/forums/bugs_features_ideas/chat_api_chat_history_returns_empty_array_if_you_did_not_join_leave_the_specified_channel_between_the_specified_times
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -