A package to interact with the I Wanna Maker API
npm install iwm-api
This is not finished, so please contribute what you can!
Most client functions don't need you to be logged in, but here's how to do so. You need a username, password and the current version of IWM (be sure to update it often)
varclient=newrequire("iwm-api").client();client.login("username","password","version").then(asyncfunction(session){console.log(session)}).catch(function(err){console.log(err)})// Global leaderboard (yes its a fake enum I know)console.log(awaitclient.leaderboard(client.enum.leaderboardCodes["Skribble Hard"]))// Leaderboard for a levelconsole.log(awaitclient.leaderboardLevel(4269,5,0))// Level ID, limit, and if we should include the replay data (0 for no, 1 for yes)// By IDconsole.log(awaitclient.search({"code": "AAAABBBB"}))//Note: The level code must not contain a dash. It must be only the 8 letters.// By whatever elseconsole.log(awaitclient.search({"min_diff": "0",// 0 for easy, 5.00 for impossible"order": `[{${encodeURIComponent(`"Dir": "desc", "Name": "created_at"`)}}]`,// I don't know too much about this, but you can change the "Sort by""required_tags": `6,2`,// Tags by ID"start": "0","limit": "10","max_diff": "5.00"}))// Feel free to mix in any further parameters you can find in the search GET request// http://make.fangam.es/api/v1/map?author=Mr.%20Maker&min_diff=0&order=[{%20"Dir":%20"desc",%20"Name":%20"created_at"%20}]&record=0&start=0&required_tags=5&limit=10&max_diff=5.00&played=1&name=levelName&clear=0// Both of these require you to be logged inawaitclient.playLevel(4269)// Level ID// Gives you level data (you can't ACTUALLY play it)// The "MapData" attribute of the response is a base64 encoded file which can then be unzipped (using zlib or an alternative) to get the xml structure (.map file)awaitclient.tagLevel(420,[6,9])// Tag a level with tag idsawaitclient.rateLevel(420,5)// Rate a level (level ID then 1 for down and 5 for up)// User lookupawaitclient.userLookup(4269)// User ID// Update avatar and country (login required)awaitclient.updateLook({"Country": 10,"PantsColor": 12058802,"HatSpr": 0,"HairColor": 0,"CapeColor": 0,"ShoesColor": 16777215,"ID": 212176,"ShirtColor": 12124343,"SkinColor": 16748460})// Don't ask me what all those mean. Can somebody contribute to this README and make it better to understand?// Follow/unfollow (login required)awaitclient.updateFollow(4269,true)// User ID, follow/unfollow// Get unread notification countconsole.log(awaitclient.notificationsUnread())// Get notificationsconsole.log(awaitclient.notifications(0,10))// Start and limitawaitclient.canUpload()// true or false, because cooldownawaitclient.mapCount()// Global map countclient.logout()// LogoutPlease contribute (: Thats all