@deffa5556/bail 1.0.6 → 1.0.7

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 (314) hide show
  1. package/cjs/WAProto/index.cjs +106053 -0
  2. package/cjs/deffa/config.cjs +14 -0
  3. package/cjs/deffa/plugins/ai/deepseekr1.cjs +35 -0
  4. package/cjs/deffa/plugins/ai/gita.cjs +26 -0
  5. package/cjs/deffa/plugins/ai/glm47flash.cjs +35 -0
  6. package/cjs/deffa/plugins/ai/gptoss120b.cjs +35 -0
  7. package/cjs/deffa/plugins/ai/qwq32b.cjs +35 -0
  8. package/cjs/deffa/plugins/berita/antara.cjs +25 -0
  9. package/cjs/deffa/plugins/berita/cnbcindonesia.cjs +25 -0
  10. package/cjs/deffa/plugins/berita/cnn.cjs +25 -0
  11. package/cjs/deffa/plugins/berita/kompas.cjs +25 -0
  12. package/cjs/deffa/plugins/berita/liputan6.cjs +25 -0
  13. package/cjs/deffa/plugins/berita/merdeka.cjs +25 -0
  14. package/cjs/deffa/plugins/berita/sindonews.cjs +25 -0
  15. package/cjs/deffa/plugins/berita/tribunnews.cjs +25 -0
  16. package/cjs/deffa/plugins/downloader/douyin.cjs +30 -0
  17. package/cjs/deffa/plugins/downloader/facebook.cjs +30 -0
  18. package/cjs/deffa/plugins/downloader/github.cjs +35 -0
  19. package/cjs/deffa/plugins/downloader/lahelu.cjs +30 -0
  20. package/cjs/deffa/plugins/downloader/snackvideo.cjs +30 -0
  21. package/cjs/deffa/plugins/downloader/soundcloud.cjs +30 -0
  22. package/cjs/deffa/plugins/downloader/tiktok.cjs +30 -0
  23. package/cjs/deffa/plugins/downloader/tiktokhd.cjs +30 -0
  24. package/cjs/deffa/plugins/downloader/twitter.cjs +30 -0
  25. package/cjs/deffa/plugins/downloader/ummy.cjs +36 -0
  26. package/cjs/deffa/plugins/index.cjs +213 -0
  27. package/cjs/deffa/plugins/info/bmkg.cjs +34 -0
  28. package/cjs/deffa/plugins/info/cuaca.cjs +31 -0
  29. package/cjs/deffa/plugins/info/jadwaltv.cjs +29 -0
  30. package/cjs/deffa/plugins/maker/brat.cjs +45 -0
  31. package/cjs/deffa/plugins/maker/bratvid.cjs +52 -0
  32. package/cjs/deffa/plugins/search/8font.cjs +28 -0
  33. package/cjs/deffa/plugins/search/applemusic.cjs +28 -0
  34. package/cjs/deffa/plugins/search/bimg.cjs +30 -0
  35. package/cjs/deffa/plugins/search/brave.cjs +34 -0
  36. package/cjs/deffa/plugins/search/duckduckgo.cjs +28 -0
  37. package/cjs/deffa/plugins/search/lahelu.cjs +28 -0
  38. package/cjs/deffa/plugins/search/mangatoon.cjs +28 -0
  39. package/cjs/deffa/plugins/search/mcpedl.cjs +28 -0
  40. package/cjs/deffa/plugins/search/myinstants.cjs +28 -0
  41. package/cjs/deffa/plugins/search/otakotaku.cjs +28 -0
  42. package/cjs/deffa/plugins/search/pinterest.cjs +30 -0
  43. package/cjs/deffa/plugins/search/resep.cjs +28 -0
  44. package/cjs/deffa/plugins/search/seegore.cjs +30 -0
  45. package/cjs/deffa/plugins/search/soundcloud.cjs +28 -0
  46. package/cjs/deffa/plugins/search/youtube.cjs +28 -0
  47. package/cjs/deffa/plugins/stalk/github.cjs +38 -0
  48. package/cjs/deffa/plugins/stalk/pinterest.cjs +37 -0
  49. package/cjs/deffa/plugins/stalk/threads.cjs +34 -0
  50. package/cjs/deffa/plugins/stalk/tiktok.cjs +37 -0
  51. package/cjs/deffa/plugins/stalk/twitter.cjs +37 -0
  52. package/cjs/deffa/plugins/stalk/youtube.cjs +37 -0
  53. package/cjs/lib/Defaults/index.cjs +158 -0
  54. package/cjs/lib/Discord/Client.cjs +263 -0
  55. package/cjs/lib/Discord/Constants.cjs +1842 -0
  56. package/cjs/lib/Discord/connect-dc.cjs +11 -0
  57. package/cjs/lib/Discord/esm-bridge.cjs +136 -0
  58. package/cjs/lib/Discord/gateway/Dispatcher.cjs +93 -0
  59. package/cjs/lib/Discord/gateway/Shard.cjs +695 -0
  60. package/cjs/lib/Discord/gateway/ShardManager.cjs +344 -0
  61. package/cjs/lib/Discord/gateway/compression/base.cjs +13 -0
  62. package/cjs/lib/Discord/gateway/compression/config.cjs +47 -0
  63. package/cjs/lib/Discord/gateway/compression/pako.cjs +44 -0
  64. package/cjs/lib/Discord/gateway/compression/zlib-native.cjs +47 -0
  65. package/cjs/lib/Discord/gateway/compression/zlib-sync.cjs +31 -0
  66. package/cjs/lib/Discord/gateway/compression/zstd-napi.cjs +80 -0
  67. package/cjs/lib/Discord/gateway/compression/zstd-native.cjs +46 -0
  68. package/cjs/lib/Discord/gateway/events.cjs +956 -0
  69. package/cjs/lib/Discord/index.cjs +238 -0
  70. package/cjs/lib/Discord/rest/Bucket.cjs +69 -0
  71. package/cjs/lib/Discord/rest/DiscordHTTPError.cjs +63 -0
  72. package/cjs/lib/Discord/rest/DiscordRESTError.cjs +84 -0
  73. package/cjs/lib/Discord/rest/OAuthHelper.cjs +226 -0
  74. package/cjs/lib/Discord/rest/RESTManager.cjs +116 -0
  75. package/cjs/lib/Discord/rest/RequestHandler.cjs +320 -0
  76. package/cjs/lib/Discord/rest/SequentialBucket.cjs +69 -0
  77. package/cjs/lib/Discord/routes/Applications.cjs +625 -0
  78. package/cjs/lib/Discord/routes/Channels.cjs +1199 -0
  79. package/cjs/lib/Discord/routes/Guilds.cjs +1792 -0
  80. package/cjs/lib/Discord/routes/Interactions.cjs +212 -0
  81. package/cjs/lib/Discord/routes/Lobbies.cjs +197 -0
  82. package/cjs/lib/Discord/routes/Miscellaneous.cjs +120 -0
  83. package/cjs/lib/Discord/routes/OAuth.cjs +350 -0
  84. package/cjs/lib/Discord/routes/Users.cjs +107 -0
  85. package/cjs/lib/Discord/routes/Webhooks.cjs +308 -0
  86. package/cjs/lib/Discord/structures/AnnouncementChannel.cjs +46 -0
  87. package/cjs/lib/Discord/structures/AnnouncementThreadChannel.cjs +28 -0
  88. package/cjs/lib/Discord/structures/Application.cjs +345 -0
  89. package/cjs/lib/Discord/structures/ApplicationCommand.cjs +109 -0
  90. package/cjs/lib/Discord/structures/Attachment.cjs +46 -0
  91. package/cjs/lib/Discord/structures/AuditLogEntry.cjs +41 -0
  92. package/cjs/lib/Discord/structures/AutoModerationRule.cjs +117 -0
  93. package/cjs/lib/Discord/structures/AutocompleteInteraction.cjs +90 -0
  94. package/cjs/lib/Discord/structures/Base.cjs +56 -0
  95. package/cjs/lib/Discord/structures/BaseEntitlement.cjs +40 -0
  96. package/cjs/lib/Discord/structures/CategoryChannel.cjs +102 -0
  97. package/cjs/lib/Discord/structures/Channel.cjs +89 -0
  98. package/cjs/lib/Discord/structures/ClientApplication.cjs +269 -0
  99. package/cjs/lib/Discord/structures/CommandInteraction.cjs +294 -0
  100. package/cjs/lib/Discord/structures/ComponentInteraction.cjs +306 -0
  101. package/cjs/lib/Discord/structures/Entitlement.cjs +24 -0
  102. package/cjs/lib/Discord/structures/ExtendedUser.cjs +48 -0
  103. package/cjs/lib/Discord/structures/ForumChannel.cjs +20 -0
  104. package/cjs/lib/Discord/structures/GroupChannel.cjs +160 -0
  105. package/cjs/lib/Discord/structures/Guild.cjs +1289 -0
  106. package/cjs/lib/Discord/structures/GuildChannel.cjs +82 -0
  107. package/cjs/lib/Discord/structures/GuildPreview.cjs +141 -0
  108. package/cjs/lib/Discord/structures/GuildScheduledEvent.cjs +166 -0
  109. package/cjs/lib/Discord/structures/GuildTemplate.cjs +96 -0
  110. package/cjs/lib/Discord/structures/Integration.cjs +123 -0
  111. package/cjs/lib/Discord/structures/Interaction.cjs +78 -0
  112. package/cjs/lib/Discord/structures/InteractionResolvedChannel.cjs +36 -0
  113. package/cjs/lib/Discord/structures/Invite.cjs +196 -0
  114. package/cjs/lib/Discord/structures/InviteGuild.cjs +117 -0
  115. package/cjs/lib/Discord/structures/InviteRole.cjs +88 -0
  116. package/cjs/lib/Discord/structures/Lobby.cjs +84 -0
  117. package/cjs/lib/Discord/structures/LobbyMember.cjs +30 -0
  118. package/cjs/lib/Discord/structures/MediaChannel.cjs +20 -0
  119. package/cjs/lib/Discord/structures/Member.cjs +300 -0
  120. package/cjs/lib/Discord/structures/Message.cjs +553 -0
  121. package/cjs/lib/Discord/structures/ModalSubmitInteraction.cjs +263 -0
  122. package/cjs/lib/Discord/structures/OAuthApplication.cjs +203 -0
  123. package/cjs/lib/Discord/structures/OAuthGuild.cjs +98 -0
  124. package/cjs/lib/Discord/structures/PartialApplication.cjs +97 -0
  125. package/cjs/lib/Discord/structures/Permission.cjs +61 -0
  126. package/cjs/lib/Discord/structures/PermissionOverwrite.cjs +46 -0
  127. package/cjs/lib/Discord/structures/PingInteraction.cjs +27 -0
  128. package/cjs/lib/Discord/structures/Poll.cjs +69 -0
  129. package/cjs/lib/Discord/structures/PrimaryGuild.cjs +93 -0
  130. package/cjs/lib/Discord/structures/PrivateChannel.cjs +131 -0
  131. package/cjs/lib/Discord/structures/PrivateThreadChannel.cjs +28 -0
  132. package/cjs/lib/Discord/structures/PublicThreadChannel.cjs +36 -0
  133. package/cjs/lib/Discord/structures/Role.cjs +126 -0
  134. package/cjs/lib/Discord/structures/SKU.cjs +58 -0
  135. package/cjs/lib/Discord/structures/Soundboard.cjs +58 -0
  136. package/cjs/lib/Discord/structures/StageChannel.cjs +45 -0
  137. package/cjs/lib/Discord/structures/StageInstance.cjs +80 -0
  138. package/cjs/lib/Discord/structures/Subscription.cjs +21 -0
  139. package/cjs/lib/Discord/structures/Team.cjs +70 -0
  140. package/cjs/lib/Discord/structures/TestEntitlement.cjs +22 -0
  141. package/cjs/lib/Discord/structures/TextChannel.cjs +48 -0
  142. package/cjs/lib/Discord/structures/TextableChannel.cjs +265 -0
  143. package/cjs/lib/Discord/structures/TextableVoiceChannel.cjs +70 -0
  144. package/cjs/lib/Discord/structures/ThreadChannel.cjs +276 -0
  145. package/cjs/lib/Discord/structures/ThreadOnlyChannel.cjs +205 -0
  146. package/cjs/lib/Discord/structures/ThreadableChannel.cjs +57 -0
  147. package/cjs/lib/Discord/structures/UnavailableGuild.cjs +21 -0
  148. package/cjs/lib/Discord/structures/User.cjs +223 -0
  149. package/cjs/lib/Discord/structures/VoiceChannel.cjs +34 -0
  150. package/cjs/lib/Discord/structures/VoiceState.cjs +113 -0
  151. package/cjs/lib/Discord/structures/Webhook.cjs +224 -0
  152. package/cjs/lib/Discord/util/Collection.cjs +77 -0
  153. package/cjs/lib/Discord/util/Errors.cjs +81 -0
  154. package/cjs/lib/Discord/util/QueryBuilder.cjs +20 -0
  155. package/cjs/lib/Discord/util/Routes.cjs +293 -0
  156. package/cjs/lib/Discord/util/SimpleCollection.cjs +78 -0
  157. package/cjs/lib/Discord/util/Time.cjs +92 -0
  158. package/cjs/lib/Discord/util/TypedCollection.cjs +78 -0
  159. package/cjs/lib/Discord/util/TypedEmitter.cjs +20 -0
  160. package/cjs/lib/Discord/util/Util.cjs +906 -0
  161. package/cjs/lib/Discord/util/interactions/InteractionOptionsWrapper.cjs +207 -0
  162. package/cjs/lib/Discord/util/interactions/MessageInteractionResponse.cjs +26 -0
  163. package/cjs/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.cjs +98 -0
  164. package/cjs/lib/Discord/util/interactions/SelectMenuValuesWrapper.cjs +77 -0
  165. package/cjs/lib/Discord/util/interactions/shared.cjs +20 -0
  166. package/cjs/lib/Discord/util/warning.cjs +34 -0
  167. package/cjs/lib/Signal/Group/ciphertext-message.cjs +16 -0
  168. package/cjs/lib/Signal/Group/group-session-builder.cjs +67 -0
  169. package/cjs/lib/Signal/Group/group_cipher.cjs +86 -0
  170. package/cjs/lib/Signal/Group/index.cjs +58 -0
  171. package/cjs/lib/Signal/Group/keyhelper.cjs +56 -0
  172. package/cjs/lib/Signal/Group/sender-chain-key.cjs +30 -0
  173. package/cjs/lib/Signal/Group/sender-key-distribution-message.cjs +67 -0
  174. package/cjs/lib/Signal/Group/sender-key-message.cjs +70 -0
  175. package/cjs/lib/Signal/Group/sender-key-name.cjs +52 -0
  176. package/cjs/lib/Signal/Group/sender-key-record.cjs +45 -0
  177. package/cjs/lib/Signal/Group/sender-key-state.cjs +88 -0
  178. package/cjs/lib/Signal/Group/sender-message-key.cjs +30 -0
  179. package/cjs/lib/Signal/libsignal.cjs +467 -0
  180. package/cjs/lib/Signal/lid-mapping.cjs +281 -0
  181. package/cjs/lib/Socket/Client/index.cjs +19 -0
  182. package/cjs/lib/Socket/Client/types.cjs +15 -0
  183. package/cjs/lib/Socket/Client/websocket.cjs +61 -0
  184. package/cjs/lib/Socket/business.cjs +384 -0
  185. package/cjs/lib/Socket/chats.cjs +1221 -0
  186. package/cjs/lib/Socket/communities.cjs +440 -0
  187. package/cjs/lib/Socket/groups.cjs +353 -0
  188. package/cjs/lib/Socket/index.cjs +14 -0
  189. package/cjs/lib/Socket/messages-recv.cjs +1772 -0
  190. package/cjs/lib/Socket/messages-send.cjs +1376 -0
  191. package/cjs/lib/Socket/mex.cjs +46 -0
  192. package/cjs/lib/Socket/newsletter.cjs +230 -0
  193. package/cjs/lib/Socket/socket.cjs +976 -0
  194. package/cjs/lib/Store/index.cjs +20 -0
  195. package/cjs/lib/Store/make-in-memory-store.cjs +470 -0
  196. package/cjs/lib/Store/make-ordered-dictionary.cjs +82 -0
  197. package/cjs/lib/Store/object-repository.cjs +28 -0
  198. package/cjs/lib/Telegram/button.cjs +147 -0
  199. package/cjs/lib/Telegram/composer.cjs +582 -0
  200. package/cjs/lib/Telegram/context.cjs +853 -0
  201. package/cjs/lib/Telegram/core/helpers/args.cjs +57 -0
  202. package/cjs/lib/Telegram/core/helpers/check.cjs +55 -0
  203. package/cjs/lib/Telegram/core/helpers/compact.cjs +16 -0
  204. package/cjs/lib/Telegram/core/helpers/deunionize.cjs +12 -0
  205. package/cjs/lib/Telegram/core/helpers/formatting.cjs +91 -0
  206. package/cjs/lib/Telegram/core/helpers/util.cjs +50 -0
  207. package/cjs/lib/Telegram/core/network/client.cjs +338 -0
  208. package/cjs/lib/Telegram/core/network/error.cjs +21 -0
  209. package/cjs/lib/Telegram/core/network/multipart-stream.cjs +79 -0
  210. package/cjs/lib/Telegram/core/network/polling.cjs +87 -0
  211. package/cjs/lib/Telegram/core/network/webhook.cjs +54 -0
  212. package/cjs/lib/Telegram/core/types/typegram.cjs +31 -0
  213. package/cjs/lib/Telegram/deffa-telegraf.cjs +264 -0
  214. package/cjs/lib/Telegram/esm-bridge.cjs +20 -0
  215. package/cjs/lib/Telegram/filters.cjs +69 -0
  216. package/cjs/lib/Telegram/format.cjs +58 -0
  217. package/cjs/lib/Telegram/future.cjs +140 -0
  218. package/cjs/lib/Telegram/index.cjs +67 -0
  219. package/cjs/lib/Telegram/input.cjs +61 -0
  220. package/cjs/lib/Telegram/markup.cjs +129 -0
  221. package/cjs/lib/Telegram/middleware.cjs +2 -0
  222. package/cjs/lib/Telegram/reactions.cjs +84 -0
  223. package/cjs/lib/Telegram/router.cjs +46 -0
  224. package/cjs/lib/Telegram/scenes/base.cjs +39 -0
  225. package/cjs/lib/Telegram/scenes/context.cjs +104 -0
  226. package/cjs/lib/Telegram/scenes/index.cjs +21 -0
  227. package/cjs/lib/Telegram/scenes/stage.cjs +49 -0
  228. package/cjs/lib/Telegram/scenes/wizard/context.cjs +31 -0
  229. package/cjs/lib/Telegram/scenes/wizard/index.cjs +45 -0
  230. package/cjs/lib/Telegram/scenes.cjs +21 -0
  231. package/cjs/lib/Telegram/session.cjs +166 -0
  232. package/cjs/lib/Telegram/telegram-types.cjs +6 -0
  233. package/cjs/lib/Telegram/telegram.cjs +945 -0
  234. package/cjs/lib/Telegram/types.cjs +2 -0
  235. package/cjs/lib/Telegram/utils.cjs +5 -0
  236. package/cjs/lib/Types/Auth.cjs +3 -0
  237. package/cjs/lib/Types/Bussines.cjs +3 -0
  238. package/cjs/lib/Types/Call.cjs +3 -0
  239. package/cjs/lib/Types/Chat.cjs +11 -0
  240. package/cjs/lib/Types/Contact.cjs +3 -0
  241. package/cjs/lib/Types/Events.cjs +4 -0
  242. package/cjs/lib/Types/GroupMetadata.cjs +3 -0
  243. package/cjs/lib/Types/Label.cjs +26 -0
  244. package/cjs/lib/Types/LabelAssociation.cjs +8 -0
  245. package/cjs/lib/Types/Message.cjs +19 -0
  246. package/cjs/lib/Types/Mex.cjs +40 -0
  247. package/cjs/lib/Types/Product.cjs +3 -0
  248. package/cjs/lib/Types/RichType.cjs +24 -0
  249. package/cjs/lib/Types/Signal.cjs +4 -0
  250. package/cjs/lib/Types/Socket.cjs +4 -0
  251. package/cjs/lib/Types/State.cjs +54 -0
  252. package/cjs/lib/Types/USync.cjs +4 -0
  253. package/cjs/lib/Types/index.cjs +42 -0
  254. package/cjs/lib/Utils/auth-utils.cjs +312 -0
  255. package/cjs/lib/Utils/browser-utils.cjs +39 -0
  256. package/cjs/lib/Utils/business.cjs +241 -0
  257. package/cjs/lib/Utils/chat-utils.cjs +890 -0
  258. package/cjs/lib/Utils/companion-reg-client-utils.cjs +51 -0
  259. package/cjs/lib/Utils/crypto.cjs +170 -0
  260. package/cjs/lib/Utils/decode-wa-message.cjs +330 -0
  261. package/cjs/lib/Utils/event-buffer.cjs +629 -0
  262. package/cjs/lib/Utils/generics.cjs +427 -0
  263. package/cjs/lib/Utils/history.cjs +141 -0
  264. package/cjs/lib/Utils/identity-change-handler.cjs +56 -0
  265. package/cjs/lib/Utils/index.cjs +43 -0
  266. package/cjs/lib/Utils/link-preview.cjs +122 -0
  267. package/cjs/lib/Utils/logger.cjs +8 -0
  268. package/cjs/lib/Utils/lt-hash.cjs +11 -0
  269. package/cjs/lib/Utils/make-mutex.cjs +38 -0
  270. package/cjs/lib/Utils/message-retry-manager.cjs +267 -0
  271. package/cjs/lib/Utils/messages-media.cjs +906 -0
  272. package/cjs/lib/Utils/messages.cjs +1909 -0
  273. package/cjs/lib/Utils/noise-handler.cjs +205 -0
  274. package/cjs/lib/Utils/offline-node-processor.cjs +43 -0
  275. package/cjs/lib/Utils/pre-key-manager.cjs +113 -0
  276. package/cjs/lib/Utils/process-message.cjs +755 -0
  277. package/cjs/lib/Utils/reporting-utils.cjs +263 -0
  278. package/cjs/lib/Utils/rich-message-utils.cjs +434 -0
  279. package/cjs/lib/Utils/session-guard.cjs +163 -0
  280. package/cjs/lib/Utils/signal.cjs +214 -0
  281. package/cjs/lib/Utils/stanza-ack.cjs +41 -0
  282. package/cjs/lib/Utils/sync-action-utils.cjs +54 -0
  283. package/cjs/lib/Utils/tc-token-utils.cjs +174 -0
  284. package/cjs/lib/Utils/text-sticker.cjs +174 -0
  285. package/cjs/lib/Utils/use-multi-file-auth-state.cjs +125 -0
  286. package/cjs/lib/Utils/use-single-file-auth-state.cjs +113 -0
  287. package/cjs/lib/Utils/use-sqlite-auth-state.cjs +145 -0
  288. package/cjs/lib/Utils/validate-connection.cjs +210 -0
  289. package/cjs/lib/WABinary/constants.cjs +1470 -0
  290. package/cjs/lib/WABinary/decode.cjs +301 -0
  291. package/cjs/lib/WABinary/encode.cjs +257 -0
  292. package/cjs/lib/WABinary/generic-utils.cjs +240 -0
  293. package/cjs/lib/WABinary/index.cjs +22 -0
  294. package/cjs/lib/WABinary/jid-utils.cjs +114 -0
  295. package/cjs/lib/WABinary/types.cjs +37 -0
  296. package/cjs/lib/WAM/BinaryInfo.cjs +14 -0
  297. package/cjs/lib/WAM/constants.cjs +22856 -0
  298. package/cjs/lib/WAM/encode.cjs +154 -0
  299. package/cjs/lib/WAM/index.cjs +20 -0
  300. package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.cjs +56 -0
  301. package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.cjs +58 -0
  302. package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.cjs +31 -0
  303. package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.cjs +42 -0
  304. package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.cjs +29 -0
  305. package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.cjs +55 -0
  306. package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.cjs +33 -0
  307. package/cjs/lib/WAUSync/Protocols/index.cjs +22 -0
  308. package/cjs/lib/WAUSync/USyncQuery.cjs +102 -0
  309. package/cjs/lib/WAUSync/USyncUser.cjs +35 -0
  310. package/cjs/lib/WAUSync/index.cjs +20 -0
  311. package/cjs/lib/index.cjs +372 -0
  312. package/cjs/lib/plugins/loader.cjs +117 -0
  313. package/lib/Defaults/index.js +1 -1
  314. package/package.json +11 -6
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) {
3
+ if (k2 === undefined)
4
+ k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function () { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function (o, m, k, k2) {
11
+ if (k2 === undefined)
12
+ k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function (o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function (o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function (o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o)
25
+ if (Object.prototype.hasOwnProperty.call(o, k))
26
+ ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule)
33
+ return mod;
34
+ var result = {};
35
+ if (mod != null)
36
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
37
+ if (k[i] !== "default")
38
+ __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ const Routes = __importStar(require("../util/Routes"));
48
+ const OAuthApplication_1 = __importDefault(require("../structures/OAuthApplication"));
49
+ const PartialApplication_1 = __importDefault(require("../structures/PartialApplication"));
50
+ const Member_1 = __importDefault(require("../structures/Member"));
51
+ const Webhook_1 = __importDefault(require("../structures/Webhook"));
52
+ const Integration_1 = __importDefault(require("../structures/Integration"));
53
+ const OAuthHelper_1 = __importDefault(require("../rest/OAuthHelper"));
54
+ const OAuthGuild_1 = __importDefault(require("../structures/OAuthGuild"));
55
+ const ExtendedUser_1 = __importDefault(require("../structures/ExtendedUser"));
56
+ const QueryBuilder_1 = __importDefault(require("../util/QueryBuilder"));
57
+ /** Various methods for interacting with oauth. Located at {@link Client#rest | Client#rest}{@link RESTManager#oauth | .oauth}. */
58
+ class OAuth {
59
+ constructor(manager) {
60
+ this._manager = manager;
61
+ }
62
+ /**
63
+ * Get an access token for the application owner. If the application is owned by a team, this is restricted to `identify` & `applications.commands.update`.
64
+ * @param options The options to for the client credentials grant.
65
+ * @caching This method **does not** cache its result.
66
+ */
67
+ async clientCredentialsGrant(options) {
68
+ options = this._manager.client.util._freeze(options);
69
+ const form = new FormData();
70
+ form.append("grant_type", "client_credentials");
71
+ form.append("scope", options.scopes.join(" "));
72
+ return this._manager.request({
73
+ method: "POST",
74
+ path: Routes.OAUTH_TOKEN,
75
+ form,
76
+ auth: (options.clientID ?? this._manager.client["_application"]) && options.clientSecret ? `Basic ${Buffer.from(`${options.clientID ?? this._manager.client["_application"].id}:${options.clientSecret}`).toString("base64")}` : true
77
+ }).then(data => ({
78
+ accessToken: data.access_token,
79
+ expiresIn: data.expires_in,
80
+ scopes: data.scope.split(" "),
81
+ tokenType: data.token_type,
82
+ webhook: data.webhook ? new Webhook_1.default(data.webhook, this._manager.client) : null
83
+ }));
84
+ }
85
+ /**
86
+ * Exchange a code for an access token.
87
+ * @param options The options for exchanging the code.
88
+ * @caching This method **does not** cache its result.
89
+ */
90
+ async exchangeCode(options) {
91
+ options = this._manager.client.util._freeze(options);
92
+ const form = new FormData();
93
+ form.append("client_id", options.clientID);
94
+ form.append("client_secret", options.clientSecret);
95
+ form.append("code", options.code);
96
+ form.append("grant_type", "authorization_code");
97
+ form.append("redirect_uri", options.redirectURI);
98
+ return this._manager.authRequest({
99
+ method: "POST",
100
+ path: Routes.OAUTH_TOKEN,
101
+ form
102
+ }).then(data => ({
103
+ accessToken: data.access_token,
104
+ expiresIn: data.expires_in,
105
+ refreshToken: data.refresh_token,
106
+ scopes: data.scope.split(" "),
107
+ tokenType: data.token_type,
108
+ webhook: data.webhook ? new Webhook_1.default(data.webhook, this._manager.client) : null
109
+ }));
110
+ }
111
+ /**
112
+ * Get the current OAuth2 application's information.
113
+ * @caching This method **does not** cache its result.
114
+ */
115
+ async getApplication() {
116
+ return this._manager.authRequest({
117
+ method: "GET",
118
+ path: Routes.OAUTH_APPLICATION
119
+ }).then(data => new OAuthApplication_1.default(data, this._manager.client));
120
+ }
121
+ /**
122
+ * Get information about the current authorization.
123
+ *
124
+ * Note: OAuth only. Bots cannot use this.
125
+ * @caching This method **does** cache part of its result.
126
+ * @caches {@link Client#users | Client#users}
127
+ */
128
+ async getCurrentAuthorizationInformation() {
129
+ return this._manager.authRequest({
130
+ method: "GET",
131
+ path: Routes.OAUTH_INFO
132
+ }).then(data => ({
133
+ application: new PartialApplication_1.default(data.application, this._manager.client),
134
+ expires: new Date(data.expires),
135
+ scopes: data.scopes,
136
+ user: this._manager.client.users.update(data.user)
137
+ }));
138
+ }
139
+ /**
140
+ * Get the connections of the currently authenticated user.
141
+ *
142
+ * Note: Requires the `connections` scope when using oauth.
143
+ * @caching This method **does not** cache its result.
144
+ */
145
+ async getCurrentConnections() {
146
+ return this._manager.authRequest({
147
+ method: "GET",
148
+ path: Routes.OAUTH_CONNECTIONS
149
+ }).then(data => data.map(connection => ({
150
+ friendSync: connection.friend_sync,
151
+ id: connection.id,
152
+ integrations: connection.integrations?.map(integration => new Integration_1.default(integration, this._manager.client)),
153
+ name: connection.name,
154
+ revoked: connection.revoked,
155
+ showActivity: connection.show_activity,
156
+ twoWayLink: connection.two_way_link,
157
+ type: connection.type,
158
+ verified: connection.verified,
159
+ visibility: connection.visibility
160
+ })));
161
+ }
162
+ /**
163
+ * Get the guild member information about the currently authenticated user.
164
+ *
165
+ * Note: OAuth only. Requires the `guilds.members.read` scope. Bots cannot use this.
166
+ * @param guild the ID of the guild
167
+ * @caching This method **does not** cache its result.
168
+ */
169
+ async getCurrentGuildMember(guild) {
170
+ return this._manager.authRequest({
171
+ method: "GET",
172
+ path: Routes.OAUTH_GUILD_MEMBER(guild)
173
+ }).then(data => new Member_1.default(data, this._manager.client, guild));
174
+ }
175
+ /**
176
+ * Get the currently authenticated user's guilds. Note these are missing several properties gateway guilds have.
177
+ * @param options The options for getting the current user's guilds.
178
+ * @caching This method **does not** cache its result.
179
+ */
180
+ async getCurrentGuilds(options) {
181
+ const query = new QueryBuilder_1.default();
182
+ query.setIfPresent("after", options?.after);
183
+ query.setIfPresent("before", options?.before);
184
+ query.setIfPresent("limit", options?.limit);
185
+ query.setIfPresent("with_counts", options?.withCounts);
186
+ return this._manager.authRequest({
187
+ method: "GET",
188
+ path: Routes.OAUTH_GUILDS,
189
+ query
190
+ }).then(data => data.map(d => new OAuthGuild_1.default(d, this._manager.client)));
191
+ }
192
+ /**
193
+ * Get the currently authenticated user's information.
194
+ * @caching This method **does not** cache its result.
195
+ */
196
+ async getCurrentUser() {
197
+ return this._manager.authRequest({
198
+ method: "GET",
199
+ path: Routes.OAUTH_CURRENT_USER
200
+ }).then(data => new ExtendedUser_1.default(data, this._manager.client));
201
+ }
202
+ /**
203
+ * Get a helper instance that can be used with a specific access token.
204
+ * @param accessToken The access token. Must be prefixed with `Bearer `.
205
+ */
206
+ getHelper(accessToken) {
207
+ return new OAuthHelper_1.default(this._manager, accessToken);
208
+ }
209
+ /**
210
+ * Get an application's role connection metadata records.
211
+ * @param applicationID The ID of the application.
212
+ * @caching This method **does not** cache its result.
213
+ */
214
+ async getRoleConnectionsMetadata(applicationID) {
215
+ return this._manager.authRequest({
216
+ method: "GET",
217
+ path: Routes.ROLE_CONNECTIONS_METADATA(applicationID)
218
+ }).then(data => data.map(d => ({
219
+ description: d.description,
220
+ descriptionLocalizations: d.description_localizations,
221
+ key: d.key,
222
+ name: d.name,
223
+ nameLocalizations: d.name_localizations,
224
+ type: d.type
225
+ })));
226
+ }
227
+ /**
228
+ * Get the authenticated user's role connection object for an application. This requires the `role_connections.write` scope.
229
+ * @param applicationID The ID of the application.
230
+ * @caching This method **does not** cache its result.
231
+ */
232
+ async getUserRoleConnection(applicationID) {
233
+ return this._manager.authRequest({
234
+ method: "GET",
235
+ path: Routes.OAUTH_ROLE_CONNECTION(applicationID)
236
+ }).then(data => ({
237
+ metadata: Object.entries(data.metadata).map(([key, value]) => ({
238
+ [key]: {
239
+ description: value.description,
240
+ descriptionLocalizations: value.description_localizations,
241
+ key: value.key,
242
+ name: value.name,
243
+ nameLocalizations: value.name_localizations,
244
+ type: value.type
245
+ }
246
+ })).reduce((a, b) => ({ ...a, ...b })),
247
+ platformName: data.platform_name,
248
+ platformUsername: data.platform_username
249
+ }));
250
+ }
251
+ /**
252
+ * Refresh an existing access token.
253
+ * @param options The options for refreshing the token.
254
+ * @caching This method **does not** cache its result.
255
+ */
256
+ async refreshToken(options) {
257
+ options = this._manager.client.util._freeze(options);
258
+ const form = new FormData();
259
+ form.append("client_id", options.clientID);
260
+ form.append("client_secret", options.clientSecret);
261
+ form.append("grant_type", "refresh_token");
262
+ form.append("refresh_token", options.refreshToken);
263
+ return this._manager.authRequest({
264
+ method: "POST",
265
+ path: Routes.OAUTH_TOKEN,
266
+ form
267
+ }).then(data => ({
268
+ accessToken: data.access_token,
269
+ expiresIn: data.expires_in,
270
+ refreshToken: data.refresh_token,
271
+ scopes: data.scope.split(" "),
272
+ tokenType: data.token_type
273
+ }));
274
+ }
275
+ /**
276
+ * Revoke an access token.
277
+ * @param options The options for revoking the token.
278
+ * @caching This method **does not** cache its result.
279
+ */
280
+ async revokeToken(options) {
281
+ options = this._manager.client.util._freeze(options);
282
+ const form = new FormData();
283
+ form.append("client_id", options.clientID);
284
+ form.append("client_secret", options.clientSecret);
285
+ form.append("token", options.token);
286
+ await this._manager.authRequest({
287
+ method: "POST",
288
+ path: Routes.OAUTH_TOKEN_REVOKE,
289
+ form
290
+ });
291
+ }
292
+ /**
293
+ * Update an application's role connections metadata.
294
+ * @param applicationID The ID of the application.
295
+ * @param metadata The metadata records.
296
+ * @caching This method **does not** cache its result.
297
+ */
298
+ async updateRoleConnectionsMetadata(applicationID, metadata) {
299
+ return this._manager.authRequest({
300
+ method: "PUT",
301
+ path: Routes.ROLE_CONNECTIONS_METADATA(applicationID),
302
+ json: metadata.map(d => ({
303
+ description: d.description,
304
+ description_localizations: d.descriptionLocalizations,
305
+ key: d.key,
306
+ name: d.name,
307
+ name_localizations: d.nameLocalizations,
308
+ type: d.type
309
+ }))
310
+ }).then(data => data.map(d => ({
311
+ description: d.description,
312
+ descriptionLocalizations: d.description_localizations,
313
+ key: d.key,
314
+ name: d.name,
315
+ nameLocalizations: d.name_localizations,
316
+ type: d.type
317
+ })));
318
+ }
319
+ /**
320
+ * Update the authenticated user's role connection object for an application. This requires the `role_connections.write` scope.
321
+ * @param applicationID The ID of the application.
322
+ * @param data The metadata to update.
323
+ * @caching This method **does not** cache its result.
324
+ */
325
+ async updateUserRoleConnection(applicationID, data) {
326
+ return this._manager.authRequest({
327
+ method: "PUT",
328
+ path: Routes.OAUTH_ROLE_CONNECTION(applicationID),
329
+ json: {
330
+ metadata: data.metadata,
331
+ platform_name: data.platformName,
332
+ platform_username: data.platformUsername
333
+ }
334
+ }).then(d => ({
335
+ metadata: Object.entries(d.metadata).map(([key, value]) => ({
336
+ [key]: {
337
+ description: value.description,
338
+ descriptionLocalizations: value.description_localizations,
339
+ key: value.key,
340
+ name: value.name,
341
+ nameLocalizations: value.name_localizations,
342
+ type: value.type
343
+ }
344
+ })).reduce((a, b) => ({ ...a, ...b })),
345
+ platformName: d.platform_name,
346
+ platformUsername: d.platform_username
347
+ }));
348
+ }
349
+ }
350
+ exports.default = OAuth;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) {
3
+ if (k2 === undefined)
4
+ k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function () { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function (o, m, k, k2) {
11
+ if (k2 === undefined)
12
+ k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function (o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function (o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function (o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o)
25
+ if (Object.prototype.hasOwnProperty.call(o, k))
26
+ ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule)
33
+ return mod;
34
+ var result = {};
35
+ if (mod != null)
36
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
37
+ if (k[i] !== "default")
38
+ __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ const Routes = __importStar(require("../util/Routes"));
48
+ const ExtendedUser_1 = __importDefault(require("../structures/ExtendedUser"));
49
+ /** Various methods for interacting with users. Located at {@link Client#rest | Client#rest}{@link RESTManager#users | .users}. */
50
+ class Users {
51
+ constructor(manager) {
52
+ this._manager = manager;
53
+ }
54
+ /** Alias for {@link REST/Channels#createDM | Channels#createDM}. */
55
+ get createDM() {
56
+ return this._manager.channels.createDM.bind(this._manager.channels);
57
+ }
58
+ /**
59
+ * Edit the currently authenticated user.
60
+ * @param options The options to edit with.
61
+ * @caching This method **does not** cache its result.
62
+ */
63
+ async editSelf(options) {
64
+ options = this._manager.client.util._freeze(options);
65
+ let avatar = options.avatar;
66
+ let banner = options.banner;
67
+ if (avatar) {
68
+ avatar = this._manager.client.util._convertImage(avatar, "avatar");
69
+ }
70
+ if (banner) {
71
+ banner = this._manager.client.util._convertImage(banner, "banner");
72
+ }
73
+ return this._manager.authRequest({
74
+ method: "PATCH",
75
+ path: Routes.USER("@me"),
76
+ json: {
77
+ avatar,
78
+ banner,
79
+ username: options.username
80
+ }
81
+ }).then(data => new ExtendedUser_1.default(data, this._manager.client));
82
+ }
83
+ /**
84
+ * Get a user.
85
+ * @param userID the ID of the user
86
+ * @caching This method **does** cache its result.
87
+ * @caches {@link Client#users | Client#users}
88
+ */
89
+ async get(userID) {
90
+ return this._manager.authRequest({
91
+ method: "GET",
92
+ path: Routes.USER(userID)
93
+ }).then(data => this._manager.client.users.update(data));
94
+ }
95
+ /**
96
+ * Leave a guild.
97
+ * @param guildID The ID of the guild to leave.
98
+ * @caching This method **does not** cache its result.
99
+ */
100
+ async leaveGuild(guildID) {
101
+ await this._manager.authRequest({
102
+ method: "DELETE",
103
+ path: Routes.OAUTH_GUILD(guildID)
104
+ });
105
+ }
106
+ }
107
+ exports.default = Users;