@eryxenx/insta-chat 2.0.0 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +95 -8
  2. package/index.js +105 -1
  3. package/module/login.js +51 -1
  4. package/package.json +9 -2
  5. package/src/api/action/getAppState.js +19 -1
  6. package/src/api/action/getCookies.js +7 -1
  7. package/src/api/action/getCurrentUserID.js +7 -1
  8. package/src/api/action/setOptions.js +8 -1
  9. package/src/api/messaging/editMessage.js +19 -1
  10. package/src/api/messaging/markAsRead.js +7 -1
  11. package/src/api/messaging/resolvePhotoUrl.js +8 -1
  12. package/src/api/messaging/sendMessage.js +45 -1
  13. package/src/api/messaging/sendMessageSync.js +8 -1
  14. package/src/api/messaging/sendTypingIndicator.js +7 -1
  15. package/src/api/messaging/setMessageReaction.js +19 -1
  16. package/src/api/messaging/shareContact.js +19 -1
  17. package/src/api/messaging/unsendMessage.js +16 -1
  18. package/src/api/realtime/getInbox.js +7 -1
  19. package/src/api/realtime/listen.js +7 -1
  20. package/src/api/realtime/stopListening.js +7 -1
  21. package/src/api/threads/getThreadHistory.js +16 -1
  22. package/src/api/threads/getThreadInfo.js +59 -1
  23. package/src/api/threads/getThreadList.js +22 -1
  24. package/src/api/users/getUID.js +12 -1
  25. package/src/api/users/getUserInfo.js +37 -1
  26. package/src/api.js +253 -1
  27. package/src/app/InstaClient.js +352 -1
  28. package/src/app/InstaContext.js +46 -1
  29. package/src/app/createFcaClient.js +59 -1
  30. package/src/app/loadApiMethods.js +30 -1
  31. package/src/constants.js +53 -1
  32. package/src/cookies.js +41 -1
  33. package/src/deviceIdentity.js +31 -1
  34. package/src/events/normalizeEvent.js +142 -1
  35. package/src/http.js +381 -1
  36. package/src/messageContent.js +73 -1
  37. package/src/methods/inbox.js +464 -1
  38. package/src/methods/media.js +218 -1
  39. package/src/methods/message.js +115 -1
  40. package/src/methods/reactions.js +52 -1
  41. package/src/methods/thread.js +96 -1
  42. package/src/methods/typing.js +35 -1
  43. package/src/methods/user.js +33 -1
  44. package/src/session.js +94 -1
  45. package/src/threadDetail.js +36 -1
  46. package/src/utils/antiSuspension.js +269 -0
  47. package/src/utils/dataDir.js +11 -0
  48. package/src/utils/errors.js +106 -0
  49. package/src/utils/format.js +38 -1
  50. package/src/utils/messageStyle.js +57 -1
  51. package/src/utils/sessionGuard.js +93 -0
package/CHANGELOG.md CHANGED
@@ -4,20 +4,107 @@ All notable changes to `@eryxenx/insta-chat` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and uses
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
- ## [2.0.0] - 2026-10-09
7
+ ## [1.0.12] - 2026-10-10
8
+
9
+ ### Fixed
10
+
11
+ - **Bot logged out on a network blip.** `init()` treated every failed probe
12
+ (timeout, 5xx, 429) as an expired cookie. It now distinguishes a dead session
13
+ (`IG_SESSION_INVALID`), a security check (`IG_CHALLENGE`), a suspended account
14
+ (`IG_SUSPENDED`) and a temporary failure (`IG_TRANSIENT`, with `retryAfterMs`),
15
+ and retries transient failures before giving up.
16
+ - **Poller stopped on a single redirect.** `listen()` shut down on the first
17
+ 3xx. It now requires two consecutive auth failures plus a fresh session check
18
+ before reporting the session dead, stops at once only on a challenge or a
19
+ suspension, and keeps polling through transient errors with backoff.
20
+ - **Rotated cookies were never reused.** The saved `appstate.json` is now
21
+ merged back in on the next start when it belongs to the same `sessionid`, and
22
+ snapshots are written atomically so a crash cannot leave a truncated file.
23
+ - **Poll cadence looked scripted.** Poll interval floor raised to 15s (default
24
+ 20s) with +/-20% jitter, and polling slows down while a cooldown is active.
25
+ - **Cooldown did nothing.** The old cooldown added 2-5s per send and the
26
+ hourly/daily caps only added a short delay. Sends are now serialized with a
27
+ global gap, a per-thread gap and jitter; caps and cooldown enforce a real
28
+ gap, strikes decay, and repeated cooldowns escalate (1h up to 6h).
29
+ - Suspicion signals are now detected on every request (challenge, checkpoint,
30
+ `feedback_required`, suspended), not only on sends, and one failing request
31
+ counts as one strike instead of two.
32
+ - The legacy broadcast fallback is no longer attempted while rate-limited,
33
+ challenged or cooling down.
34
+ - Responses carrying `x-ig-set-www-claim` are tracked and echoed back like the
35
+ web client does, instead of always sending `0`.
36
+ - Redirects are no longer followed on API calls, so a dead session fails on the
37
+ first response instead of after five wasted requests.
8
38
 
9
39
  ### Added
10
40
 
11
- - `getPictureUrl(idOrUsername)` alias for `getProfilePictureUrl`, so the frozen
12
- GoatBot-Pro `pp.js` (which probes `typeof api.getPictureUrl === "function"`)
13
- resolves avatars through the direct lookup instead of falling back silently.
41
+ - `INSTA_DATA_DIR` environment variable: directory for `device.json`,
42
+ `session-params.json` and `appstate.json` (point it at a persistent volume on
43
+ Render/Railway so the identity survives restarts).
44
+ - `appStateFile` option on `InstaAPI`.
45
+
46
+ ## [1.0.11] - 2026-10-10
47
+
48
+ ### Fixed
49
+
50
+ - **Attachment caption order.** A message carrying both text and an attachment
51
+ (e.g. `sendMessage({ body, attachment })`) sent the media first and the text
52
+ second, so the image rendered above its caption. The text is now sent before
53
+ the media upload, so the recipient sees the caption on top and the
54
+ photo/attachment underneath — matching how ported GoatBot-Pro commands format
55
+ a header line followed by an image.
56
+
57
+ ## [1.0.10] - 2026-10-10
14
58
 
15
59
  ### Fixed
16
60
 
17
- - `InstaClient` test double now stubs `addUserToGroup` / `removeUserFromGroup`
18
- and the inbox, so the FCA client surface test exercises the real delegation
19
- (FCA `(userID, threadID)` → native `(threadID, userID)`) and offline mention
20
- resolution instead of throwing / short-circuiting.
61
+ - **Silent message drop.** Instagram answers a rejected Relay mutation with HTTP
62
+ 200 plus a top-level `errors` array. `postGraphQL` returned that payload as if
63
+ it were a success, so `sendMessage` reported a `messageID` for a message
64
+ Instagram never stored. Write operations (text send, media commit, caption,
65
+ reaction, edit) now pass `{ throwOnError: true }`, which throws an
66
+ `InstagramGraphQLError` carrying the relay `errors`. Read/query paths keep the
67
+ old lenient behaviour so `getThreadHistory` still maps a rejected query to `[]`.
68
+ - `sessionGuard` now snapshots the cookie jar once at install time instead of
69
+ waiting for the first 5-minute interval, so a crash right after login no longer
70
+ leaves no good `appstate.json` on disk.
71
+ - `_resolveMentionsOffline` falls back to a live `getUserInfoByUsername` (and
72
+ indexes the result) when a handle was never seen in the inbox, instead of
73
+ dropping the mention.
74
+ - `addUserToGroup` / `removeUserFromGroup` degrade to a `false` stub when the
75
+ native client does not expose the pair, matching the other group-management
76
+ stubs.
77
+ - Reaction send/remove now note a failed mutation to the anti-suspension pacer,
78
+ and reaction removal is paced like every other outbound send. Previously a
79
+ checkpoint surfaced by a reaction was never counted as a strike, and removals
80
+ bypassed the pacer entirely.
81
+ - Adds `test/safetyWiring.test.js`, which asserts the pacer is actually invoked
82
+ (paced before the network call, noted on failure) by the text and reaction
83
+ send paths, rather than merely being exported.
84
+
85
+ ## [1.0.9] - 2026-10-09
86
+
87
+ ### Added
88
+
89
+ - **Anti-suspension send pacer** (`src/utils/antiSuspension.js`), ported from
90
+ `@eryxenx/fca`. Every outbound DM (text, media, reactions) is paced with a
91
+ per-thread gap plus jitter, capped per hour/day, and throttled for 45 min when
92
+ a response or error mentions a checkpoint/spam/rate-limit signal. A freshly
93
+ logged-in session starts under a stricter warmup ceiling (40/hr → 350/hr).
94
+ This is the main reason an account survives weeks instead of days.
95
+ - **Session guard** (`src/utils/sessionGuard.js`), ported from `@eryxenx/fca`.
96
+ Snapshots the live cookie jar to `appstate.json` every 5 min, keeps the
97
+ previous copy as `.bak`, and refuses to overwrite a good file with a shorter
98
+ one (truncation guard). Installed automatically on every `InstaClient`;
99
+ disable with `login(cookie, { sessionGuard: false })`.
100
+
101
+ ### Changed
102
+
103
+ - `listen()` no longer piles polls on top of an HTTP 429. It tears down the
104
+ current poll, re-arms with exponential backoff (30s → 10min), and resets on a
105
+ clean poll. A dead session (redirect to the login page) now stops the listener
106
+ instead of spinning forever. The poll interval is floored at 10s.
107
+ - Exported `antiSuspension` and `sessionGuard` from the package root.
21
108
 
22
109
  ## [1.1.0] - 2026-10-08
23
110
 
package/index.js CHANGED
@@ -4,4 +4,108 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- 'use strict';function _0x3941(_0x23f95c,_0x9a19f3){_0x23f95c=_0x23f95c-0xe0;const _0x427f64=_0x427f();let _0x394104=_0x427f64[_0x23f95c];if(_0x3941['pQbQzH']===undefined){var _0x78c50a=function(_0x4353a0){const _0x236d31='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x489223='',_0x45984f='';for(let _0x5acfdf=0x0,_0x446d69,_0x3a1962,_0x11febc=0x0;_0x3a1962=_0x4353a0['charAt'](_0x11febc++);~_0x3a1962&&(_0x446d69=_0x5acfdf%0x4?_0x446d69*0x40+_0x3a1962:_0x3a1962,_0x5acfdf++%0x4)?_0x489223+=String['fromCharCode'](0xff&_0x446d69>>(-0x2*_0x5acfdf&0x6)):0x0){_0x3a1962=_0x236d31['indexOf'](_0x3a1962);}for(let _0x43039b=0x0,_0x4266c4=_0x489223['length'];_0x43039b<_0x4266c4;_0x43039b++){_0x45984f+='%'+('00'+_0x489223['charCodeAt'](_0x43039b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x45984f);};const _0x1d083e=function(_0x17230e,_0xb81e37){let _0x158d30=[],_0x383506=0x0,_0x341955,_0x1d9030='';_0x17230e=_0x78c50a(_0x17230e);let _0x5f46fc;for(_0x5f46fc=0x0;_0x5f46fc<0x100;_0x5f46fc++){_0x158d30[_0x5f46fc]=_0x5f46fc;}for(_0x5f46fc=0x0;_0x5f46fc<0x100;_0x5f46fc++){_0x383506=(_0x383506+_0x158d30[_0x5f46fc]+_0xb81e37['charCodeAt'](_0x5f46fc%_0xb81e37['length']))%0x100,_0x341955=_0x158d30[_0x5f46fc],_0x158d30[_0x5f46fc]=_0x158d30[_0x383506],_0x158d30[_0x383506]=_0x341955;}_0x5f46fc=0x0,_0x383506=0x0;for(let _0x5bf4d1=0x0;_0x5bf4d1<_0x17230e['length'];_0x5bf4d1++){_0x5f46fc=(_0x5f46fc+0x1)%0x100,_0x383506=(_0x383506+_0x158d30[_0x5f46fc])%0x100,_0x341955=_0x158d30[_0x5f46fc],_0x158d30[_0x5f46fc]=_0x158d30[_0x383506],_0x158d30[_0x383506]=_0x341955,_0x1d9030+=String['fromCharCode'](_0x17230e['charCodeAt'](_0x5bf4d1)^_0x158d30[(_0x158d30[_0x5f46fc]+_0x158d30[_0x383506])%0x100]);}return _0x1d9030;};_0x3941['JpCYcY']=_0x1d083e,_0x3941['DgmXuQ']={},_0x3941['pQbQzH']=!![];}const _0x2d25e3=_0x427f64[0x0],_0x16347c=_0x23f95c+_0x2d25e3,_0x2af151=_0x3941['DgmXuQ'][_0x16347c];return!_0x2af151?(_0x3941['iFZPKl']===undefined&&(_0x3941['iFZPKl']=!![]),_0x394104=_0x3941['JpCYcY'](_0x394104,_0x9a19f3),_0x3941['DgmXuQ'][_0x16347c]=_0x394104):_0x394104=_0x2af151,_0x394104;}const _0x42ccc4=_0x3941,_0x722255=_0x3941;(function(_0x30d2c4,_0x44e99a){const _0x1f10fb=_0x3941,_0x677d4d=_0x3941,_0x18a983=_0x30d2c4();while(!![]){try{const _0x307a9b=-parseInt(_0x1f10fb(0x154,'Dqaw'))/0x1*(-parseInt(_0x677d4d(0xfe,'vZjO'))/0x2)+parseInt(_0x1f10fb(0x14f,'sjRB'))/0x3+-parseInt(_0x1f10fb(0x14a,'NkBT'))/0x4*(parseInt(_0x1f10fb(0x128,'qiG&'))/0x5)+parseInt(_0x1f10fb(0x142,'DEoV'))/0x6+-parseInt(_0x1f10fb(0x117,'t%#f'))/0x7+-parseInt(_0x677d4d(0xf6,'!PVL'))/0x8+parseInt(_0x1f10fb(0x158,'A00['))/0x9*(parseInt(_0x677d4d(0x147,'NkBT'))/0xa);if(_0x307a9b===_0x44e99a)break;else _0x18a983['push'](_0x18a983['shift']());}catch(_0x4f9356){_0x18a983['push'](_0x18a983['shift']());}}}(_0x427f,0xe1d1c));const InstaAPI=require(_0x42ccc4(0x11a,'3TEw')+_0x42ccc4(0xf4,'sRDE')),constants=require(_0x42ccc4(0x12c,'U#wM')+'consta'+_0x722255(0x146,'bzFX')),{normalizeCookie}=require(_0x722255(0x104,'fpVi')+_0x42ccc4(0x121,'LSZy')+'s'),{harvestSessionParams,findChromium}=require(_0x42ccc4(0x119,'2D[3')+_0x42ccc4(0xea,'1Vfc')+'n'),InstaClient=require(_0x722255(0x11c,'NQF&')+_0x722255(0x152,'NkBT')+_0x722255(0x139,'Sw[%')+_0x42ccc4(0x153,'2D[3')),{InstaContext}=require(_0x42ccc4(0x11f,'Pgej')+_0x42ccc4(0x13f,'(vi]')+_0x42ccc4(0xe9,'@KMW')+_0x42ccc4(0xf8,'NkBT')),{createFcaClient}=require(_0x42ccc4(0x12a,'c$v7')+_0x42ccc4(0x12b,'c$v7')+_0x722255(0x144,'A00[')+_0x42ccc4(0x13d,'!6*r')+'t'),EventNormalizer=require(_0x722255(0x123,'v$5p')+'events'+_0x42ccc4(0x148,'vZjO')+_0x722255(0xf5,'OMdW')+_0x722255(0x12e,'NQF&')),loadApiMethods=require(_0x42ccc4(0x114,'f#Zo')+_0x42ccc4(0xe0,'vZjO')+_0x722255(0x14e,'NkBT')+_0x42ccc4(0x10f,'BAtq')),moduleLogin=require(_0x722255(0xe6,'vZjO')+_0x722255(0x13c,'v$5p')+'in');function login(_0x1f95d1,_0xf8f521,_0x904a21){const _0x5e93d4=_0x722255,_0x4beb76=_0x722255,_0x213291={'pqBWp':function(_0x5d34c8,_0x22934e){return _0x5d34c8(_0x22934e);},'TGytO':function(_0x46ac58,_0x93d41b){return _0x46ac58===_0x93d41b;},'FUxoZ':function(_0xc49939,_0x340046){return _0xc49939||_0x340046;},'LTqmo':_0x5e93d4(0x111,'f#Zo')+'on','bEqWQ':function(_0x56e7c4,_0x339797){return _0x56e7c4!==_0x339797;},'ccuOn':_0x4beb76(0x12d,'C7Bh')};_0x213291[_0x5e93d4(0x10d,'Pgej')](typeof _0xf8f521,_0x5e93d4(0x149,'a9$u')+'on')&&(_0x904a21=_0xf8f521,_0xf8f521={});_0xf8f521=_0x213291[_0x4beb76(0x141,'fpVi')](_0xf8f521,{});const _0x152e73=((async()=>{const _0x2c7339=_0x4beb76,_0x50c662=_0x5e93d4,_0x23760b=new InstaAPI(_0x1f95d1,_0xf8f521);return await _0x23760b[_0x2c7339(0x126,'OMdW')](),_0xf8f521[_0x50c662(0xf7,'c$v7')]?_0x23760b:new InstaClient(_0x23760b,_0xf8f521);})());if(_0x213291[_0x5e93d4(0x14d,'v$5p')](typeof _0x904a21,_0x213291[_0x4beb76(0x136,'fpVi')])){if(_0x213291[_0x4beb76(0x137,'t%#f')](_0x5e93d4(0x14c,'Dqaw'),_0x213291[_0x4beb76(0x13b,'BAtq')]))return _0x152e73[_0x4beb76(0x120,'Sw[%')](_0x1773bb=>_0x904a21(null,_0x1773bb),_0x6c79df=>_0x904a21(_0x6c79df,null)),undefined;else{const _0x18c7e7=_0x22ec8e instanceof _0x2347a7?_0x5364d7:_0x213291[_0x4beb76(0xf9,'BAtq')](_0x399a68,_0x49d3d4);return new _0x343461(_0x18c7e7,_0x48a671);}}return _0x152e73;}function createClient(_0x3699f0,_0xd624f3){const _0x15b131=_0x722255,_0x317cb2={'qHgjP':function(_0x57f0a2,_0xdb5696,_0x5b0808){return _0x57f0a2(_0xdb5696,_0x5b0808);}};return _0x317cb2[_0x15b131(0x109,'ji7c')](login,_0x3699f0,_0xd624f3);}function wrap(_0x270c1a,_0x44c4b8){return new InstaClient(_0x270c1a,_0x44c4b8);}function _0x427f(){const _0x1f4dd0=['WRdcICoenYq','o8kIWQ7dG8kU','WPBcSwyYWPdcTq','sCkDzLeKguvLrCksW63dHLi','WOvwWQNdG8k7WOy','W7myW4notgxcNCofCq','WPBcPvDTWRdcLG','W7BdQCod','W5/cVCoMmbzAoq','ACoMhItdIsK','WOWuFhlcGbS','DW9mtCo3eW','W4OtWOupW6ClW4RdV8oxW5SwaW','W6vfwZldQxm','rSo3zCodb2e','W6hdSshdIx4','W6VdI8o3WRtdR8kb','sSoOCCkzb2S','WQDrWOnjzLq','pa3cPmkzW7pcPq','aNW6WO/cN8k1','c8kgBSodmSoVBmklrMZdLfXQcq','WPeCW7X1jCku','bCk3Bmozd3e','gmoslG5HwW','F0iGW7jIvq','uMnRW7hcLCkw','W5NdH1JcQt0i','cSkDWQFdMmktDq','aCkBW40WlSoSlxNdMLT6WOL7','w8owgHtdLIK','smk3qIC','W6vfwZldQxe','brlcUa','WP51e8kdkW','b2lcJNuRWQu','WPbtW5fDWQPD','W7ldK8kL','WR8Bwmowj8oo','eCoDws3cOmkDWPTPhCoiWQ7cQ8ktW6i','W4jkxc/dVLC','WOpcSf82','E2ahW5zH','aCkuWOq4WPlcLa','surxyhSf','WRykuSoCemom','WOzhWRFdImkkWPO','h8kTmSkdwtddI8kocI7cRmki','hSoyoWbNsG','zSoeW7e','wSk9uZHQyG','dwJcK3S1WRG','hSoEqSoNe33dUW','m8kAccxdMw8','W6fFvWpcT8kTBmoWW7JdOwhdIK4','W4pdObr3W4VdJhlcTZn7W4ip','WPviW5PyWP1q','keddRcPmW6m','WR9bW4W6W6K','CSoBdZldGJq','AqTIW6Ksda','FgmKW7e','vg1Dyfu','ASkXsJTR','BMuTW651tW','B8oAfJ7dJY0','WPqBW7D3jCky','hSofmbjNtG','ACkdgMJdTmoU','W5XbW6PMmSoE','WPylW791jmkD','W7BdV8ohWPz+WOq','Dq7cQxmjWQFdTCojsSoCW5TpWRq','WOXrWPFdHSkkWO8','WR3cQmoeWOTVW58','WRFcI8oPWQ/dUCod','WR0PW5/dVMJdKG','fdnMiM9R','WPKYlGZcMa','WPyNW4ldO2tdHa','lGvxzNLP','WQeacL0','bgSLWOVcHmkK','W7LFqsRdUW','qCokWQtdHCkclG','WQ1hWQnhzKe','WRhcTKybWPxcKq','WROCs8oh','qSk2jL4JW64','Amoqc1nEdSoCx8oUaWW','rg96W53cImkm','WOiewZtdQX0','W41BwgNdQ0a','W5WZbCkFpmoc','jr1SWOFdRG','x3jH','hhexWOueWPK','k8kmWPuZWP7cRG','dCkmWPiIWOFcMW','WRrSW5K','xZj/W5BdMSoXf3pcICohWRNcLGa','W5qoW7dcL8onWPW7nGvdWRi','WOTDWODNW5tcQG','uCoHcJRdLq','l33dRrjV','zYrRACov','WQyCdNddRmoY','mvaZW7qNeHqWWPW','AhiWW45/','a8kaW7JdM8kozG','W73dSM3cSCoUlG','W5ddQmoyWPjLWPu','W7LDW7xcKSkJxq','WPyhauFdPCoJ','w8oGaZJdOa','xIJdKsb/W75SW4BdSmkBW4SPW6C','WPlcU1m','WPzaW4bzWPHB','lbjvWPldQmkt','nWhcPW','W4BdPbCQWQhcVwtcTsq','bmo2BSoebMu','WQrCWP1fyeK','W4pdOrC7WO3cLN/cMqi','u8o7o8kgB8kW'];_0x427f=function(){return _0x1f4dd0;};return _0x427f();}function createContext(_0x4f2933,_0x53a5ac){const _0x54db4c=_0x722255,_0x1128d9={'uSWKP':function(_0x26aa35,_0x207cb6){return _0x26aa35 instanceof _0x207cb6;}},_0x48778d=_0x1128d9[_0x54db4c(0x138,'^q8C')](_0x4f2933,InstaClient)?_0x4f2933:wrap(_0x4f2933);return new InstaContext(_0x48778d,_0x53a5ac);}login[_0x42ccc4(0x131,'*7W)')+'PI']=InstaAPI,login[_0x42ccc4(0x113,'!PVL')+_0x42ccc4(0xf1,'U#wM')]=InstaClient,login[_0x42ccc4(0xfb,'Pgej')+_0x42ccc4(0x10a,'fpVi')]=InstaContext,login['create'+_0x722255(0x12f,'Ncm5')]=createClient,login[_0x722255(0xe5,'f#Zo')+_0x42ccc4(0xed,'fpVi')+_0x722255(0x100,'i9)k')]=createFcaClient,login[_0x722255(0xee,'aMQw')]=wrap,login[_0x722255(0xff,'sjRB')+_0x42ccc4(0x140,'Sw[%')+'t']=createContext,login[_0x722255(0x13e,'2D[3')+_0x722255(0x122,'c$v7')]={'parse':normalizeCookie},login[_0x42ccc4(0x145,'C7Bh')+_0x722255(0xe8,'BAtq')+_0x722255(0x124,'a9$u')+'ms']=harvestSessionParams,login[_0x42ccc4(0x107,'A00[')+_0x722255(0x110,'fpVi')]=findChromium,login[_0x722255(0x15a,'vZjO')+'Login']=moduleLogin,module[_0x42ccc4(0xe1,'a9$u')+'s']=login,module[_0x722255(0xe2,'bzFX')+'s'][_0x42ccc4(0x15b,'09hl')]=login,module[_0x42ccc4(0xeb,'v$5p')+'s'][_0x722255(0x115,'f#Zo')+'t']=login,module[_0x722255(0xe7,'sjRB')+'s'][_0x42ccc4(0xf3,'A00[')+'Client']=createClient,module[_0x42ccc4(0x116,'2D[3')+'s'][_0x42ccc4(0x159,'c$v7')+'PI']=InstaAPI,module[_0x42ccc4(0x129,'@KMW')+'s'][_0x42ccc4(0xef,'c$v7')+_0x722255(0x11d,'^iIE')]=InstaClient,module[_0x42ccc4(0xfd,'UFja')+'s'][_0x722255(0xfb,'Pgej')+_0x42ccc4(0x130,'*7W)')]=InstaContext,module[_0x42ccc4(0x135,']4$v')+'s'][_0x722255(0x127,'@)QH')+_0x42ccc4(0x125,'NkBT')+_0x722255(0x143,'NkBT')]=createFcaClient,module[_0x722255(0xe3,'LSZy')+'s'][_0x42ccc4(0xfa,'*7W)')+_0x722255(0xf2,'DEoV')+_0x722255(0x132,'ji7c')]=EventNormalizer,module[_0x42ccc4(0x101,'aMQw')+'s'][_0x42ccc4(0x10b,'P!PH')+_0x722255(0x14b,'DF&o')+'ds']=loadApiMethods,module[_0x42ccc4(0xfc,'OMdW')+'s'][_0x722255(0x10c,'BAtq')]=wrap,module[_0x722255(0x135,']4$v')+'s'][_0x42ccc4(0xe5,'f#Zo')+_0x42ccc4(0x156,'@bBe')+'t']=createContext,module[_0x42ccc4(0x157,'^q8C')+'s'][_0x722255(0x11e,'X(86')+_0x42ccc4(0x10e,'aMQw')]={'parse':normalizeCookie},module[_0x42ccc4(0x108,'t%#f')+'s'][_0x42ccc4(0x11b,'X(86')+_0x42ccc4(0x155,'fpVi')+_0x722255(0x118,'UFja')+'ms']=harvestSessionParams,module[_0x722255(0x102,'DEoV')+'s'][_0x42ccc4(0x150,'UFja')+_0x722255(0x15c,'3TEw')]=findChromium,module['export'+'s'][_0x42ccc4(0x112,'sjRB')+_0x722255(0xf0,'(lnL')]=constants,module[_0x722255(0xe1,'a9$u')+'s']['module'+'Login']=moduleLogin;
7
+
8
+ "use strict";
9
+
10
+ const InstaAPI = require("./src/api");
11
+ const constants = require("./src/constants");
12
+ const { normalizeCookie } = require("./src/cookies");
13
+ const { harvestSessionParams, findChromium } = require("./src/session");
14
+ const InstaClient = require("./src/app/InstaClient");
15
+ const { InstaContext } = require("./src/app/InstaContext");
16
+ const { createFcaClient } = require("./src/app/createFcaClient");
17
+ const EventNormalizer = require("./src/events/normalizeEvent");
18
+ const loadApiMethods = require("./src/app/loadApiMethods");
19
+ const moduleLogin = require("./module/login");
20
+
21
+ /**
22
+ * Log in to Instagram with a browser cookie / sessionid and return a ready
23
+ * client. Mirrors the classic FCA `login(credentials, callback)` shape so bot
24
+ * projects can swap it in the same way they swap an FCA package.
25
+ *
26
+ * By default it resolves to an {@link InstaClient} — the FCA-shaped surface
27
+ * (sendMessage, setMessageReaction, getThreadInfo, ...) — which is what
28
+ * GoatBot-Pro commands are written against. Pass `{ native: true }` to get the
29
+ * bare {@link InstaAPI} instead.
30
+ *
31
+ * @param {string|object} cookie sessionid string, "k=v; k=v" cookie string,
32
+ * a cookie object, or a browser cookie array.
33
+ * @param {object} [options] { native, sessionParams, sessionParamsFile,
34
+ * deviceFile, pollInterval }
35
+ * @param {function} [callback] (err, api) classic node-callback style.
36
+ * @returns {Promise<InstaClient|InstaAPI>}
37
+ */
38
+ function login(cookie, options, callback) {
39
+ if (typeof options === "function") {
40
+ callback = options;
41
+ options = {};
42
+ }
43
+ options = options || {};
44
+
45
+ const promise = (async () => {
46
+ const native = new InstaAPI(cookie, options);
47
+ await native.init();
48
+ return options.native ? native : new InstaClient(native, options);
49
+ })();
50
+
51
+ if (typeof callback === "function") {
52
+ promise.then((api) => callback(null, api), (err) => callback(err, null));
53
+ return undefined;
54
+ }
55
+ return promise;
56
+ }
57
+
58
+ /**
59
+ * Alias kept for parity with FCA-style packages that expose `createClient`.
60
+ */
61
+ function createClient(cookie, options) {
62
+ return login(cookie, options);
63
+ }
64
+
65
+ /**
66
+ * Wraps an already-initialised native InstaAPI in the FCA-shaped client.
67
+ */
68
+ function wrap(native, options) {
69
+ return new InstaClient(native, options);
70
+ }
71
+
72
+ /**
73
+ * Wraps an already-initialised native client in a per-thread context.
74
+ */
75
+ function createContext(nativeOrClient, threadID) {
76
+ const client = nativeOrClient instanceof InstaClient ? nativeOrClient : wrap(nativeOrClient);
77
+ return new InstaContext(client, threadID);
78
+ }
79
+
80
+ login.InstaAPI = InstaAPI;
81
+ login.InstaClient = InstaClient;
82
+ login.InstaContext = InstaContext;
83
+ login.createClient = createClient;
84
+ login.createFcaClient = createFcaClient;
85
+ login.wrap = wrap;
86
+ login.createContext = createContext;
87
+ login.CookieUtils = { parse: normalizeCookie };
88
+ login.harvestSessionParams = harvestSessionParams;
89
+ login.findChromium = findChromium;
90
+ login.moduleLogin = moduleLogin;
91
+
92
+ module.exports = login;
93
+
94
+ module.exports.login = login;
95
+ module.exports.default = login;
96
+ module.exports.createClient = createClient;
97
+ module.exports.InstaAPI = InstaAPI;
98
+ module.exports.InstaClient = InstaClient;
99
+ module.exports.InstaContext = InstaContext;
100
+ module.exports.createFcaClient = createFcaClient;
101
+ module.exports.EventNormalizer = EventNormalizer;
102
+ module.exports.loadApiMethods = loadApiMethods;
103
+ module.exports.wrap = wrap;
104
+ module.exports.createContext = createContext;
105
+ module.exports.CookieUtils = { parse: normalizeCookie };
106
+ module.exports.harvestSessionParams = harvestSessionParams;
107
+ module.exports.findChromium = findChromium;
108
+ module.exports.constants = constants;
109
+ module.exports.moduleLogin = moduleLogin;
110
+ module.exports.antiSuspension = require("./src/utils/antiSuspension");
111
+ module.exports.sessionGuard = require("./src/utils/sessionGuard");
package/module/login.js CHANGED
@@ -4,4 +4,54 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- function _0x4225(){const _0x288916=['W7pdPCo9W6pdGSkHW7q','W75aktrysa','WRrKdrfoENK','kmomyKS4nXG','WQNcGCo/BCkNW7O','lg7cQG','WQ1Anh1/qq','W7VcV8orWRFdGcO','fwZcMCo2WPW','d8k5hG','mNxcUWr/W5G','W7S/smogiCob','zJf+vmkljLtdQSkJW6/cNG','W4rLWQ43WOVdVmoBaNpcOSoXrq','W5nglmovW50H','WRGhBMqeBK8TWOdcUZ4','lw7cRGr/WOu','WR7cHSo1Aa','m8kGivijga','WOnauYJcUSouWPah','WRqGbfyuse5eW4OhWQ/cNSo6','W4ronSo0BeJdQmkAW40MW6WV','lSk+t3m9nYzK','W69jqSoxhG','bWpdNSoGiuKDqr3dOSkXaG','WR/dPuu','idpcKW3dKGRcLmoxl0FdIgzZ','W5mcAHBcJmoC','cCk9WPTBW4eH','dCkLW4lcRSocmW','W4CcAINcKCoy','WRNcR8osxSkI','t8k/W77dUwi','z8oFW7jAW6O','ACo/W7zZhCoS','WPSLW7rTW4RcPa','WQpcGmo5CG','WOmgW6qxaq','cCk0dSkfAWy','BKHeW4xcMmoo','C8kkWQS4W7tdQehdIsi8kCky','WOqoWOJcQYpdGa','cmk2aW','WOOys8oWWRm5WQ7dKSonaCkiECoN','sCkugSkEW5FdV8k6W6nRW57cTqpcOG','lvtcRSktWPa','W59ZxCoUnG','W4W+gZGcW6RdT1a','W4uWW7KEb3FcUq','fCkBWO59W6u','WOXRkrKTW4K','ChldKfBcLe0','wfJcIG','W4vsatbL','W7VcH8oIW4ldUmkDW5hcHG','WPFcSCooWRu'];_0x4225=function(){return _0x288916;};return _0x4225();}const _0x30f551=_0x2163,_0x48ee7c=_0x2163;(function(_0xf8c101,_0x2bdc13){const _0xa1f7b8=_0x2163,_0x237714=_0x2163,_0x30709a=_0xf8c101();while(!![]){try{const _0x486e56=parseInt(_0xa1f7b8(0xf0,'AD8r'))/0x1*(parseInt(_0xa1f7b8(0xd2,'6!K7'))/0x2)+parseInt(_0xa1f7b8(0xe2,'zxlL'))/0x3+-parseInt(_0xa1f7b8(0xe6,'V5PX'))/0x4+-parseInt(_0xa1f7b8(0xf5,'Eq7]'))/0x5*(-parseInt(_0x237714(0x107,'s$q6'))/0x6)+-parseInt(_0xa1f7b8(0xd4,'31i*'))/0x7+parseInt(_0x237714(0x101,'03LA'))/0x8*(parseInt(_0xa1f7b8(0xf2,'AD8r'))/0x9)+parseInt(_0x237714(0x108,'Eq7]'))/0xa*(parseInt(_0xa1f7b8(0x106,'qa3T'))/0xb);if(_0x486e56===_0x2bdc13)break;else _0x30709a['push'](_0x30709a['shift']());}catch(_0x280d22){_0x30709a['push'](_0x30709a['shift']());}}}(_0x4225,0xc6715));const InstaAPI=require(_0x30f551(0x104,'Eq7]')+_0x48ee7c(0xf1,'B5pF')),{normalizeCookie}=require(_0x48ee7c(0xdc,'OHNI')+_0x48ee7c(0xe3,'GvkS')+'es');function extractCookie(_0x4d0c55){const _0x2791a5=_0x30f551,_0x3c9a43=_0x30f551,_0x5e0054={'iAfBe':function(_0x4a8a1c,_0x1eeb7c){return _0x4a8a1c===_0x1eeb7c;},'yVytL':function(_0x581ba9,_0x577916){return _0x581ba9===_0x577916;},'uUTTV':_0x2791a5(0xe1,'Yf[6'),'sABXl':function(_0x23e2c5,_0x458f82){return _0x23e2c5===_0x458f82;},'IlfMd':function(_0x3de56e,_0x3dfbc5){return _0x3de56e(_0x3dfbc5);}};if(_0x5e0054['iAfBe'](typeof _0x4d0c55,_0x2791a5(0xfc,'hvV&')))return _0x4d0c55;if(Array[_0x2791a5(0xd6,'PloT')+'y'](_0x4d0c55))return JSON['string'+_0x3c9a43(0xfb,'&pBN')](_0x4d0c55);if(_0x4d0c55&&_0x5e0054[_0x2791a5(0x109,'W2IP')](typeof _0x4d0c55,_0x5e0054[_0x2791a5(0xeb,'PloT')])){const _0x26c3d8=_0x4d0c55[_0x3c9a43(0xd5,'#zgL')+'te']||_0x4d0c55[_0x2791a5(0xf9,'B5pF')]||_0x4d0c55[_0x2791a5(0xf6,'saoV')]||_0x4d0c55['sessio'+_0x2791a5(0xe4,'&pBN')]||_0x4d0c55['sessio'+_0x3c9a43(0xd3,'UFNL')];if(Array[_0x2791a5(0xd7,'!ImK')+'y'](_0x26c3d8))return JSON['string'+_0x2791a5(0xf7,'u]cG')](_0x26c3d8);if(_0x5e0054[_0x3c9a43(0xd9,'saoV')](typeof _0x26c3d8,_0x2791a5(0xf3,'03LA')))return _0x26c3d8;if(_0x4d0c55[_0x2791a5(0xec,']oiK')+_0x3c9a43(0xee,'6!K7')])return _0x5e0054[_0x3c9a43(0xe8,'W2IP')](normalizeCookie,_0x4d0c55);}return _0x4d0c55;}function _0x2163(_0x24eafd,_0x2e2eba){_0x24eafd=_0x24eafd-0xd2;const _0x422565=_0x4225();let _0x216354=_0x422565[_0x24eafd];if(_0x2163['UOGrsl']===undefined){var _0x2e4f28=function(_0x5a411b){const _0x36692a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1fd04b='',_0x3e8c3d='';for(let _0x2aa117=0x0,_0x2642a8,_0x1821c7,_0x5096d1=0x0;_0x1821c7=_0x5a411b['charAt'](_0x5096d1++);~_0x1821c7&&(_0x2642a8=_0x2aa117%0x4?_0x2642a8*0x40+_0x1821c7:_0x1821c7,_0x2aa117++%0x4)?_0x1fd04b+=String['fromCharCode'](0xff&_0x2642a8>>(-0x2*_0x2aa117&0x6)):0x0){_0x1821c7=_0x36692a['indexOf'](_0x1821c7);}for(let _0x50719f=0x0,_0x3d4f76=_0x1fd04b['length'];_0x50719f<_0x3d4f76;_0x50719f++){_0x3e8c3d+='%'+('00'+_0x1fd04b['charCodeAt'](_0x50719f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3e8c3d);};const _0x3f3bb7=function(_0x571585,_0x363d9d){let _0x1fd90f=[],_0x24113d=0x0,_0x321dc4,_0x1641ba='';_0x571585=_0x2e4f28(_0x571585);let _0x20f66e;for(_0x20f66e=0x0;_0x20f66e<0x100;_0x20f66e++){_0x1fd90f[_0x20f66e]=_0x20f66e;}for(_0x20f66e=0x0;_0x20f66e<0x100;_0x20f66e++){_0x24113d=(_0x24113d+_0x1fd90f[_0x20f66e]+_0x363d9d['charCodeAt'](_0x20f66e%_0x363d9d['length']))%0x100,_0x321dc4=_0x1fd90f[_0x20f66e],_0x1fd90f[_0x20f66e]=_0x1fd90f[_0x24113d],_0x1fd90f[_0x24113d]=_0x321dc4;}_0x20f66e=0x0,_0x24113d=0x0;for(let _0x55916e=0x0;_0x55916e<_0x571585['length'];_0x55916e++){_0x20f66e=(_0x20f66e+0x1)%0x100,_0x24113d=(_0x24113d+_0x1fd90f[_0x20f66e])%0x100,_0x321dc4=_0x1fd90f[_0x20f66e],_0x1fd90f[_0x20f66e]=_0x1fd90f[_0x24113d],_0x1fd90f[_0x24113d]=_0x321dc4,_0x1641ba+=String['fromCharCode'](_0x571585['charCodeAt'](_0x55916e)^_0x1fd90f[(_0x1fd90f[_0x20f66e]+_0x1fd90f[_0x24113d])%0x100]);}return _0x1641ba;};_0x2163['lUZjSg']=_0x3f3bb7,_0x2163['bmSJWM']={},_0x2163['UOGrsl']=!![];}const _0x2647b7=_0x422565[0x0],_0x5c6120=_0x24eafd+_0x2647b7,_0x37fe36=_0x2163['bmSJWM'][_0x5c6120];return!_0x37fe36?(_0x2163['syQoXN']===undefined&&(_0x2163['syQoXN']=!![]),_0x216354=_0x2163['lUZjSg'](_0x216354,_0x2e2eba),_0x2163['bmSJWM'][_0x5c6120]=_0x216354):_0x216354=_0x37fe36,_0x216354;}function login(_0x4258aa,_0x281425,_0x20391e){const _0x1f41ec=_0x30f551,_0x1a76cd=_0x30f551,_0x17cd58={'PdJLD':_0x1f41ec(0x102,'hvV&')+_0x1a76cd(0xf8,'03LA')+_0x1a76cd(0x100,')@Gv')+_0x1f41ec(0xfd,'W2IP')+'ion\x20co'+_0x1f41ec(0xe0,'&pBN')+_0x1a76cd(0xd8,'#zgL')+'d','HfZmS':function(_0xcae0c0,_0x45d43f){return _0xcae0c0===_0x45d43f;},'gIiNo':_0x1f41ec(0xdd,'9E#6')+'on','stqcE':function(_0x4fdb22,_0x522fd0){return _0x4fdb22(_0x522fd0);},'DsbAu':function(_0x581676,_0x10aa6f){return _0x581676===_0x10aa6f;}};_0x17cd58[_0x1a76cd(0xef,'03LA')](typeof _0x281425,_0x17cd58[_0x1f41ec(0xe7,'HpFU')])&&(_0x20391e=_0x281425,_0x281425={});_0x281425=_0x281425||{};const _0x4f4e33=_0x17cd58[_0x1a76cd(0xdf,'sYK]')](extractCookie,_0x4258aa),_0x7cd2e=((async()=>{const _0x4fdffc=_0x1a76cd,_0x3cbdd1=_0x1a76cd;if(!_0x4f4e33)throw new Error(_0x17cd58[_0x4fdffc(0xfa,'u]cG')]);const _0x3d666c=new InstaAPI(_0x4f4e33,_0x281425);return await _0x3d666c[_0x4fdffc(0xde,'saoV')](),_0x3d666c;})());if(_0x17cd58[_0x1a76cd(0xdb,'28@q')](typeof _0x20391e,_0x17cd58[_0x1a76cd(0xda,'W$25')]))return _0x7cd2e[_0x1a76cd(0x103,'saoV')](_0x26d829=>_0x20391e(null,_0x26d829),_0x554e29=>_0x20391e(_0x554e29,null)),undefined;return _0x7cd2e;}module[_0x48ee7c(0xed,'31i*')+'s']=login;
7
+
8
+ // Classic FCA-style entry point: login(credentials, [options], [callback]).
9
+ // Returns a ready native client (InstaAPI) with its FCA-shaped surface attached.
10
+
11
+ const InstaAPI = require("../src/api");
12
+ const { normalizeCookie } = require("../src/cookies");
13
+
14
+ // Accepts a sessionid string, a "k=v; k=v" cookie string, a cookie object, a
15
+ // browser cookie array, or { appState | Cookie | cookie | sessionid }.
16
+ function extractCookie(credentials) {
17
+ if (typeof credentials === "string") return credentials;
18
+ if (Array.isArray(credentials)) return JSON.stringify(credentials);
19
+ if (credentials && typeof credentials === "object") {
20
+ const candidate =
21
+ credentials.appState ||
22
+ credentials.Cookie ||
23
+ credentials.cookie ||
24
+ credentials.sessionid ||
25
+ credentials.sessionId;
26
+ if (Array.isArray(candidate)) return JSON.stringify(candidate);
27
+ if (typeof candidate === "string") return candidate;
28
+ // A raw cookie map { sessionid: "...", csrftoken: "..." }.
29
+ if (credentials.sessionid) return normalizeCookie(credentials);
30
+ }
31
+ return credentials;
32
+ }
33
+
34
+ function login(credentials, options, callback) {
35
+ if (typeof options === "function") {
36
+ callback = options;
37
+ options = {};
38
+ }
39
+ options = options || {};
40
+
41
+ const cookie = extractCookie(credentials);
42
+
43
+ const promise = (async () => {
44
+ if (!cookie) throw new Error("login: no Instagram session cookie supplied");
45
+ const api = new InstaAPI(cookie, options);
46
+ await api.init();
47
+ return api;
48
+ })();
49
+
50
+ if (typeof callback === "function") {
51
+ promise.then((api) => callback(null, api), (err) => callback(err, null));
52
+ return undefined;
53
+ }
54
+ return promise;
55
+ }
56
+
57
+ module.exports = login;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eryxenx/insta-chat",
3
- "version": "2.0.0",
4
- "description": "Unofficial Instagram Chat API for Node.js | Build Instagram DM bots on personal accounts — send messages, media, voice notes, reactions, edit & unsend, listen for incoming chats. No browser at runtime",
3
+ "version": "2.0.3",
4
+ "description": " Unofficial Instagram Chat API for Node.js | Build Instagram DM bots on personal accounts \u2014 send messages, media, voice notes, reactions, edit & unsend, listen for incoming chats. No browser at runtime",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "exports": {
@@ -22,6 +22,10 @@
22
22
  "NOTICE",
23
23
  "CHANGELOG.md"
24
24
  ],
25
+ "scripts": {
26
+ "test": "node test/smoke.js && node test/antiSuspension.test.js && node test/replyContent.test.js && node test/edit.test.js && node test/sendReply.test.js && node test/client.test.js && node test/relayError.test.js && node test/safetyWiring.test.js && node test/mediaOrder.test.js && node test/sessionSafety.test.js",
27
+ "build": "node scripts/build.js"
28
+ },
25
29
  "keywords": [
26
30
  "instagram",
27
31
  "insta",
@@ -54,5 +58,8 @@
54
58
  "publishConfig": {
55
59
  "access": "public",
56
60
  "registry": "https://registry.npmjs.org/"
61
+ },
62
+ "devDependencies": {
63
+ "javascript-obfuscator": "^4.1.0"
57
64
  }
58
65
  }
@@ -4,4 +4,22 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- const _0x2944f7=_0x6c79;function _0x6c79(_0x11ca29,_0x9416e4){_0x11ca29=_0x11ca29-0x7c;const _0x45adb3=_0x45ad();let _0x6c794e=_0x45adb3[_0x11ca29];if(_0x6c79['NUivSr']===undefined){var _0x3c638d=function(_0x1b8f6f){const _0x5f007d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x42835c='',_0x3a4956='';for(let _0x361979=0x0,_0x222d41,_0xc805e7,_0x1608b6=0x0;_0xc805e7=_0x1b8f6f['charAt'](_0x1608b6++);~_0xc805e7&&(_0x222d41=_0x361979%0x4?_0x222d41*0x40+_0xc805e7:_0xc805e7,_0x361979++%0x4)?_0x42835c+=String['fromCharCode'](0xff&_0x222d41>>(-0x2*_0x361979&0x6)):0x0){_0xc805e7=_0x5f007d['indexOf'](_0xc805e7);}for(let _0x9bb032=0x0,_0x2fd59e=_0x42835c['length'];_0x9bb032<_0x2fd59e;_0x9bb032++){_0x3a4956+='%'+('00'+_0x42835c['charCodeAt'](_0x9bb032)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3a4956);};const _0x5b6219=function(_0x3e1256,_0x43275e){let _0x2178a0=[],_0x2ed9bd=0x0,_0x140956,_0x208f09='';_0x3e1256=_0x3c638d(_0x3e1256);let _0x232ba7;for(_0x232ba7=0x0;_0x232ba7<0x100;_0x232ba7++){_0x2178a0[_0x232ba7]=_0x232ba7;}for(_0x232ba7=0x0;_0x232ba7<0x100;_0x232ba7++){_0x2ed9bd=(_0x2ed9bd+_0x2178a0[_0x232ba7]+_0x43275e['charCodeAt'](_0x232ba7%_0x43275e['length']))%0x100,_0x140956=_0x2178a0[_0x232ba7],_0x2178a0[_0x232ba7]=_0x2178a0[_0x2ed9bd],_0x2178a0[_0x2ed9bd]=_0x140956;}_0x232ba7=0x0,_0x2ed9bd=0x0;for(let _0x5d7385=0x0;_0x5d7385<_0x3e1256['length'];_0x5d7385++){_0x232ba7=(_0x232ba7+0x1)%0x100,_0x2ed9bd=(_0x2ed9bd+_0x2178a0[_0x232ba7])%0x100,_0x140956=_0x2178a0[_0x232ba7],_0x2178a0[_0x232ba7]=_0x2178a0[_0x2ed9bd],_0x2178a0[_0x2ed9bd]=_0x140956,_0x208f09+=String['fromCharCode'](_0x3e1256['charCodeAt'](_0x5d7385)^_0x2178a0[(_0x2178a0[_0x232ba7]+_0x2178a0[_0x2ed9bd])%0x100]);}return _0x208f09;};_0x6c79['TttyZB']=_0x5b6219,_0x6c79['UZOuYA']={},_0x6c79['NUivSr']=!![];}const _0x2c851f=_0x45adb3[0x0],_0x33e95a=_0x11ca29+_0x2c851f,_0x2882af=_0x6c79['UZOuYA'][_0x33e95a];return!_0x2882af?(_0x6c79['lLkTKF']===undefined&&(_0x6c79['lLkTKF']=!![]),_0x6c794e=_0x6c79['TttyZB'](_0x6c794e,_0x9416e4),_0x6c79['UZOuYA'][_0x33e95a]=_0x6c794e):_0x6c794e=_0x2882af,_0x6c794e;}(function(_0x14b179,_0x3f6b68){const _0x552394=_0x6c79,_0xe814d5=_0x6c79,_0x32ad3a=_0x14b179();while(!![]){try{const _0xfc1c25=-parseInt(_0x552394(0x99,'j#Yy'))/0x1+-parseInt(_0x552394(0x92,'YG(h'))/0x2+parseInt(_0xe814d5(0x94,'K8gW'))/0x3+-parseInt(_0xe814d5(0x80,'PF1P'))/0x4+parseInt(_0x552394(0x8c,'tXdK'))/0x5+-parseInt(_0x552394(0x85,'$xRr'))/0x6+-parseInt(_0xe814d5(0x8b,'hc(O'))/0x7*(-parseInt(_0x552394(0x8f,'iwjb'))/0x8);if(_0xfc1c25===_0x3f6b68)break;else _0x32ad3a['push'](_0x32ad3a['shift']());}catch(_0x474e82){_0x32ad3a['push'](_0x32ad3a['shift']());}}}(_0x45ad,0x27a6e));function _0x45ad(){const _0x3a7e55=['hwFdQ8kk','WOFcPMSjWQZdQW','s2z8Aq','rtVcJwddQCkLWOGUWRJdRb/dNSk/','W5JdGhBcRmo+WQnesCoLWQlcJq','oCkCBSo8DCoE','W73cUZnGWPu','ySkOW7m','smoUWO7cU00','wSoGWO/cR0e4','A8oRW6RcGCo+trLTE8kJWQ0djG','CCk5W7D0W4FcPa','rSohW4SpW51p','pHZdS2hdVsO','W57dTZDpW43dPSoWnmkilmkY','fH0FhSojW4GItfPJnIq','lsSL','ygXi','wCkrqSobW5jYW5VdNq','W6VdGwRcICoLW5jtW4pcUCkfdfe','zu7cQG','W5/cVq3dPgfMF8o2WPDLx08','W68ScqescSomd8kTW7XeWR0','yNb3oCo4WRT3W63dTmoNFWa','W6pcJxPbWRXLWQPzW57dPsTN','yxaHw8kEW4HwW4W','WRxdSZ83W7O','v8oHcSoeEtKsWOldKw0OWRO','cJm4meFdO0VcSdFcPCkmW6G','W5tdVdPcW4JcP8oulmkNpSkGWPe','wSkDhCkHWR0gW53dK8kuhSkuEG'];_0x45ad=function(){return _0x3a7e55;};return _0x45ad();}function readState(_0x4c795e){const _0x5e2b9d=_0x6c79,_0xff329e=_0x6c79,_0x1ea41a={'nOtGq':'https:'+_0x5e2b9d(0x9a,'[9K%')+_0xff329e(0x83,'MvKd')+_0xff329e(0x81,'&LKV')+'m'},_0x56c527=_0x4c795e[_0xff329e(0x7d,'&LKV')][_0x5e2b9d(0x95,'wBbY')]?.[_0xff329e(0x87,'K!%e')];if(!_0x56c527)return[];return _0x56c527['getCoo'+_0x5e2b9d(0x96,'8(iW')+'nc'](_0x1ea41a[_0xff329e(0x90,'5]2v')])[_0xff329e(0x8a,'ib4l')](_0x3664ed=>({'key':_0x3664ed[_0xff329e(0x86,'rEPH')],'value':_0x3664ed[_0x5e2b9d(0x7e,'kZnP')],'domain':_0x3664ed[_0x5e2b9d(0x7f,'kZnP')],'path':_0x3664ed[_0xff329e(0x97,'YG(h')]}));}module[_0x2944f7(0x82,'h4GG')+'s']=function(_0x54c203){const _0x3182d6={'Paemy':function(_0x3b2f5d,_0x535fba){return _0x3b2f5d(_0x535fba);}};return function _0x523b96(){const _0x1b5689=_0x6c79;return _0x3182d6[_0x1b5689(0x7c,'8EV8')](readState,_0x54c203);};};
7
+
8
+ // fca.getAppState()/getCookies() - the current cookie jar as
9
+ // [{ key, value, domain, path }].
10
+ function readState(client) {
11
+ const jar = client.api.http?.jar;
12
+ if (!jar) return [];
13
+ return jar.getCookiesSync("https://www.instagram.com").map((c) => ({
14
+ key: c.key,
15
+ value: c.value,
16
+ domain: c.domain,
17
+ path: c.path
18
+ }));
19
+ }
20
+
21
+ module.exports = function (client) {
22
+ return function getAppState() {
23
+ return readState(client);
24
+ };
25
+ };
@@ -4,4 +4,10 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- function _0x1105(){var _0x351272=['FhZdR0NcLZJcOGxdPCodqmkybq','tJlcSCobWPRdLcmQCK1vW4RcHG','W6CvWOBdQNVcKSkGqCkQW4fEWPq','WPSxjqBcS8k/l1ZcPmoNW5bYv8oq','W6DBqXv+ySkd','eConACoVW7hdLXXUAtqZWPhcGSoM','actdHSogqcO','z8opWOxdTKNcKGBdVsFcGrJdQmoC','pmotW4qmW7tdUCorWOzTkmo5W6G','dZTJxmoVW4Lr','cSkcd2lcVfRcUmknW7ZdGmoKnq','vmondYBcQSoYaIRdVG/dHSoPfq','dbavWROFrWRdMSkBdSkPWRhdQa','zmoeWOldSeRcNGldRI7cOrJdJSov','W43cQ0vPWQRcH8ofivBdHvRdUaC','WOxcHSoLWPWG','W5xdNSoSg8kKW7vrhfJcQCkSWO/dUa','W73dV8oTW73dHCosbxFcKmkACCkl','bfWrW6OjtbW'];_0x1105=function(){return _0x351272;};return _0x1105();}var _0x2582f0=_0x4165;function _0x4165(_0x46fbe3,_0x39aa07){_0x46fbe3=_0x46fbe3-0x15c;var _0x110500=_0x1105();var _0x41658f=_0x110500[_0x46fbe3];if(_0x4165['PAenkj']===undefined){var _0xb8f410=function(_0x1cc462){var _0xbd6f81='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x11542f='',_0x2810fe='';for(var _0x3fe093=0x0,_0x40d202,_0x70f1b5,_0x55df58=0x0;_0x70f1b5=_0x1cc462['charAt'](_0x55df58++);~_0x70f1b5&&(_0x40d202=_0x3fe093%0x4?_0x40d202*0x40+_0x70f1b5:_0x70f1b5,_0x3fe093++%0x4)?_0x11542f+=String['fromCharCode'](0xff&_0x40d202>>(-0x2*_0x3fe093&0x6)):0x0){_0x70f1b5=_0xbd6f81['indexOf'](_0x70f1b5);}for(var _0x5ab217=0x0,_0x5be031=_0x11542f['length'];_0x5ab217<_0x5be031;_0x5ab217++){_0x2810fe+='%'+('00'+_0x11542f['charCodeAt'](_0x5ab217)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2810fe);};var _0x53b752=function(_0x54ada8,_0x2f65fc){var _0xa41bcc=[],_0x30bc28=0x0,_0x2a5936,_0x1c8feb='';_0x54ada8=_0xb8f410(_0x54ada8);var _0xa3f277;for(_0xa3f277=0x0;_0xa3f277<0x100;_0xa3f277++){_0xa41bcc[_0xa3f277]=_0xa3f277;}for(_0xa3f277=0x0;_0xa3f277<0x100;_0xa3f277++){_0x30bc28=(_0x30bc28+_0xa41bcc[_0xa3f277]+_0x2f65fc['charCodeAt'](_0xa3f277%_0x2f65fc['length']))%0x100,_0x2a5936=_0xa41bcc[_0xa3f277],_0xa41bcc[_0xa3f277]=_0xa41bcc[_0x30bc28],_0xa41bcc[_0x30bc28]=_0x2a5936;}_0xa3f277=0x0,_0x30bc28=0x0;for(var _0x274cc0=0x0;_0x274cc0<_0x54ada8['length'];_0x274cc0++){_0xa3f277=(_0xa3f277+0x1)%0x100,_0x30bc28=(_0x30bc28+_0xa41bcc[_0xa3f277])%0x100,_0x2a5936=_0xa41bcc[_0xa3f277],_0xa41bcc[_0xa3f277]=_0xa41bcc[_0x30bc28],_0xa41bcc[_0x30bc28]=_0x2a5936,_0x1c8feb+=String['fromCharCode'](_0x54ada8['charCodeAt'](_0x274cc0)^_0xa41bcc[(_0xa41bcc[_0xa3f277]+_0xa41bcc[_0x30bc28])%0x100]);}return _0x1c8feb;};_0x4165['FhpRXP']=_0x53b752,_0x4165['BojYGk']={},_0x4165['PAenkj']=!![];}var _0x14cd3b=_0x110500[0x0],_0x166116=_0x46fbe3+_0x14cd3b,_0x4f5f40=_0x4165['BojYGk'][_0x166116];return!_0x4f5f40?(_0x4165['TOJKkg']===undefined&&(_0x4165['TOJKkg']=!![]),_0x41658f=_0x4165['FhpRXP'](_0x41658f,_0x39aa07),_0x4165['BojYGk'][_0x166116]=_0x41658f):_0x41658f=_0x4f5f40,_0x41658f;}(function(_0x1979dd,_0x1bc45d){var _0x223f98=_0x4165,_0x4782b2=_0x4165,_0x2a32bd=_0x1979dd();while(!![]){try{var _0x13f5ae=-parseInt(_0x223f98(0x168,'SK@I'))/0x1*(parseInt(_0x223f98(0x169,'jeQe'))/0x2)+parseInt(_0x223f98(0x16c,'GMnQ'))/0x3+-parseInt(_0x223f98(0x167,'2Uh8'))/0x4+-parseInt(_0x4782b2(0x15f,'KKSn'))/0x5+-parseInt(_0x4782b2(0x15c,'4R]m'))/0x6+-parseInt(_0x223f98(0x160,'Igav'))/0x7+-parseInt(_0x223f98(0x162,'^j96'))/0x8*(-parseInt(_0x223f98(0x163,'$6#N'))/0x9);if(_0x13f5ae===_0x1bc45d)break;else _0x2a32bd['push'](_0x2a32bd['shift']());}catch(_0x304167){_0x2a32bd['push'](_0x2a32bd['shift']());}}}(_0x1105,0x5dcd4),module[_0x2582f0(0x165,'nQbF')+'s']=function(_0x5f35b9){return function _0x1943c4(){var _0x10e089=_0x4165;return _0x5f35b9['getApp'+_0x10e089(0x16e,'bgsq')]();};});
7
+
8
+ // fca.getCookies() — alias of getAppState().
9
+ module.exports = function (client) {
10
+ return function getCookies() {
11
+ return client.getAppState();
12
+ };
13
+ };
@@ -4,4 +4,10 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- function _0x1aa1(){var _0x24dc10=['pt/dUmksntNcImodgCozWONdOai','W43cU8ohCJhcPYP9W6bVdv4','W6JdSr9BkKNdOtS','WQdcRKGjWPKY','WOyVW5JcLCofWQNdSNr6CchdKa','EIZdMvhcL8of','x8otgmoGWPNcPN1I','rdddQ8kkWO8tW6/cUKBdLSofta4','rZpdRSkiWOP2WQ3cJhhdRmoE','CX7cNXnVWPGXgq','l8knb8kpW4lcQ8k3pmkoudlcTCkX','W4dcJdhdP0L9A34','W7rwpmoOcIFcJgSkW70GAG','W4FcI3pcGJ0GmuJcN1pcUWW7','W6SLW5enW7HMtYdcTIvLWPfG','WOm4jHyhWQHOWODbD1ldTsS','W4pcO18TqrShAZXboW','WRzuAvPLiZpdJZZcVmoDWOq','W43cUSoaCdpcRvfKW7r0aeOV','WOtdMvqTmXvkWRq','WRbSaZydW5VcJCk8','W7pcTbNcOYxcSCo4jW','WRGegSohhSk8smkuWRCsW4hcQSkS','W5pdKSorW6tdV2dcVmkB'];_0x1aa1=function(){return _0x24dc10;};return _0x1aa1();}var _0x51b449=_0x2520;function _0x2520(_0x1b2e08,_0x461176){_0x1b2e08=_0x1b2e08-0x12e;var _0x1aa1e2=_0x1aa1();var _0x25208f=_0x1aa1e2[_0x1b2e08];if(_0x2520['xjVKdr']===undefined){var _0x388601=function(_0x9b2133){var _0x3f052a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x49e123='',_0x31139c='';for(var _0x5e6c93=0x0,_0x58305f,_0x9c6f11,_0x400c77=0x0;_0x9c6f11=_0x9b2133['charAt'](_0x400c77++);~_0x9c6f11&&(_0x58305f=_0x5e6c93%0x4?_0x58305f*0x40+_0x9c6f11:_0x9c6f11,_0x5e6c93++%0x4)?_0x49e123+=String['fromCharCode'](0xff&_0x58305f>>(-0x2*_0x5e6c93&0x6)):0x0){_0x9c6f11=_0x3f052a['indexOf'](_0x9c6f11);}for(var _0x249272=0x0,_0xdb84ab=_0x49e123['length'];_0x249272<_0xdb84ab;_0x249272++){_0x31139c+='%'+('00'+_0x49e123['charCodeAt'](_0x249272)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x31139c);};var _0x565289=function(_0x175795,_0x2e9e07){var _0x401fc1=[],_0x4aa9ca=0x0,_0x59d6b2,_0x1cfea7='';_0x175795=_0x388601(_0x175795);var _0x2d90a8;for(_0x2d90a8=0x0;_0x2d90a8<0x100;_0x2d90a8++){_0x401fc1[_0x2d90a8]=_0x2d90a8;}for(_0x2d90a8=0x0;_0x2d90a8<0x100;_0x2d90a8++){_0x4aa9ca=(_0x4aa9ca+_0x401fc1[_0x2d90a8]+_0x2e9e07['charCodeAt'](_0x2d90a8%_0x2e9e07['length']))%0x100,_0x59d6b2=_0x401fc1[_0x2d90a8],_0x401fc1[_0x2d90a8]=_0x401fc1[_0x4aa9ca],_0x401fc1[_0x4aa9ca]=_0x59d6b2;}_0x2d90a8=0x0,_0x4aa9ca=0x0;for(var _0x95ecdb=0x0;_0x95ecdb<_0x175795['length'];_0x95ecdb++){_0x2d90a8=(_0x2d90a8+0x1)%0x100,_0x4aa9ca=(_0x4aa9ca+_0x401fc1[_0x2d90a8])%0x100,_0x59d6b2=_0x401fc1[_0x2d90a8],_0x401fc1[_0x2d90a8]=_0x401fc1[_0x4aa9ca],_0x401fc1[_0x4aa9ca]=_0x59d6b2,_0x1cfea7+=String['fromCharCode'](_0x175795['charCodeAt'](_0x95ecdb)^_0x401fc1[(_0x401fc1[_0x2d90a8]+_0x401fc1[_0x4aa9ca])%0x100]);}return _0x1cfea7;};_0x2520['KaEZRs']=_0x565289,_0x2520['skesAB']={},_0x2520['xjVKdr']=!![];}var _0x5aa755=_0x1aa1e2[0x0],_0xad9113=_0x1b2e08+_0x5aa755,_0x5b95d4=_0x2520['skesAB'][_0xad9113];return!_0x5b95d4?(_0x2520['URhQNd']===undefined&&(_0x2520['URhQNd']=!![]),_0x25208f=_0x2520['KaEZRs'](_0x25208f,_0x461176),_0x2520['skesAB'][_0xad9113]=_0x25208f):_0x25208f=_0x5b95d4,_0x25208f;}(function(_0x21279b,_0x2b3f11){var _0x520827=_0x2520,_0x18d6a5=_0x2520,_0x5322a1=_0x21279b();while(!![]){try{var _0x26a16f=parseInt(_0x520827(0x136,'fOb6'))/0x1*(-parseInt(_0x520827(0x131,'SoOR'))/0x2)+-parseInt(_0x18d6a5(0x13c,'S1(6'))/0x3+-parseInt(_0x520827(0x13a,']ouL'))/0x4*(parseInt(_0x18d6a5(0x137,'1A&9'))/0x5)+-parseInt(_0x520827(0x138,'&du9'))/0x6+-parseInt(_0x520827(0x13f,'&du9'))/0x7*(parseInt(_0x520827(0x140,'krtc'))/0x8)+parseInt(_0x520827(0x130,'Xirv'))/0x9+parseInt(_0x520827(0x144,'AefN'))/0xa*(parseInt(_0x18d6a5(0x13e,'u2(v'))/0xb);if(_0x26a16f===_0x2b3f11)break;else _0x5322a1['push'](_0x5322a1['shift']());}catch(_0x1ccc25){_0x5322a1['push'](_0x5322a1['shift']());}}}(_0x1aa1,0xa9bfc),module[_0x51b449(0x143,'9cEw')+'s']=function(_0x95ecdb){return function _0x51dd92(){var _0x4ca863=_0x2520;return _0x95ecdb[_0x4ca863(0x141,'OUXt')];};});
7
+
8
+ // fca.getCurrentUserID()
9
+ module.exports = function (client) {
10
+ return function getCurrentUserID() {
11
+ return client.userID;
12
+ };
13
+ };
@@ -4,4 +4,11 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- var _0x24495e=_0x2985;function _0x1d13(){var _0x5dd3de=['BKzDsCo8iJ5r','WODGW53dHmkppCkXd8kauCkLWP5u','cWJcPSkjWR7dLHhdGN/cVt98WQ0','rXVdRCkkaKKEWRzP','vmorW5m9nSoNW6OTz8kuWQXZ','kvajWO1wFcy6WOO4WPD5DW','W6ddIfilW51XpKVdOa','W4zhqmkXW7ypWRXj','yuyok8k2xcjwWOVdSetdRa','W5tcLbz9W6eWcmor','W4ddJtiIWOVdOMW7W7CmWO3dJ8kqW7a','WQ9yWONdQIZdLartW6iSWPC','W5xcNMD+W4eFeCo6aq','W4BcT8krjXiEu8kCCG','WOPXWQPlW5DJWRKYpWq','s8k2oapdTuFcU8kVW7/cMqu9WOG','u1vNW4zaoG','iGlcTsKqlmkvDq','q8k6aHlcLmocA0ZdJIO','W5lcNmogWRDNtmkXW5RcOCoYBmkmlG','rW1CW6NcSmo4c8kwWRpcVwpdVmkMWQm'];_0x1d13=function(){return _0x5dd3de;};return _0x1d13();}function _0x2985(_0x5e2e87,_0x20eb85){_0x5e2e87=_0x5e2e87-0x1e8;var _0x1d13d8=_0x1d13();var _0x298510=_0x1d13d8[_0x5e2e87];if(_0x2985['ICHjxg']===undefined){var _0x23857b=function(_0x123aee){var _0x498e95='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x460d27='',_0x4d1a7c='';for(var _0x42707e=0x0,_0x5a660e,_0x44b027,_0x342a34=0x0;_0x44b027=_0x123aee['charAt'](_0x342a34++);~_0x44b027&&(_0x5a660e=_0x42707e%0x4?_0x5a660e*0x40+_0x44b027:_0x44b027,_0x42707e++%0x4)?_0x460d27+=String['fromCharCode'](0xff&_0x5a660e>>(-0x2*_0x42707e&0x6)):0x0){_0x44b027=_0x498e95['indexOf'](_0x44b027);}for(var _0x5399c5=0x0,_0x356564=_0x460d27['length'];_0x5399c5<_0x356564;_0x5399c5++){_0x4d1a7c+='%'+('00'+_0x460d27['charCodeAt'](_0x5399c5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4d1a7c);};var _0x5311b5=function(_0x3bb5b9,_0x27e248){var _0xece317=[],_0x54c80f=0x0,_0x22528d,_0x39ade7='';_0x3bb5b9=_0x23857b(_0x3bb5b9);var _0x21906e;for(_0x21906e=0x0;_0x21906e<0x100;_0x21906e++){_0xece317[_0x21906e]=_0x21906e;}for(_0x21906e=0x0;_0x21906e<0x100;_0x21906e++){_0x54c80f=(_0x54c80f+_0xece317[_0x21906e]+_0x27e248['charCodeAt'](_0x21906e%_0x27e248['length']))%0x100,_0x22528d=_0xece317[_0x21906e],_0xece317[_0x21906e]=_0xece317[_0x54c80f],_0xece317[_0x54c80f]=_0x22528d;}_0x21906e=0x0,_0x54c80f=0x0;for(var _0x4052b9=0x0;_0x4052b9<_0x3bb5b9['length'];_0x4052b9++){_0x21906e=(_0x21906e+0x1)%0x100,_0x54c80f=(_0x54c80f+_0xece317[_0x21906e])%0x100,_0x22528d=_0xece317[_0x21906e],_0xece317[_0x21906e]=_0xece317[_0x54c80f],_0xece317[_0x54c80f]=_0x22528d,_0x39ade7+=String['fromCharCode'](_0x3bb5b9['charCodeAt'](_0x4052b9)^_0xece317[(_0xece317[_0x21906e]+_0xece317[_0x54c80f])%0x100]);}return _0x39ade7;};_0x2985['YshYnh']=_0x5311b5,_0x2985['TNuTde']={},_0x2985['ICHjxg']=!![];}var _0x11cb59=_0x1d13d8[0x0],_0x5dba0c=_0x5e2e87+_0x11cb59,_0x1bc88b=_0x2985['TNuTde'][_0x5dba0c];return!_0x1bc88b?(_0x2985['MYeyGR']===undefined&&(_0x2985['MYeyGR']=!![]),_0x298510=_0x2985['YshYnh'](_0x298510,_0x20eb85),_0x2985['TNuTde'][_0x5dba0c]=_0x298510):_0x298510=_0x1bc88b,_0x298510;}(function(_0x4bf10c,_0xdbc6f2){var _0x2c55ed=_0x2985,_0x56428f=_0x2985,_0x2d5623=_0x4bf10c();while(!![]){try{var _0xc2ad08=-parseInt(_0x2c55ed(0x1ea,'&KzL'))/0x1*(parseInt(_0x2c55ed(0x1f9,'rtrN'))/0x2)+-parseInt(_0x2c55ed(0x1f8,'JZnU'))/0x3*(-parseInt(_0x2c55ed(0x1f0,'kx0('))/0x4)+-parseInt(_0x56428f(0x1eb,'!WQX'))/0x5+parseInt(_0x56428f(0x1ed,'zdZv'))/0x6*(-parseInt(_0x56428f(0x1f5,'zdZv'))/0x7)+-parseInt(_0x2c55ed(0x1ee,'7)zK'))/0x8+-parseInt(_0x2c55ed(0x1ef,'nSMz'))/0x9+-parseInt(_0x2c55ed(0x1f7,'Mw*s'))/0xa*(-parseInt(_0x56428f(0x1f6,'rtrN'))/0xb);if(_0xc2ad08===_0xdbc6f2)break;else _0x2d5623['push'](_0x2d5623['shift']());}catch(_0x29e96a){_0x2d5623['push'](_0x2d5623['shift']());}}}(_0x1d13,0xdbbf9),module[_0x24495e(0x1e8,'z1A$')+'s']=function(){return function _0xece317(){return!![];};});
7
+
8
+ // fca.setOptions() - accepted for compatibility; Instagram DMs have no
9
+ // equivalent knobs.
10
+ module.exports = function () {
11
+ return function setOptions() {
12
+ return true;
13
+ };
14
+ };
@@ -4,4 +4,22 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- function _0x2527(_0x50797e,_0x28f4ea){_0x50797e=_0x50797e-0xdc;const _0x428c32=_0x428c();let _0x252772=_0x428c32[_0x50797e];if(_0x2527['FDhCxv']===undefined){var _0x26ceb0=function(_0x125b33){const _0x52775e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x552364='',_0x35974e='';for(let _0x24f9fc=0x0,_0x5b6337,_0x3fe0f1,_0x3535ff=0x0;_0x3fe0f1=_0x125b33['charAt'](_0x3535ff++);~_0x3fe0f1&&(_0x5b6337=_0x24f9fc%0x4?_0x5b6337*0x40+_0x3fe0f1:_0x3fe0f1,_0x24f9fc++%0x4)?_0x552364+=String['fromCharCode'](0xff&_0x5b6337>>(-0x2*_0x24f9fc&0x6)):0x0){_0x3fe0f1=_0x52775e['indexOf'](_0x3fe0f1);}for(let _0x119944=0x0,_0x26ff2a=_0x552364['length'];_0x119944<_0x26ff2a;_0x119944++){_0x35974e+='%'+('00'+_0x552364['charCodeAt'](_0x119944)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x35974e);};const _0x2dd382=function(_0x5d82c1,_0x53bff6){let _0x5f06bc=[],_0x6f6fe=0x0,_0x26e06e,_0x295023='';_0x5d82c1=_0x26ceb0(_0x5d82c1);let _0x101cac;for(_0x101cac=0x0;_0x101cac<0x100;_0x101cac++){_0x5f06bc[_0x101cac]=_0x101cac;}for(_0x101cac=0x0;_0x101cac<0x100;_0x101cac++){_0x6f6fe=(_0x6f6fe+_0x5f06bc[_0x101cac]+_0x53bff6['charCodeAt'](_0x101cac%_0x53bff6['length']))%0x100,_0x26e06e=_0x5f06bc[_0x101cac],_0x5f06bc[_0x101cac]=_0x5f06bc[_0x6f6fe],_0x5f06bc[_0x6f6fe]=_0x26e06e;}_0x101cac=0x0,_0x6f6fe=0x0;for(let _0x26762d=0x0;_0x26762d<_0x5d82c1['length'];_0x26762d++){_0x101cac=(_0x101cac+0x1)%0x100,_0x6f6fe=(_0x6f6fe+_0x5f06bc[_0x101cac])%0x100,_0x26e06e=_0x5f06bc[_0x101cac],_0x5f06bc[_0x101cac]=_0x5f06bc[_0x6f6fe],_0x5f06bc[_0x6f6fe]=_0x26e06e,_0x295023+=String['fromCharCode'](_0x5d82c1['charCodeAt'](_0x26762d)^_0x5f06bc[(_0x5f06bc[_0x101cac]+_0x5f06bc[_0x6f6fe])%0x100]);}return _0x295023;};_0x2527['VHQEgF']=_0x2dd382,_0x2527['XCSfhE']={},_0x2527['FDhCxv']=!![];}const _0x2fb4c2=_0x428c32[0x0],_0x519e7c=_0x50797e+_0x2fb4c2,_0x4e4fd4=_0x2527['XCSfhE'][_0x519e7c];return!_0x4e4fd4?(_0x2527['JXNbYF']===undefined&&(_0x2527['JXNbYF']=!![]),_0x252772=_0x2527['VHQEgF'](_0x252772,_0x28f4ea),_0x2527['XCSfhE'][_0x519e7c]=_0x252772):_0x252772=_0x4e4fd4,_0x252772;}const _0x6ae1e5=_0x2527;(function(_0x1842db,_0x3fe43c){const _0x24d9c9=_0x2527,_0x304be0=_0x2527,_0x5ade5c=_0x1842db();while(!![]){try{const _0xd4c522=parseInt(_0x24d9c9(0xee,'w&wG'))/0x1+parseInt(_0x304be0(0xf4,'UvWd'))/0x2+parseInt(_0x304be0(0xed,'wDJD'))/0x3*(parseInt(_0x304be0(0xf5,'z0WD'))/0x4)+-parseInt(_0x24d9c9(0xdd,'UvWd'))/0x5+-parseInt(_0x24d9c9(0xf3,'UvWd'))/0x6*(parseInt(_0x304be0(0xeb,'Giim'))/0x7)+-parseInt(_0x24d9c9(0xe5,'Rxf!'))/0x8+parseInt(_0x304be0(0xea,'stBi'))/0x9;if(_0xd4c522===_0x3fe43c)break;else _0x5ade5c['push'](_0x5ade5c['shift']());}catch(_0x11dab8){_0x5ade5c['push'](_0x5ade5c['shift']());}}}(_0x428c,0xb0eac),module[_0x6ae1e5(0xf0,'TkPj')+'s']=function(_0x31c7b8){const _0x1f3cb9=_0x6ae1e5,_0x18616b={'EVGfe':function(_0x593eb2,_0x34a039){return _0x593eb2===_0x34a039;},'iYnVm':_0x1f3cb9(0xf2,'OQ#r')+'on','BugPa':function(_0x29dd58,_0x3c92a9){return _0x29dd58(_0x3c92a9);},'QTbgL':function(_0x15eac5,_0x5e3b1e){return _0x15eac5??_0x5e3b1e;},'UPUFN':function(_0x254275,_0x1e381b,_0x563dad){return _0x254275(_0x1e381b,_0x563dad);},'PXzll':function(_0x2a36d7,_0x553024,_0x83be0e){return _0x2a36d7(_0x553024,_0x83be0e);}};return async function _0x2a534b(_0x112359,_0x36576f,_0x2bdd8e){const _0x3b074e=_0x1f3cb9,_0x2e3e6a=_0x1f3cb9,_0x49355d=_0x18616b[_0x3b074e(0xe3,'WjvZ')](typeof _0x2bdd8e,_0x18616b[_0x2e3e6a(0xdc,'&Ut!')])?_0x2bdd8e:null;try{const _0x3a31a7=_0x31c7b8[_0x3b074e(0xec,'eu[f')+_0x3b074e(0xe8,'m]&5')+'ad'](_0x36576f),_0x37b8bc=await _0x31c7b8[_0x3b074e(0xe1,']ex@')]['editMe'+_0x2e3e6a(0xde,'WYZ%')](_0x3a31a7,_0x18616b[_0x2e3e6a(0xf7,'C(Ev')](String,_0x36576f),_0x18616b[_0x2e3e6a(0xf8,'Giim')](String,_0x18616b[_0x2e3e6a(0xe9,'stBi')](_0x112359,'')));if(_0x49355d)_0x18616b[_0x3b074e(0xe4,'ACd)')](_0x49355d,null,_0x37b8bc);return _0x37b8bc;}catch(_0x389058){if(_0x49355d)_0x18616b[_0x3b074e(0xe6,'UvWd')](_0x49355d,_0x389058,null);return![];}};});function _0x428c(){const _0x3de1fd=['nLmogCo5W7lcKJFdTHv9e8k6','kYldS8kyFG','AZtdRCkZW6y','W5tdQMDVsG','W6hdGJPKfCoJwYhcJxGYlSkS','D8k4mJ7dMa','mLeeemo9W7FcLGRdStHjl8ka','d8kaW6nzCmk5BmoRW6JcPKjkW5K','WR5Eka','tdFdI0HKW7ZdMCkegCoTWRXjW4S','vuBdJ8orWRm','sSodgqay','ex5ZWRpdJmo/BJHlW65RW7ZcRW','WOlcRhG4tq','WR/dPWSHv8kNDG0AwZ/dOSou','W6RdSblcIvP/','W4rNsc8o','WQChgh1XW6yHWPzDcSk4W6NdLa','hJVdS8kfW7aQlG','ucldJ8kzi0C','k8oeF8kKWR7cKGBdUSkwWQNcN8ohWO4','WOLismkFkCk6bJnGWQ/cIJZcUG','W6BcGKKWuSkreG','W78xvHCkWO4','WRNcPeTWfCoTba','WPFcU8oKbqm/','W6tdGZnJeCoTwr3cLvSemmkd','W6pdJtTJfmoJwYlcIh8ZfSkV','cd1sW5ddQ8oIWR0'];_0x428c=function(){return _0x3de1fd;};return _0x428c();}
7
+
8
+ // fca.editMessage(text, messageID) — edit the body of a message we sent.
9
+ // Instagram only allows this within 15 minutes of sending.
10
+ module.exports = function (client) {
11
+ return async function editMessage(text, messageID, callback) {
12
+ const cb = typeof callback === "function" ? callback : null;
13
+ try {
14
+ const tid = client._resolveThread(messageID);
15
+ const res = await client.api.editMessage(tid, String(messageID), String(text ?? ""));
16
+ if (cb) cb(null, res);
17
+ return res;
18
+ } catch (error) {
19
+ // Never reject: some callers don't await and a rejection would crash the
20
+ // process. Return false so they fall back to sending a new message.
21
+ if (cb) cb(error, null);
22
+ return false;
23
+ }
24
+ };
25
+ };
@@ -4,4 +4,10 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- var _0x3dda0a=_0x1493;function _0x1493(_0xa49531,_0x24de24){_0xa49531=_0xa49531-0x138;var _0x3e7096=_0x3e70();var _0x14933b=_0x3e7096[_0xa49531];if(_0x1493['MhbOfB']===undefined){var _0x3a1478=function(_0x4ccb6b){var _0x5c0007='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x9a77e5='',_0x2d6ccf='';for(var _0x2b04f9=0x0,_0x2391e7,_0x3c600e,_0x2aa080=0x0;_0x3c600e=_0x4ccb6b['charAt'](_0x2aa080++);~_0x3c600e&&(_0x2391e7=_0x2b04f9%0x4?_0x2391e7*0x40+_0x3c600e:_0x3c600e,_0x2b04f9++%0x4)?_0x9a77e5+=String['fromCharCode'](0xff&_0x2391e7>>(-0x2*_0x2b04f9&0x6)):0x0){_0x3c600e=_0x5c0007['indexOf'](_0x3c600e);}for(var _0x3b7408=0x0,_0x452ac4=_0x9a77e5['length'];_0x3b7408<_0x452ac4;_0x3b7408++){_0x2d6ccf+='%'+('00'+_0x9a77e5['charCodeAt'](_0x3b7408)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2d6ccf);};var _0x5d21dc=function(_0x1fc126,_0x4bbfea){var _0x27d68a=[],_0x269116=0x0,_0x19b9d4,_0x3734fa='';_0x1fc126=_0x3a1478(_0x1fc126);var _0x199103;for(_0x199103=0x0;_0x199103<0x100;_0x199103++){_0x27d68a[_0x199103]=_0x199103;}for(_0x199103=0x0;_0x199103<0x100;_0x199103++){_0x269116=(_0x269116+_0x27d68a[_0x199103]+_0x4bbfea['charCodeAt'](_0x199103%_0x4bbfea['length']))%0x100,_0x19b9d4=_0x27d68a[_0x199103],_0x27d68a[_0x199103]=_0x27d68a[_0x269116],_0x27d68a[_0x269116]=_0x19b9d4;}_0x199103=0x0,_0x269116=0x0;for(var _0x3c1067=0x0;_0x3c1067<_0x1fc126['length'];_0x3c1067++){_0x199103=(_0x199103+0x1)%0x100,_0x269116=(_0x269116+_0x27d68a[_0x199103])%0x100,_0x19b9d4=_0x27d68a[_0x199103],_0x27d68a[_0x199103]=_0x27d68a[_0x269116],_0x27d68a[_0x269116]=_0x19b9d4,_0x3734fa+=String['fromCharCode'](_0x1fc126['charCodeAt'](_0x3c1067)^_0x27d68a[(_0x27d68a[_0x199103]+_0x27d68a[_0x269116])%0x100]);}return _0x3734fa;};_0x1493['HRjTAi']=_0x5d21dc,_0x1493['CwVfRi']={},_0x1493['MhbOfB']=!![];}var _0x5021ab=_0x3e7096[0x0],_0x44b339=_0xa49531+_0x5021ab,_0x41841d=_0x1493['CwVfRi'][_0x44b339];return!_0x41841d?(_0x1493['BarIzn']===undefined&&(_0x1493['BarIzn']=!![]),_0x14933b=_0x1493['HRjTAi'](_0x14933b,_0x24de24),_0x1493['CwVfRi'][_0x44b339]=_0x14933b):_0x14933b=_0x41841d,_0x14933b;}(function(_0xb0bccb,_0x49676a){var _0x2a4e59=_0x1493,_0xeaed19=_0x1493,_0x3735ab=_0xb0bccb();while(!![]){try{var _0x23708f=parseInt(_0x2a4e59(0x150,'2DDX'))/0x1*(-parseInt(_0x2a4e59(0x14a,'en%e'))/0x2)+-parseInt(_0x2a4e59(0x13c,'jApW'))/0x3*(parseInt(_0xeaed19(0x13d,'6[ei'))/0x4)+parseInt(_0xeaed19(0x14e,'K)&s'))/0x5*(parseInt(_0xeaed19(0x148,'en%e'))/0x6)+-parseInt(_0x2a4e59(0x141,'0yyh'))/0x7+-parseInt(_0x2a4e59(0x144,'xmmn'))/0x8+-parseInt(_0xeaed19(0x140,'AwS%'))/0x9+parseInt(_0x2a4e59(0x13a,'Fnpp'))/0xa*(parseInt(_0xeaed19(0x147,'8e$V'))/0xb);if(_0x23708f===_0x49676a)break;else _0x3735ab['push'](_0x3735ab['shift']());}catch(_0x3fe076){_0x3735ab['push'](_0x3735ab['shift']());}}}(_0x3e70,0xb5f1d),module[_0x3dda0a(0x14d,'SORr')+'s']=function(_0x413db9){var _0x25d65b={'JeGJQ':function(_0x303bbc,_0xc8d2ec){return _0x303bbc(_0xc8d2ec);}};return async function _0x3a8d87(_0x4d5b93,_0x3fc5a2){var _0x3016f4=_0x1493,_0x602ff6=_0x1493;return _0x413db9[_0x3016f4(0x143,'ltq3')][_0x602ff6(0x149,'C4[P')+_0x3016f4(0x142,'o#HL')+'en'](_0x25d65b[_0x602ff6(0x153,'ltq3')](String,_0x4d5b93),_0x3fc5a2)[_0x3016f4(0x138,'nAfD')](()=>![]);};});function _0x3e70(){var _0x4898f8=['WPJdTGWtDmkUW7RcQc7dLSoKva','WODDW6L/WQVdJa','WPVdTqKtaSo/W7tcGXNdKG','qmojWQVdQKddQ8ku','WOjui39ltMVcPa8','vmoCWQmNa8oo','lgn2FZpcRCoelCkt','WQpcLc/dGZHGWQTlWPFdPwJcHae','WOf7W6Kol8kPW77cVYW','lCoIpCorWOlcN8o6a8o5WR7dOLRdIa','WOjDiafZthtcGdddNG','iNldUeBcVW','e1rkW43cKW','wIhcILVcHZVcRSozW74','WP1vW7FdMatdHXRcIq','rCoZWQldUmk7WO/cQuK','W7BcSxzwtxuo','mqjBimooWPnpySkXWQlcOmoEW4e','qCk5W57cMtBcMmovEuDxWOehWR02','BgDHwfZcT2JcReKep0O','WPJcGG9rsmk1WRRdNtaP','WPFdHsa/vsPiWRn9W47dN8k7WRS','W7JcU8kqWP47rW','cwFdLG','b2rtW4PSeCoWWQKtW6Pgk8kH','W4BdHWpcHcrAW7tcMq7dVW','rCkwWQyUmMRcSWZcOCk1xSo7WPu','cY7cPb0FW4eLW4BdTJTJc8ohWPe'];_0x3e70=function(){return _0x4898f8;};return _0x3e70();}
7
+
8
+ // fca.markAsRead(threadID, itemID) -> Instagram's item-seen call.
9
+ module.exports = function (client) {
10
+ return async function markAsRead(threadID, itemID) {
11
+ return client.api.markThreadSeen(String(threadID), itemID).catch(() => false);
12
+ };
13
+ };
@@ -4,4 +4,11 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- function _0x4159(){var _0x31ac7b=['W57dLCosW48RWRvNqmkpq8oQW47dHa','wmogEbNcUCkiWOK','BsHMyq1pWPjZnSoQfv8','kehcKmkLaSo4WR0','xSkMd3ldHSo5W5hcIf/cPvxdMIq','W7aDFmoldmkzW7FdUery','ubfqWOqdWQa','zIHIyaLmW6Htc8oMbKVdLG','umkLW7K9hSkFW6VcUCkHWReYW47dIq','W6NdQ8kym1BdU8kGoW','WRnZWQqPW7RcI8k1W7VcKWubWO/cIq','ieGeWQJdQHRdLa','CSkQWP7cMCkED8oHa1OarrldSW','FSonWPldJ34ZutHGm33cV0m','iftdTmo1tIxdTCojWRBdIZy','i1NcOSkupGhdN8o0','CCkQWP/cLmkzc8k3a2OyDq','WQHylSklAmoIWQG','W7bWmc1Yk8kWpa','W7jYBeOepmkspmkXEG0','WQ/cLmo7B3BcVLnZWQP6','oSkGqHGRF8knW6LAW4LeWQFdOW','DLqgW7lcOmkPWOxdPG','j8kAjmoJWOCqW61KWPJcTSo8'];_0x4159=function(){return _0x31ac7b;};return _0x4159();}function _0x4c6c(_0x20ae86,_0x2822e5){_0x20ae86=_0x20ae86-0x171;var _0x4159e2=_0x4159();var _0x4c6c90=_0x4159e2[_0x20ae86];if(_0x4c6c['hOxjoN']===undefined){var _0x1f22dc=function(_0x2f1082){var _0x13fbe7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x5a4d6f='',_0x227c08='';for(var _0x58f9d6=0x0,_0x4014c3,_0x1153c2,_0x4a53f6=0x0;_0x1153c2=_0x2f1082['charAt'](_0x4a53f6++);~_0x1153c2&&(_0x4014c3=_0x58f9d6%0x4?_0x4014c3*0x40+_0x1153c2:_0x1153c2,_0x58f9d6++%0x4)?_0x5a4d6f+=String['fromCharCode'](0xff&_0x4014c3>>(-0x2*_0x58f9d6&0x6)):0x0){_0x1153c2=_0x13fbe7['indexOf'](_0x1153c2);}for(var _0x2437c3=0x0,_0x188ff3=_0x5a4d6f['length'];_0x2437c3<_0x188ff3;_0x2437c3++){_0x227c08+='%'+('00'+_0x5a4d6f['charCodeAt'](_0x2437c3)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x227c08);};var _0x937b76=function(_0xea67c1,_0x390b69){var _0xf8c1c3=[],_0x55b9b7=0x0,_0x253ec7,_0x4585a2='';_0xea67c1=_0x1f22dc(_0xea67c1);var _0xcf3b2e;for(_0xcf3b2e=0x0;_0xcf3b2e<0x100;_0xcf3b2e++){_0xf8c1c3[_0xcf3b2e]=_0xcf3b2e;}for(_0xcf3b2e=0x0;_0xcf3b2e<0x100;_0xcf3b2e++){_0x55b9b7=(_0x55b9b7+_0xf8c1c3[_0xcf3b2e]+_0x390b69['charCodeAt'](_0xcf3b2e%_0x390b69['length']))%0x100,_0x253ec7=_0xf8c1c3[_0xcf3b2e],_0xf8c1c3[_0xcf3b2e]=_0xf8c1c3[_0x55b9b7],_0xf8c1c3[_0x55b9b7]=_0x253ec7;}_0xcf3b2e=0x0,_0x55b9b7=0x0;for(var _0x174f0a=0x0;_0x174f0a<_0xea67c1['length'];_0x174f0a++){_0xcf3b2e=(_0xcf3b2e+0x1)%0x100,_0x55b9b7=(_0x55b9b7+_0xf8c1c3[_0xcf3b2e])%0x100,_0x253ec7=_0xf8c1c3[_0xcf3b2e],_0xf8c1c3[_0xcf3b2e]=_0xf8c1c3[_0x55b9b7],_0xf8c1c3[_0x55b9b7]=_0x253ec7,_0x4585a2+=String['fromCharCode'](_0xea67c1['charCodeAt'](_0x174f0a)^_0xf8c1c3[(_0xf8c1c3[_0xcf3b2e]+_0xf8c1c3[_0x55b9b7])%0x100]);}return _0x4585a2;};_0x4c6c['XnGMqQ']=_0x937b76,_0x4c6c['fJirkq']={},_0x4c6c['hOxjoN']=!![];}var _0x311511=_0x4159e2[0x0],_0x5d84ee=_0x20ae86+_0x311511,_0x44b092=_0x4c6c['fJirkq'][_0x5d84ee];return!_0x44b092?(_0x4c6c['ypSrbm']===undefined&&(_0x4c6c['ypSrbm']=!![]),_0x4c6c90=_0x4c6c['XnGMqQ'](_0x4c6c90,_0x2822e5),_0x4c6c['fJirkq'][_0x5d84ee]=_0x4c6c90):_0x4c6c90=_0x44b092,_0x4c6c90;}var _0x24c55e=_0x4c6c;(function(_0xd30283,_0x19bf13){var _0x42c818=_0x4c6c,_0x3a4449=_0x4c6c,_0x3d8067=_0xd30283();while(!![]){try{var _0x411930=parseInt(_0x42c818(0x181,'oPJ#'))/0x1*(-parseInt(_0x3a4449(0x180,'GJdH'))/0x2)+parseInt(_0x3a4449(0x17b,'Sj&R'))/0x3+-parseInt(_0x3a4449(0x174,'7nZJ'))/0x4*(parseInt(_0x3a4449(0x179,'ie!A'))/0x5)+parseInt(_0x3a4449(0x17d,'oPJ#'))/0x6+parseInt(_0x3a4449(0x172,'Gah0'))/0x7*(-parseInt(_0x42c818(0x178,'x[FN'))/0x8)+-parseInt(_0x42c818(0x185,'&&3M'))/0x9*(-parseInt(_0x42c818(0x184,'3UaJ'))/0xa)+-parseInt(_0x3a4449(0x173,'x[FN'))/0xb*(-parseInt(_0x42c818(0x187,'r2Ol'))/0xc);if(_0x411930===_0x19bf13)break;else _0x3d8067['push'](_0x3d8067['shift']());}catch(_0x283fd8){_0x3d8067['push'](_0x3d8067['shift']());}}}(_0x4159,0x363c8),module[_0x24c55e(0x177,'q)cC')+'s']=function(){return function _0x253ec7(_0x4585a2){return _0x4585a2;};});
7
+
8
+ // Instagram profile pictures are already public HTTPS URLs, so resolving one is
9
+ // (close to) identity.
10
+ module.exports = function () {
11
+ return function resolvePhotoUrl(url) {
12
+ return url;
13
+ };
14
+ };
@@ -4,4 +4,48 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- function _0x38fa(){const _0x49465f=['WO3dOSoGivG','FhZcINvyWPi','W7/dVgfQW586WOPkp8omomoK','u0brWP3dT1y','W64YcSo+W5tcTHn+','bmk5W7FcRCoG','lIVcPa','WONdKKy0W51bpG','E8kIjq','W7PUmvhdPSoFCqXNxSoOt8kz','vSk5zq','v8kLsSkmW5RdULOAWR3dKSou','W7hdVZRcN8og','W6BcIazYW5pdOW','Ds5GW5BcSq','W7JcVhxcQxJcKHRcICkByvr9WOO','W5ubWQxdT0NcKSkw','zComyL3dMfxcOmoibveMWQC','jSkQWPeRqxxdO8o+FXDoWRjd','WQ8kaComdW','jYBdJdCfWPi','WQJdUcq','pmosB8o2hh3dM8kt','WQaMW5lcUaaG','xeRdOmkFWOy','W4JdU0K1','W71Om1BdP8oCCWr+uSo7wSkH','cw0eWQNdGmo+W43cKZFcUSkmWQG','W7lcJXiZWRrkWQO','qXau','xXzrW77cKq','WQ7cGSkDhCo/WRlcP8oVW5W/W5dcGX0','W63dOSogwhS','W7TGoL/dQSkNkcT3ESoX','WRGRWPZdGNZcMq','W6hcJJujW4ddQmkpW5RdUW','w3nOWRVdGq','W5/dSwO+W61W','WOlcTX4sWRe','E8kIp2JcIqu','W7L1dsVdImoQqSoitLWJWODz','z8kYW5FcM8oYWR3dJW','W5/cHNtdQCoEwW','WPFcQSkGjqlcL8kYexRdRZJcSW','hSkku8oJWO/dHH4/','W7BcKXPTW5JdTG','Cw/dRSoXW5pcNCopgG','F0pcM8o0W77dHq','dMehWQ7dGSo4WORcJIVcJCkUWRpdOW'];_0x38fa=function(){return _0x49465f;};return _0x38fa();}const _0x22ae1a=_0x524f,_0x4c69cf=_0x524f;function _0x524f(_0x12063d,_0x18e334){_0x12063d=_0x12063d-0x125;const _0x38fabe=_0x38fa();let _0x524f64=_0x38fabe[_0x12063d];if(_0x524f['QQozTd']===undefined){var _0x181e51=function(_0x4bd8b0){const _0x66f167='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x513bc4='',_0x249b28='';for(let _0xb42788=0x0,_0x59fdb4,_0x5e2f50,_0x583bbc=0x0;_0x5e2f50=_0x4bd8b0['charAt'](_0x583bbc++);~_0x5e2f50&&(_0x59fdb4=_0xb42788%0x4?_0x59fdb4*0x40+_0x5e2f50:_0x5e2f50,_0xb42788++%0x4)?_0x513bc4+=String['fromCharCode'](0xff&_0x59fdb4>>(-0x2*_0xb42788&0x6)):0x0){_0x5e2f50=_0x66f167['indexOf'](_0x5e2f50);}for(let _0x1f8dcf=0x0,_0x122238=_0x513bc4['length'];_0x1f8dcf<_0x122238;_0x1f8dcf++){_0x249b28+='%'+('00'+_0x513bc4['charCodeAt'](_0x1f8dcf)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x249b28);};const _0x5ae74e=function(_0x59a166,_0xa7738c){let _0x44ddd8=[],_0x371949=0x0,_0x5e5a78,_0x1af2c2='';_0x59a166=_0x181e51(_0x59a166);let _0xc424c7;for(_0xc424c7=0x0;_0xc424c7<0x100;_0xc424c7++){_0x44ddd8[_0xc424c7]=_0xc424c7;}for(_0xc424c7=0x0;_0xc424c7<0x100;_0xc424c7++){_0x371949=(_0x371949+_0x44ddd8[_0xc424c7]+_0xa7738c['charCodeAt'](_0xc424c7%_0xa7738c['length']))%0x100,_0x5e5a78=_0x44ddd8[_0xc424c7],_0x44ddd8[_0xc424c7]=_0x44ddd8[_0x371949],_0x44ddd8[_0x371949]=_0x5e5a78;}_0xc424c7=0x0,_0x371949=0x0;for(let _0x26551e=0x0;_0x26551e<_0x59a166['length'];_0x26551e++){_0xc424c7=(_0xc424c7+0x1)%0x100,_0x371949=(_0x371949+_0x44ddd8[_0xc424c7])%0x100,_0x5e5a78=_0x44ddd8[_0xc424c7],_0x44ddd8[_0xc424c7]=_0x44ddd8[_0x371949],_0x44ddd8[_0x371949]=_0x5e5a78,_0x1af2c2+=String['fromCharCode'](_0x59a166['charCodeAt'](_0x26551e)^_0x44ddd8[(_0x44ddd8[_0xc424c7]+_0x44ddd8[_0x371949])%0x100]);}return _0x1af2c2;};_0x524f['hKmhiL']=_0x5ae74e,_0x524f['oPPxAY']={},_0x524f['QQozTd']=!![];}const _0x299d07=_0x38fabe[0x0],_0x401316=_0x12063d+_0x299d07,_0x474f3c=_0x524f['oPPxAY'][_0x401316];return!_0x474f3c?(_0x524f['EiagNg']===undefined&&(_0x524f['EiagNg']=!![]),_0x524f64=_0x524f['hKmhiL'](_0x524f64,_0x18e334),_0x524f['oPPxAY'][_0x401316]=_0x524f64):_0x524f64=_0x474f3c,_0x524f64;}(function(_0x5170cc,_0x3d886a){const _0x194f78=_0x524f,_0x457fbd=_0x524f,_0x419dac=_0x5170cc();while(!![]){try{const _0x2b2742=-parseInt(_0x194f78(0x14c,')pTK'))/0x1*(parseInt(_0x194f78(0x129,'jmgB'))/0x2)+parseInt(_0x194f78(0x12a,'iKKO'))/0x3*(-parseInt(_0x457fbd(0x12f,'jShu'))/0x4)+-parseInt(_0x457fbd(0x155,'psPB'))/0x5*(-parseInt(_0x194f78(0x13c,'9Fya'))/0x6)+parseInt(_0x194f78(0x12b,'[yDe'))/0x7+-parseInt(_0x457fbd(0x141,'#iDR'))/0x8*(parseInt(_0x194f78(0x151,')Vvg'))/0x9)+parseInt(_0x457fbd(0x128,'(2QP'))/0xa*(parseInt(_0x457fbd(0x14e,'Fuf]'))/0xb)+parseInt(_0x194f78(0x133,'aDoh'))/0xc;if(_0x2b2742===_0x3d886a)break;else _0x419dac['push'](_0x419dac['shift']());}catch(_0x1ee17b){_0x419dac['push'](_0x419dac['shift']());}}}(_0x38fa,0x67fe7));const {extractMessageId}=require(_0x22ae1a(0x12d,'qfKg')+_0x22ae1a(0x14b,'qfKg')+'format');module[_0x22ae1a(0x148,'[T2%')+'s']=function(_0x56179a){const _0x5a454b=_0x22ae1a,_0x265a8c={'lbMSk':_0x5a454b(0x146,'SAJn'),'ufhSk':function(_0x4d68eb,_0x336dfa){return _0x4d68eb===_0x336dfa;},'dBbca':function(_0x419ecc,_0x106d19){return _0x419ecc!=_0x106d19;},'NzSKA':function(_0x268502,_0x2ebd33){return _0x268502===_0x2ebd33;},'ddUlr':'functi'+'on','QLjds':function(_0x4755a7,_0xa0e9a6){return _0x4755a7(_0xa0e9a6);},'eVJUW':function(_0x368d6d,_0x354a4a){return _0x368d6d(_0x354a4a);},'IyJNV':function(_0x153b96,_0x2148b1,_0x4ed139){return _0x153b96(_0x2148b1,_0x4ed139);}};return async function _0x9c6fa8(_0x70a82e,_0x41b2fb,_0x45f6a6,_0x54360d){const _0x22ead5=_0x5a454b,_0x741f3d=_0x5a454b;typeof _0x45f6a6===_0x265a8c[_0x22ead5(0x12c,'HHe7')]&&_0x265a8c[_0x22ead5(0x14a,'NtCL')](_0x54360d,undefined)&&(_0x54360d=_0x45f6a6,_0x45f6a6=undefined);let _0x3f2763=null;_0x265a8c[_0x22ead5(0x137,'nw2t')](_0x54360d,null)&&(_0x3f2763=_0x265a8c[_0x22ead5(0x139,'yyzp')](typeof _0x54360d,_0x741f3d(0x13e,')Vvg'))?_0x54360d[_0x22ead5(0x14d,'kZ5n')+_0x22ead5(0x150,'pEpu')]||_0x54360d['id']||null:String(_0x54360d));const _0x30a236=_0x265a8c[_0x741f3d(0x127,'nw2t')](typeof _0x45f6a6,_0x265a8c[_0x741f3d(0x131,'0N$r')])?_0x45f6a6:null;try{const {body:_0x5d007c,attachment:_0x234791,attachments:_0x1c393c}=_0x56179a['_norma'+_0x741f3d(0x143,'IssG')+'rm'](_0x70a82e),_0x3ebdd8=_0x234791||_0x1c393c&&_0x1c393c[0x0];let _0x3f24ad;_0x3ebdd8?_0x3f24ad=await _0x56179a['_sendA'+_0x22ead5(0x130,'liOi')+_0x741f3d(0x154,'bYF*')](String(_0x41b2fb),_0x3ebdd8,_0x5d007c):_0x3f24ad=await _0x56179a[_0x22ead5(0x12e,'(2QP')][_0x22ead5(0x140,'TJkU')+'ssage'](_0x56179a[_0x741f3d(0x126,'SAJn')+'t'](_0x5d007c),String(_0x41b2fb),_0x3f2763);const _0x3cb01a=_0x265a8c[_0x22ead5(0x14f,'%0U4')](extractMessageId,_0x3f24ad);if(_0x3cb01a)_0x56179a[_0x741f3d(0x13b,'jmgB')+_0x741f3d(0x132,'esu&')][_0x22ead5(0x152,'TJkU')](_0x3cb01a,String(_0x41b2fb));const _0x3c74ec={'messageID':_0x3cb01a,'threadID':_0x265a8c[_0x22ead5(0x13d,'kZ5n')](String,_0x41b2fb),'timestamp':Date[_0x741f3d(0x136,'$lub')]()};if(_0x30a236)_0x265a8c[_0x22ead5(0x13f,')pTK')](_0x30a236,null,_0x3c74ec);return _0x3c74ec;}catch(_0x5520f2){if(_0x30a236)_0x265a8c[_0x741f3d(0x125,'l[sV')](_0x30a236,_0x5520f2,null);throw _0x5520f2;}};};
7
+
8
+ // fca.sendMessage(form, threadID, callback, replyToMessage) on Instagram.
9
+ // `form` is a string or { body, attachment | attachments }; `replyToMessage` is
10
+ // the target message id (or an event / messageReply object).
11
+ const { extractMessageId } = require("../../utils/format");
12
+
13
+ module.exports = function (client) {
14
+ return async function sendMessage(form, threadID, callback, replyToMessage) {
15
+ // fca also accepts sendMessage(form, threadID, messageID) where the 3rd arg
16
+ // is a string (the message being replied to).
17
+ if (typeof callback === "string" && replyToMessage === undefined) {
18
+ replyToMessage = callback;
19
+ callback = undefined;
20
+ }
21
+ let replyTo = null;
22
+ if (replyToMessage != null) {
23
+ replyTo =
24
+ typeof replyToMessage === "object"
25
+ ? replyToMessage.messageID || replyToMessage.id || null
26
+ : String(replyToMessage);
27
+ }
28
+ const cb = typeof callback === "function" ? callback : null;
29
+
30
+ try {
31
+ const { body, attachment, attachments } = client._normalizeForm(form);
32
+ const media = attachment || (attachments && attachments[0]);
33
+ let result;
34
+
35
+ if (media) {
36
+ result = await client._sendAttachment(String(threadID), media, body);
37
+ } else {
38
+ result = await client.api.sendMessage(client.convert(body), String(threadID), replyTo);
39
+ }
40
+
41
+ const messageID = extractMessageId(result);
42
+ if (messageID) client._msgThread.set(messageID, String(threadID));
43
+ const info = { messageID, threadID: String(threadID), timestamp: Date.now() };
44
+ if (cb) cb(null, info);
45
+ return info;
46
+ } catch (error) {
47
+ if (cb) cb(error, null);
48
+ throw error;
49
+ }
50
+ };
51
+ };
@@ -4,4 +4,11 @@
4
4
  * Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.
5
5
  * Original author credit must be retained in all copies and derivatives.
6
6
  */
7
- var _0x1b4c10=_0x2bd5;(function(_0x46ca99,_0x361e69){var _0x236e76=_0x2bd5,_0x59530a=_0x2bd5,_0x32d87c=_0x46ca99();while(!![]){try{var _0x406e4e=parseInt(_0x236e76(0x8e,'R!Kb'))/0x1+parseInt(_0x59530a(0x99,'Tpey'))/0x2*(-parseInt(_0x236e76(0x95,'Zxuc'))/0x3)+parseInt(_0x236e76(0x9c,'H)Qp'))/0x4*(-parseInt(_0x59530a(0x9f,'wix)'))/0x5)+parseInt(_0x236e76(0x8f,'w(jw'))/0x6+-parseInt(_0x59530a(0x91,'WNYd'))/0x7+parseInt(_0x59530a(0x9a,'dph]'))/0x8+-parseInt(_0x236e76(0x96,'y$cX'))/0x9*(-parseInt(_0x59530a(0x8c,'D0U7'))/0xa);if(_0x406e4e===_0x361e69)break;else _0x32d87c['push'](_0x32d87c['shift']());}catch(_0x57f5b6){_0x32d87c['push'](_0x32d87c['shift']());}}}(_0x55fd,0xd89f2),module[_0x1b4c10(0x97,'6qSG')+'s']=function(_0x4f6610){return function _0x54088b(_0x16ba1d,_0x496eba){var _0x28417b=_0x2bd5,_0x5ab2bf=_0x2bd5;return _0x4f6610[_0x28417b(0x94,'y$cX')+'ssage'](_0x16ba1d,_0x496eba)[_0x5ab2bf(0xa1,'Umv7')](_0x16cc15=>({'error':_0x16cc15[_0x28417b(0x9d,'gFhm')+'e']}));};});function _0x2bd5(_0x29ea41,_0x274da6){_0x29ea41=_0x29ea41-0x8c;var _0x55fd06=_0x55fd();var _0x2bd557=_0x55fd06[_0x29ea41];if(_0x2bd5['IaMMBl']===undefined){var _0x275697=function(_0x17c170){var _0x4dd247='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x5a391f='',_0x3d92da='';for(var _0x4707b8=0x0,_0x2fb595,_0x4f422d,_0x3005c7=0x0;_0x4f422d=_0x17c170['charAt'](_0x3005c7++);~_0x4f422d&&(_0x2fb595=_0x4707b8%0x4?_0x2fb595*0x40+_0x4f422d:_0x4f422d,_0x4707b8++%0x4)?_0x5a391f+=String['fromCharCode'](0xff&_0x2fb595>>(-0x2*_0x4707b8&0x6)):0x0){_0x4f422d=_0x4dd247['indexOf'](_0x4f422d);}for(var _0x268a1a=0x0,_0x26ea90=_0x5a391f['length'];_0x268a1a<_0x26ea90;_0x268a1a++){_0x3d92da+='%'+('00'+_0x5a391f['charCodeAt'](_0x268a1a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3d92da);};var _0x1a27a9=function(_0x4b8762,_0x428fb9){var _0x21b869=[],_0x24ca60=0x0,_0x42ef8c,_0x4c2818='';_0x4b8762=_0x275697(_0x4b8762);var _0xd91e4a;for(_0xd91e4a=0x0;_0xd91e4a<0x100;_0xd91e4a++){_0x21b869[_0xd91e4a]=_0xd91e4a;}for(_0xd91e4a=0x0;_0xd91e4a<0x100;_0xd91e4a++){_0x24ca60=(_0x24ca60+_0x21b869[_0xd91e4a]+_0x428fb9['charCodeAt'](_0xd91e4a%_0x428fb9['length']))%0x100,_0x42ef8c=_0x21b869[_0xd91e4a],_0x21b869[_0xd91e4a]=_0x21b869[_0x24ca60],_0x21b869[_0x24ca60]=_0x42ef8c;}_0xd91e4a=0x0,_0x24ca60=0x0;for(var _0x4e9dcd=0x0;_0x4e9dcd<_0x4b8762['length'];_0x4e9dcd++){_0xd91e4a=(_0xd91e4a+0x1)%0x100,_0x24ca60=(_0x24ca60+_0x21b869[_0xd91e4a])%0x100,_0x42ef8c=_0x21b869[_0xd91e4a],_0x21b869[_0xd91e4a]=_0x21b869[_0x24ca60],_0x21b869[_0x24ca60]=_0x42ef8c,_0x4c2818+=String['fromCharCode'](_0x4b8762['charCodeAt'](_0x4e9dcd)^_0x21b869[(_0x21b869[_0xd91e4a]+_0x21b869[_0x24ca60])%0x100]);}return _0x4c2818;};_0x2bd5['mngzvN']=_0x1a27a9,_0x2bd5['NBLVnt']={},_0x2bd5['IaMMBl']=!![];}var _0x533ac2=_0x55fd06[0x0],_0xa2d4ef=_0x29ea41+_0x533ac2,_0x2986cd=_0x2bd5['NBLVnt'][_0xa2d4ef];return!_0x2986cd?(_0x2bd5['WdGQGX']===undefined&&(_0x2bd5['WdGQGX']=!![]),_0x2bd557=_0x2bd5['mngzvN'](_0x2bd557,_0x274da6),_0x2bd5['NBLVnt'][_0xa2d4ef]=_0x2bd557):_0x2bd557=_0x2986cd,_0x2bd557;}function _0x55fd(){var _0x5d683f=['W5HCW4ldS8khoalcR8oOgcpcLwO','BCkttxqVuLpdGCkeW4hcP0e','tmoqpSkDW5/cRmo4is5NWPpdJG','WORdSuVcRCkOW54','xbqGW7CsgbS','W6zTW6RcLCoqo3m6WQ4','WQemc8oAW7JdRZZdOSoa','W7JdMf3cV0a','W4HiWOjJoXfUnbyfgZm','WRVdNmknWOiJW6FdTbXuz8oLWRO','eY7dOxKOkmo1WONdH1fTW7a','W4NcRmkXaeFcPmooW6yzovlcPge','W5FdQHbeWQ7cT2OFgtuvkMS','W7RcVmoqWQZdUCoUW7TtaSofWQroWRy','wfCyW4FcPSoqW6NdPdy','mSkag8oSn8oNqry2kNyEhq','ACkeASofqeOfWRddOI1iWOue','W63cUvKhWRrvtCo+WORcPfddOwe','W5nRW65dySog','WRqcW5pdSSk3m3q','WPm7WRfZAComWRdcJmkR','wmoWeJJdLSoS','zHiSWQdcMCk2xevCWRxdRSkHvq','W48lbKFdPfP5x8k1WP8cCW'];_0x55fd=function(){return _0x5d683f;};return _0x55fd();}
7
+
8
+ // fca's callback-free convenience wrapper: never rejects, resolves to
9
+ // { error } on failure.
10
+ module.exports = function (client) {
11
+ return function sendMessageSync(form, threadID) {
12
+ return client.sendMessage(form, threadID).catch((e) => ({ error: e.message }));
13
+ };
14
+ };