├── DB └── users.json ├── README.md ├── index.js ├── node_modules ├── @discordjs │ ├── collection │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dist │ │ │ ├── index.d.ts │ │ │ └── index.js │ │ └── package.json │ └── form-data │ │ ├── License │ │ ├── Readme.md │ │ ├── index.d.ts │ │ ├── lib │ │ ├── browser.js │ │ ├── form_data.js │ │ └── populate.js │ │ └── package.json ├── abort-controller │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── browser.mjs │ ├── dist │ │ ├── abort-controller.d.ts │ │ ├── abort-controller.js │ │ ├── abort-controller.js.map │ │ ├── abort-controller.mjs │ │ ├── abort-controller.mjs.map │ │ ├── abort-controller.umd.js │ │ └── abort-controller.umd.js.map │ ├── package.json │ ├── polyfill.js │ └── polyfill.mjs ├── asynckit │ ├── LICENSE │ ├── README.md │ ├── bench.js │ ├── index.js │ ├── lib │ │ ├── abort.js │ │ ├── async.js │ │ ├── defer.js │ │ ├── iterate.js │ │ ├── readable_asynckit.js │ │ ├── readable_parallel.js │ │ ├── readable_serial.js │ │ ├── readable_serial_ordered.js │ │ ├── state.js │ │ ├── streamify.js │ │ └── terminator.js │ ├── package.json │ ├── parallel.js │ ├── serial.js │ ├── serialOrdered.js │ └── stream.js ├── combined-stream │ ├── License │ ├── Readme.md │ ├── lib │ │ └── combined_stream.js │ ├── package.json │ └── yarn.lock ├── delayed-stream │ ├── .npmignore │ ├── License │ ├── Makefile │ ├── Readme.md │ ├── lib │ │ └── delayed_stream.js │ └── package.json ├── discord.js │ ├── .tern-project │ ├── LICENSE │ ├── README.md │ ├── esm │ │ └── discord.mjs │ ├── jsdoc.json │ ├── package.json │ ├── src │ │ ├── WebSocket.js │ │ ├── client │ │ │ ├── BaseClient.js │ │ │ ├── Client.js │ │ │ ├── WebhookClient.js │ │ │ ├── actions │ │ │ │ ├── Action.js │ │ │ │ ├── ActionsManager.js │ │ │ │ ├── ChannelCreate.js │ │ │ │ ├── ChannelDelete.js │ │ │ │ ├── ChannelUpdate.js │ │ │ │ ├── GuildBanRemove.js │ │ │ │ ├── GuildChannelsPositionUpdate.js │ │ │ │ ├── GuildDelete.js │ │ │ │ ├── GuildEmojiCreate.js │ │ │ │ ├── GuildEmojiDelete.js │ │ │ │ ├── GuildEmojiUpdate.js │ │ │ │ ├── GuildEmojisUpdate.js │ │ │ │ ├── GuildIntegrationsUpdate.js │ │ │ │ ├── GuildMemberRemove.js │ │ │ │ ├── GuildRoleCreate.js │ │ │ │ ├── GuildRoleDelete.js │ │ │ │ ├── GuildRoleUpdate.js │ │ │ │ ├── GuildRolesPositionUpdate.js │ │ │ │ ├── GuildUpdate.js │ │ │ │ ├── InviteCreate.js │ │ │ │ ├── InviteDelete.js │ │ │ │ ├── MessageCreate.js │ │ │ │ ├── MessageDelete.js │ │ │ │ ├── MessageDeleteBulk.js │ │ │ │ ├── MessageReactionAdd.js │ │ │ │ ├── MessageReactionRemove.js │ │ │ │ ├── MessageReactionRemoveAll.js │ │ │ │ ├── MessageReactionRemoveEmoji.js │ │ │ │ ├── MessageUpdate.js │ │ │ │ ├── PresenceUpdate.js │ │ │ │ ├── UserUpdate.js │ │ │ │ ├── VoiceStateUpdate.js │ │ │ │ └── WebhooksUpdate.js │ │ │ ├── voice │ │ │ │ ├── ClientVoiceManager.js │ │ │ │ ├── VoiceBroadcast.js │ │ │ │ ├── VoiceConnection.js │ │ │ │ ├── dispatcher │ │ │ │ │ ├── BroadcastDispatcher.js │ │ │ │ │ └── StreamDispatcher.js │ │ │ │ ├── networking │ │ │ │ │ ├── VoiceUDPClient.js │ │ │ │ │ └── VoiceWebSocket.js │ │ │ │ ├── player │ │ │ │ │ ├── AudioPlayer.js │ │ │ │ │ ├── BasePlayer.js │ │ │ │ │ └── BroadcastAudioPlayer.js │ │ │ │ ├── receiver │ │ │ │ │ ├── PacketHandler.js │ │ │ │ │ └── Receiver.js │ │ │ │ └── util │ │ │ │ │ ├── PlayInterface.js │ │ │ │ │ ├── Secretbox.js │ │ │ │ │ ├── Silence.js │ │ │ │ │ └── VolumeInterface.js │ │ │ └── websocket │ │ │ │ ├── WebSocketManager.js │ │ │ │ ├── WebSocketShard.js │ │ │ │ └── handlers │ │ │ │ ├── CHANNEL_CREATE.js │ │ │ │ ├── CHANNEL_DELETE.js │ │ │ │ ├── CHANNEL_PINS_UPDATE.js │ │ │ │ ├── CHANNEL_UPDATE.js │ │ │ │ ├── GUILD_BAN_ADD.js │ │ │ │ ├── GUILD_BAN_REMOVE.js │ │ │ │ ├── GUILD_CREATE.js │ │ │ │ ├── GUILD_DELETE.js │ │ │ │ ├── GUILD_EMOJIS_UPDATE.js │ │ │ │ ├── GUILD_INTEGRATIONS_UPDATE.js │ │ │ │ ├── GUILD_MEMBERS_CHUNK.js │ │ │ │ ├── GUILD_MEMBER_ADD.js │ │ │ │ ├── GUILD_MEMBER_REMOVE.js │ │ │ │ ├── GUILD_MEMBER_UPDATE.js │ │ │ │ ├── GUILD_ROLE_CREATE.js │ │ │ │ ├── GUILD_ROLE_DELETE.js │ │ │ │ ├── GUILD_ROLE_UPDATE.js │ │ │ │ ├── GUILD_UPDATE.js │ │ │ │ ├── INVITE_CREATE.js │ │ │ │ ├── INVITE_DELETE.js │ │ │ │ ├── MESSAGE_CREATE.js │ │ │ │ ├── MESSAGE_DELETE.js │ │ │ │ ├── MESSAGE_DELETE_BULK.js │ │ │ │ ├── MESSAGE_REACTION_ADD.js │ │ │ │ ├── MESSAGE_REACTION_REMOVE.js │ │ │ │ ├── MESSAGE_REACTION_REMOVE_ALL.js │ │ │ │ ├── MESSAGE_REACTION_REMOVE_EMOJI.js │ │ │ │ ├── MESSAGE_UPDATE.js │ │ │ │ ├── PRESENCE_UPDATE.js │ │ │ │ ├── READY.js │ │ │ │ ├── RESUMED.js │ │ │ │ ├── TYPING_START.js │ │ │ │ ├── USER_UPDATE.js │ │ │ │ ├── VOICE_SERVER_UPDATE.js │ │ │ │ ├── VOICE_STATE_UPDATE.js │ │ │ │ ├── WEBHOOKS_UPDATE.js │ │ │ │ └── index.js │ │ ├── errors │ │ │ ├── DJSError.js │ │ │ ├── Messages.js │ │ │ └── index.js │ │ ├── index.js │ │ ├── managers │ │ │ ├── BaseManager.js │ │ │ ├── ChannelManager.js │ │ │ ├── GuildChannelManager.js │ │ │ ├── GuildEmojiManager.js │ │ │ ├── GuildEmojiRoleManager.js │ │ │ ├── GuildManager.js │ │ │ ├── GuildMemberManager.js │ │ │ ├── GuildMemberRoleManager.js │ │ │ ├── MessageManager.js │ │ │ ├── PresenceManager.js │ │ │ ├── ReactionManager.js │ │ │ ├── ReactionUserManager.js │ │ │ ├── RoleManager.js │ │ │ ├── UserManager.js │ │ │ └── VoiceStateManager.js │ │ ├── rest │ │ │ ├── APIRequest.js │ │ │ ├── APIRouter.js │ │ │ ├── DiscordAPIError.js │ │ │ ├── HTTPError.js │ │ │ ├── RESTManager.js │ │ │ └── RequestHandler.js │ │ ├── sharding │ │ │ ├── Shard.js │ │ │ ├── ShardClientUtil.js │ │ │ └── ShardingManager.js │ │ ├── structures │ │ │ ├── APIMessage.js │ │ │ ├── Base.js │ │ │ ├── BaseGuildEmoji.js │ │ │ ├── CategoryChannel.js │ │ │ ├── Channel.js │ │ │ ├── ClientApplication.js │ │ │ ├── ClientPresence.js │ │ │ ├── ClientUser.js │ │ │ ├── DMChannel.js │ │ │ ├── Emoji.js │ │ │ ├── Guild.js │ │ │ ├── GuildAuditLogs.js │ │ │ ├── GuildChannel.js │ │ │ ├── GuildEmoji.js │ │ │ ├── GuildMember.js │ │ │ ├── GuildPreview.js │ │ │ ├── GuildPreviewEmoji.js │ │ │ ├── Integration.js │ │ │ ├── Invite.js │ │ │ ├── Message.js │ │ │ ├── MessageAttachment.js │ │ │ ├── MessageCollector.js │ │ │ ├── MessageEmbed.js │ │ │ ├── MessageMentions.js │ │ │ ├── MessageReaction.js │ │ │ ├── NewsChannel.js │ │ │ ├── PartialGroupDMChannel.js │ │ │ ├── PermissionOverwrites.js │ │ │ ├── Presence.js │ │ │ ├── ReactionCollector.js │ │ │ ├── ReactionEmoji.js │ │ │ ├── Role.js │ │ │ ├── StoreChannel.js │ │ │ ├── Team.js │ │ │ ├── TeamMember.js │ │ │ ├── TextChannel.js │ │ │ ├── User.js │ │ │ ├── VoiceChannel.js │ │ │ ├── VoiceRegion.js │ │ │ ├── VoiceState.js │ │ │ ├── Webhook.js │ │ │ └── interfaces │ │ │ │ ├── Collector.js │ │ │ │ └── TextBasedChannel.js │ │ └── util │ │ │ ├── ActivityFlags.js │ │ │ ├── BitField.js │ │ │ ├── Collection.js │ │ │ ├── Constants.js │ │ │ ├── DataResolver.js │ │ │ ├── Intents.js │ │ │ ├── LimitedCollection.js │ │ │ ├── MessageFlags.js │ │ │ ├── Permissions.js │ │ │ ├── Snowflake.js │ │ │ ├── Speaking.js │ │ │ ├── Structures.js │ │ │ ├── SystemChannelFlags.js │ │ │ ├── UserFlags.js │ │ │ └── Util.js │ ├── typings │ │ ├── index.d.ts │ │ └── index.ts │ └── webpack │ │ └── discord.min.js ├── event-target-shim │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── event-target-shim.js │ │ ├── event-target-shim.js.map │ │ ├── event-target-shim.mjs │ │ ├── event-target-shim.mjs.map │ │ ├── event-target-shim.umd.js │ │ └── event-target-shim.umd.js.map │ ├── index.d.ts │ └── package.json ├── mime-db │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── db.json │ ├── index.js │ └── package.json ├── mime-types │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── node-fetch │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── browser.js │ ├── lib │ │ ├── index.es.js │ │ ├── index.js │ │ └── index.mjs │ └── package.json ├── prism-media │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── core │ │ │ ├── FFmpeg.js │ │ │ ├── VolumeTransformer.js │ │ │ ├── WebmBase.js │ │ │ └── index.js │ │ ├── index.js │ │ ├── opus │ │ │ ├── OggDemuxer.js │ │ │ ├── Opus.js │ │ │ ├── WebmDemuxer.js │ │ │ └── index.js │ │ ├── util │ │ │ ├── Constants.js │ │ │ └── loader.js │ │ └── vorbis │ │ │ ├── WebmDemuxer.js │ │ │ └── index.js │ └── typings │ │ ├── index.d.ts │ │ ├── opus.d.ts │ │ └── vorbis.d.ts ├── setimmediate │ ├── LICENSE.txt │ ├── package.json │ └── setImmediate.js ├── tweetnacl │ ├── AUTHORS.md │ ├── CHANGELOG.md │ ├── LICENSE │ ├── PULL_REQUEST_TEMPLATE.md │ ├── README.md │ ├── nacl-fast.js │ ├── nacl-fast.min.js │ ├── nacl.d.ts │ ├── nacl.js │ ├── nacl.min.js │ └── package.json └── ws │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── index.js │ ├── lib │ ├── buffer-util.js │ ├── constants.js │ ├── event-target.js │ ├── extension.js │ ├── limiter.js │ ├── permessage-deflate.js │ ├── receiver.js │ ├── sender.js │ ├── stream.js │ ├── validation.js │ ├── websocket-server.js │ └── websocket.js │ └── package.json ├── package-lock.json └── package.json /DB/users.json: -------------------------------------------------------------------------------- 1 | {"740904261705138278":{"bal":402,"lastclaim":1597925564252,"lastwork":1597925572563,"workers":20},"705475351089774612":{"bal":500,"lastclaim":1599915516416,"lastwork":0,"workers":0}} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EconomyBot 2 | 3 | Tutorial vids on channel 4 | -------------------------------------------------------------------------------- /node_modules/@discordjs/collection/README.md: -------------------------------------------------------------------------------- 1 | # Collection 2 | 3 | Utility data structure used in Discord.js. 4 | -------------------------------------------------------------------------------- /node_modules/@discordjs/collection/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "@discordjs/collection@^0.1.5", 3 | "_id": "@discordjs/collection@0.1.6", 4 | "_inBundle": false, 5 | "_integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==", 6 | "_location": "/@discordjs/collection", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "@discordjs/collection@^0.1.5", 12 | "name": "@discordjs/collection", 13 | "escapedName": "@discordjs%2fcollection", 14 | "scope": "@discordjs", 15 | "rawSpec": "^0.1.5", 16 | "saveSpec": null, 17 | "fetchSpec": "^0.1.5" 18 | }, 19 | "_requiredBy": [ 20 | "/discord.js" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", 23 | "_shasum": "9e9a7637f4e4e0688fd8b2b5c63133c91607682c", 24 | "_spec": "@discordjs/collection@^0.1.5", 25 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\discord.js", 26 | "author": { 27 | "name": "Amish Shah", 28 | "email": "amishshah.2k@gmail.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/discordjs/collection/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Utility data structure used in Discord.js", 36 | "devDependencies": { 37 | "@babel/cli": "^7.8.4", 38 | "@babel/core": "^7.8.4", 39 | "@babel/preset-env": "^7.8.4", 40 | "@babel/preset-typescript": "^7.8.3", 41 | "@types/node": "^13.7.4", 42 | "@typescript-eslint/eslint-plugin": "^2.21.0", 43 | "@typescript-eslint/parser": "^2.21.0", 44 | "discord.js-docgen": "github:discordjs/docgen#ts-patch", 45 | "eslint": "^6.8.0", 46 | "eslint-config-marine": "^6.0.0", 47 | "jsdoc-babel": "^0.5.0", 48 | "rimraf": "^3.0.2", 49 | "typescript": "^3.8.2" 50 | }, 51 | "eslintConfig": { 52 | "extends": "marine/node" 53 | }, 54 | "homepage": "https://github.com/discordjs/collection#readme", 55 | "keywords": [ 56 | "map", 57 | "collection", 58 | "utility" 59 | ], 60 | "license": "Apache-2.0", 61 | "main": "dist/index.js", 62 | "name": "@discordjs/collection", 63 | "repository": { 64 | "type": "git", 65 | "url": "git+https://github.com/discordjs/collection.git" 66 | }, 67 | "scripts": { 68 | "build": "rimraf dist/ && tsc", 69 | "docs": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml --output docs/docs.json", 70 | "docs:test": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml", 71 | "lint": "eslint src --ext .ts", 72 | "prebuild": "npm run lint", 73 | "pretest": "npm run build", 74 | "test": "node test/index.js" 75 | }, 76 | "types": "dist/index.d.ts", 77 | "version": "0.1.6" 78 | } 79 | -------------------------------------------------------------------------------- /node_modules/@discordjs/form-data/License: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/@discordjs/form-data/index.d.ts: -------------------------------------------------------------------------------- 1 | // Definitions by: Carlos Ballesteros Velasco 2 | // Leon Yu 3 | // BendingBender 4 | // Maple Miao 5 | 6 | /// 7 | import * as stream from 'stream'; 8 | import * as http from 'http'; 9 | 10 | export = FormData; 11 | 12 | // Extracted because @types/node doesn't export interfaces. 13 | interface ReadableOptions { 14 | highWaterMark?: number; 15 | encoding?: string; 16 | objectMode?: boolean; 17 | read?(this: stream.Readable, size: number): void; 18 | destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void; 19 | autoDestroy?: boolean; 20 | } 21 | 22 | interface Options extends ReadableOptions { 23 | writable?: boolean; 24 | readable?: boolean; 25 | dataSize?: number; 26 | maxDataSize?: number; 27 | pauseStreams?: boolean; 28 | } 29 | 30 | declare class FormData extends stream.Readable { 31 | constructor(options?: Options); 32 | append(key: string, value: any, options?: FormData.AppendOptions | string): void; 33 | getHeaders(userHeaders?: FormData.Headers): FormData.Headers; 34 | submit( 35 | params: string | FormData.SubmitOptions, 36 | callback?: (error: Error | null, response: http.IncomingMessage) => void 37 | ): http.ClientRequest; 38 | getBuffer(): Buffer; 39 | getBoundary(): string; 40 | getLength(callback: (err: Error | null, length: number) => void): void; 41 | getLengthSync(): number; 42 | hasKnownLength(): boolean; 43 | } 44 | 45 | declare namespace FormData { 46 | interface Headers { 47 | [key: string]: any; 48 | } 49 | 50 | interface AppendOptions { 51 | header?: string | Headers; 52 | knownLength?: number; 53 | filename?: string; 54 | filepath?: string; 55 | contentType?: string; 56 | } 57 | 58 | interface SubmitOptions extends http.RequestOptions { 59 | protocol?: 'https:' | 'http:'; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /node_modules/@discordjs/form-data/lib/browser.js: -------------------------------------------------------------------------------- 1 | /* eslint-env browser */ 2 | module.exports = typeof self == 'object' ? self.FormData : window.FormData; 3 | -------------------------------------------------------------------------------- /node_modules/@discordjs/form-data/lib/populate.js: -------------------------------------------------------------------------------- 1 | // populates missing values 2 | module.exports = function(dst, src) { 3 | 4 | Object.keys(src).forEach(function(prop) 5 | { 6 | dst[prop] = dst[prop] || src[prop]; 7 | }); 8 | 9 | return dst; 10 | }; 11 | -------------------------------------------------------------------------------- /node_modules/abort-controller/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Toru Nagashima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/abort-controller/browser.js: -------------------------------------------------------------------------------- 1 | /*globals self, window */ 2 | "use strict" 3 | 4 | /*eslint-disable @mysticatea/prettier */ 5 | const { AbortController, AbortSignal } = 6 | typeof self !== "undefined" ? self : 7 | typeof window !== "undefined" ? window : 8 | /* otherwise */ undefined 9 | /*eslint-enable @mysticatea/prettier */ 10 | 11 | module.exports = AbortController 12 | module.exports.AbortSignal = AbortSignal 13 | module.exports.default = AbortController 14 | -------------------------------------------------------------------------------- /node_modules/abort-controller/browser.mjs: -------------------------------------------------------------------------------- 1 | /*globals self, window */ 2 | 3 | /*eslint-disable @mysticatea/prettier */ 4 | const { AbortController, AbortSignal } = 5 | typeof self !== "undefined" ? self : 6 | typeof window !== "undefined" ? window : 7 | /* otherwise */ undefined 8 | /*eslint-enable @mysticatea/prettier */ 9 | 10 | export default AbortController 11 | export { AbortController, AbortSignal } 12 | -------------------------------------------------------------------------------- /node_modules/abort-controller/dist/abort-controller.d.ts: -------------------------------------------------------------------------------- 1 | import { EventTarget } from "event-target-shim" 2 | 3 | type Events = { 4 | abort: any 5 | } 6 | type EventAttributes = { 7 | onabort: any 8 | } 9 | /** 10 | * The signal class. 11 | * @see https://dom.spec.whatwg.org/#abortsignal 12 | */ 13 | declare class AbortSignal extends EventTarget { 14 | /** 15 | * AbortSignal cannot be constructed directly. 16 | */ 17 | constructor() 18 | /** 19 | * Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise. 20 | */ 21 | readonly aborted: boolean 22 | } 23 | /** 24 | * The AbortController. 25 | * @see https://dom.spec.whatwg.org/#abortcontroller 26 | */ 27 | declare class AbortController { 28 | /** 29 | * Initialize this controller. 30 | */ 31 | constructor() 32 | /** 33 | * Returns the `AbortSignal` object associated with this object. 34 | */ 35 | readonly signal: AbortSignal 36 | /** 37 | * Abort and signal to any observers that the associated activity is to be aborted. 38 | */ 39 | abort(): void 40 | } 41 | 42 | export default AbortController 43 | export { AbortController, AbortSignal } 44 | -------------------------------------------------------------------------------- /node_modules/abort-controller/polyfill.js: -------------------------------------------------------------------------------- 1 | /*globals require, self, window */ 2 | "use strict" 3 | 4 | const ac = require("./dist/abort-controller") 5 | 6 | /*eslint-disable @mysticatea/prettier */ 7 | const g = 8 | typeof self !== "undefined" ? self : 9 | typeof window !== "undefined" ? window : 10 | typeof global !== "undefined" ? global : 11 | /* otherwise */ undefined 12 | /*eslint-enable @mysticatea/prettier */ 13 | 14 | if (g) { 15 | if (typeof g.AbortController === "undefined") { 16 | g.AbortController = ac.AbortController 17 | } 18 | if (typeof g.AbortSignal === "undefined") { 19 | g.AbortSignal = ac.AbortSignal 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /node_modules/abort-controller/polyfill.mjs: -------------------------------------------------------------------------------- 1 | /*globals self, window */ 2 | import * as ac from "./dist/abort-controller" 3 | 4 | /*eslint-disable @mysticatea/prettier */ 5 | const g = 6 | typeof self !== "undefined" ? self : 7 | typeof window !== "undefined" ? window : 8 | typeof global !== "undefined" ? global : 9 | /* otherwise */ undefined 10 | /*eslint-enable @mysticatea/prettier */ 11 | 12 | if (g) { 13 | if (typeof g.AbortController === "undefined") { 14 | g.AbortController = ac.AbortController 15 | } 16 | if (typeof g.AbortSignal === "undefined") { 17 | g.AbortSignal = ac.AbortSignal 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /node_modules/asynckit/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Alex Indigo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/asynckit/bench.js: -------------------------------------------------------------------------------- 1 | /* eslint no-console: "off" */ 2 | 3 | var asynckit = require('./') 4 | , async = require('async') 5 | , assert = require('assert') 6 | , expected = 0 7 | ; 8 | 9 | var Benchmark = require('benchmark'); 10 | var suite = new Benchmark.Suite; 11 | 12 | var source = []; 13 | for (var z = 1; z < 100; z++) 14 | { 15 | source.push(z); 16 | expected += z; 17 | } 18 | 19 | suite 20 | // add tests 21 | 22 | .add('async.map', function(deferred) 23 | { 24 | var total = 0; 25 | 26 | async.map(source, 27 | function(i, cb) 28 | { 29 | setImmediate(function() 30 | { 31 | total += i; 32 | cb(null, total); 33 | }); 34 | }, 35 | function(err, result) 36 | { 37 | assert.ifError(err); 38 | assert.equal(result[result.length - 1], expected); 39 | deferred.resolve(); 40 | }); 41 | }, {'defer': true}) 42 | 43 | 44 | .add('asynckit.parallel', function(deferred) 45 | { 46 | var total = 0; 47 | 48 | asynckit.parallel(source, 49 | function(i, cb) 50 | { 51 | setImmediate(function() 52 | { 53 | total += i; 54 | cb(null, total); 55 | }); 56 | }, 57 | function(err, result) 58 | { 59 | assert.ifError(err); 60 | assert.equal(result[result.length - 1], expected); 61 | deferred.resolve(); 62 | }); 63 | }, {'defer': true}) 64 | 65 | 66 | // add listeners 67 | .on('cycle', function(ev) 68 | { 69 | console.log(String(ev.target)); 70 | }) 71 | .on('complete', function() 72 | { 73 | console.log('Fastest is ' + this.filter('fastest').map('name')); 74 | }) 75 | // run async 76 | .run({ 'async': true }); 77 | -------------------------------------------------------------------------------- /node_modules/asynckit/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | { 3 | parallel : require('./parallel.js'), 4 | serial : require('./serial.js'), 5 | serialOrdered : require('./serialOrdered.js') 6 | }; 7 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/abort.js: -------------------------------------------------------------------------------- 1 | // API 2 | module.exports = abort; 3 | 4 | /** 5 | * Aborts leftover active jobs 6 | * 7 | * @param {object} state - current state object 8 | */ 9 | function abort(state) 10 | { 11 | Object.keys(state.jobs).forEach(clean.bind(state)); 12 | 13 | // reset leftover jobs 14 | state.jobs = {}; 15 | } 16 | 17 | /** 18 | * Cleans up leftover job by invoking abort function for the provided job id 19 | * 20 | * @this state 21 | * @param {string|number} key - job id to abort 22 | */ 23 | function clean(key) 24 | { 25 | if (typeof this.jobs[key] == 'function') 26 | { 27 | this.jobs[key](); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/async.js: -------------------------------------------------------------------------------- 1 | var defer = require('./defer.js'); 2 | 3 | // API 4 | module.exports = async; 5 | 6 | /** 7 | * Runs provided callback asynchronously 8 | * even if callback itself is not 9 | * 10 | * @param {function} callback - callback to invoke 11 | * @returns {function} - augmented callback 12 | */ 13 | function async(callback) 14 | { 15 | var isAsync = false; 16 | 17 | // check if async happened 18 | defer(function() { isAsync = true; }); 19 | 20 | return function async_callback(err, result) 21 | { 22 | if (isAsync) 23 | { 24 | callback(err, result); 25 | } 26 | else 27 | { 28 | defer(function nextTick_callback() 29 | { 30 | callback(err, result); 31 | }); 32 | } 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/defer.js: -------------------------------------------------------------------------------- 1 | module.exports = defer; 2 | 3 | /** 4 | * Runs provided function on next iteration of the event loop 5 | * 6 | * @param {function} fn - function to run 7 | */ 8 | function defer(fn) 9 | { 10 | var nextTick = typeof setImmediate == 'function' 11 | ? setImmediate 12 | : ( 13 | typeof process == 'object' && typeof process.nextTick == 'function' 14 | ? process.nextTick 15 | : null 16 | ); 17 | 18 | if (nextTick) 19 | { 20 | nextTick(fn); 21 | } 22 | else 23 | { 24 | setTimeout(fn, 0); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/iterate.js: -------------------------------------------------------------------------------- 1 | var async = require('./async.js') 2 | , abort = require('./abort.js') 3 | ; 4 | 5 | // API 6 | module.exports = iterate; 7 | 8 | /** 9 | * Iterates over each job object 10 | * 11 | * @param {array|object} list - array or object (named list) to iterate over 12 | * @param {function} iterator - iterator to run 13 | * @param {object} state - current job status 14 | * @param {function} callback - invoked when all elements processed 15 | */ 16 | function iterate(list, iterator, state, callback) 17 | { 18 | // store current index 19 | var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; 20 | 21 | state.jobs[key] = runJob(iterator, key, list[key], function(error, output) 22 | { 23 | // don't repeat yourself 24 | // skip secondary callbacks 25 | if (!(key in state.jobs)) 26 | { 27 | return; 28 | } 29 | 30 | // clean up jobs 31 | delete state.jobs[key]; 32 | 33 | if (error) 34 | { 35 | // don't process rest of the results 36 | // stop still active jobs 37 | // and reset the list 38 | abort(state); 39 | } 40 | else 41 | { 42 | state.results[key] = output; 43 | } 44 | 45 | // return salvaged results 46 | callback(error, state.results); 47 | }); 48 | } 49 | 50 | /** 51 | * Runs iterator over provided job element 52 | * 53 | * @param {function} iterator - iterator to invoke 54 | * @param {string|number} key - key/index of the element in the list of jobs 55 | * @param {mixed} item - job description 56 | * @param {function} callback - invoked after iterator is done with the job 57 | * @returns {function|mixed} - job abort function or something else 58 | */ 59 | function runJob(iterator, key, item, callback) 60 | { 61 | var aborter; 62 | 63 | // allow shortcut if iterator expects only two arguments 64 | if (iterator.length == 2) 65 | { 66 | aborter = iterator(item, async(callback)); 67 | } 68 | // otherwise go with full three arguments 69 | else 70 | { 71 | aborter = iterator(item, key, async(callback)); 72 | } 73 | 74 | return aborter; 75 | } 76 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/readable_asynckit.js: -------------------------------------------------------------------------------- 1 | var streamify = require('./streamify.js') 2 | , defer = require('./defer.js') 3 | ; 4 | 5 | // API 6 | module.exports = ReadableAsyncKit; 7 | 8 | /** 9 | * Base constructor for all streams 10 | * used to hold properties/methods 11 | */ 12 | function ReadableAsyncKit() 13 | { 14 | ReadableAsyncKit.super_.apply(this, arguments); 15 | 16 | // list of active jobs 17 | this.jobs = {}; 18 | 19 | // add stream methods 20 | this.destroy = destroy; 21 | this._start = _start; 22 | this._read = _read; 23 | } 24 | 25 | /** 26 | * Destroys readable stream, 27 | * by aborting outstanding jobs 28 | * 29 | * @returns {void} 30 | */ 31 | function destroy() 32 | { 33 | if (this.destroyed) 34 | { 35 | return; 36 | } 37 | 38 | this.destroyed = true; 39 | 40 | if (typeof this.terminator == 'function') 41 | { 42 | this.terminator(); 43 | } 44 | } 45 | 46 | /** 47 | * Starts provided jobs in async manner 48 | * 49 | * @private 50 | */ 51 | function _start() 52 | { 53 | // first argument – runner function 54 | var runner = arguments[0] 55 | // take away first argument 56 | , args = Array.prototype.slice.call(arguments, 1) 57 | // second argument - input data 58 | , input = args[0] 59 | // last argument - result callback 60 | , endCb = streamify.callback.call(this, args[args.length - 1]) 61 | ; 62 | 63 | args[args.length - 1] = endCb; 64 | // third argument - iterator 65 | args[1] = streamify.iterator.call(this, args[1]); 66 | 67 | // allow time for proper setup 68 | defer(function() 69 | { 70 | if (!this.destroyed) 71 | { 72 | this.terminator = runner.apply(null, args); 73 | } 74 | else 75 | { 76 | endCb(null, Array.isArray(input) ? [] : {}); 77 | } 78 | }.bind(this)); 79 | } 80 | 81 | 82 | /** 83 | * Implement _read to comply with Readable streams 84 | * Doesn't really make sense for flowing object mode 85 | * 86 | * @private 87 | */ 88 | function _read() 89 | { 90 | 91 | } 92 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/readable_parallel.js: -------------------------------------------------------------------------------- 1 | var parallel = require('../parallel.js'); 2 | 3 | // API 4 | module.exports = ReadableParallel; 5 | 6 | /** 7 | * Streaming wrapper to `asynckit.parallel` 8 | * 9 | * @param {array|object} list - array or object (named list) to iterate over 10 | * @param {function} iterator - iterator to run 11 | * @param {function} callback - invoked when all elements processed 12 | * @returns {stream.Readable#} 13 | */ 14 | function ReadableParallel(list, iterator, callback) 15 | { 16 | if (!(this instanceof ReadableParallel)) 17 | { 18 | return new ReadableParallel(list, iterator, callback); 19 | } 20 | 21 | // turn on object mode 22 | ReadableParallel.super_.call(this, {objectMode: true}); 23 | 24 | this._start(parallel, list, iterator, callback); 25 | } 26 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/readable_serial.js: -------------------------------------------------------------------------------- 1 | var serial = require('../serial.js'); 2 | 3 | // API 4 | module.exports = ReadableSerial; 5 | 6 | /** 7 | * Streaming wrapper to `asynckit.serial` 8 | * 9 | * @param {array|object} list - array or object (named list) to iterate over 10 | * @param {function} iterator - iterator to run 11 | * @param {function} callback - invoked when all elements processed 12 | * @returns {stream.Readable#} 13 | */ 14 | function ReadableSerial(list, iterator, callback) 15 | { 16 | if (!(this instanceof ReadableSerial)) 17 | { 18 | return new ReadableSerial(list, iterator, callback); 19 | } 20 | 21 | // turn on object mode 22 | ReadableSerial.super_.call(this, {objectMode: true}); 23 | 24 | this._start(serial, list, iterator, callback); 25 | } 26 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/readable_serial_ordered.js: -------------------------------------------------------------------------------- 1 | var serialOrdered = require('../serialOrdered.js'); 2 | 3 | // API 4 | module.exports = ReadableSerialOrdered; 5 | // expose sort helpers 6 | module.exports.ascending = serialOrdered.ascending; 7 | module.exports.descending = serialOrdered.descending; 8 | 9 | /** 10 | * Streaming wrapper to `asynckit.serialOrdered` 11 | * 12 | * @param {array|object} list - array or object (named list) to iterate over 13 | * @param {function} iterator - iterator to run 14 | * @param {function} sortMethod - custom sort function 15 | * @param {function} callback - invoked when all elements processed 16 | * @returns {stream.Readable#} 17 | */ 18 | function ReadableSerialOrdered(list, iterator, sortMethod, callback) 19 | { 20 | if (!(this instanceof ReadableSerialOrdered)) 21 | { 22 | return new ReadableSerialOrdered(list, iterator, sortMethod, callback); 23 | } 24 | 25 | // turn on object mode 26 | ReadableSerialOrdered.super_.call(this, {objectMode: true}); 27 | 28 | this._start(serialOrdered, list, iterator, sortMethod, callback); 29 | } 30 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/state.js: -------------------------------------------------------------------------------- 1 | // API 2 | module.exports = state; 3 | 4 | /** 5 | * Creates initial state object 6 | * for iteration over list 7 | * 8 | * @param {array|object} list - list to iterate over 9 | * @param {function|null} sortMethod - function to use for keys sort, 10 | * or `null` to keep them as is 11 | * @returns {object} - initial state object 12 | */ 13 | function state(list, sortMethod) 14 | { 15 | var isNamedList = !Array.isArray(list) 16 | , initState = 17 | { 18 | index : 0, 19 | keyedList: isNamedList || sortMethod ? Object.keys(list) : null, 20 | jobs : {}, 21 | results : isNamedList ? {} : [], 22 | size : isNamedList ? Object.keys(list).length : list.length 23 | } 24 | ; 25 | 26 | if (sortMethod) 27 | { 28 | // sort array keys based on it's values 29 | // sort object's keys just on own merit 30 | initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) 31 | { 32 | return sortMethod(list[a], list[b]); 33 | }); 34 | } 35 | 36 | return initState; 37 | } 38 | -------------------------------------------------------------------------------- /node_modules/asynckit/lib/terminator.js: -------------------------------------------------------------------------------- 1 | var abort = require('./abort.js') 2 | , async = require('./async.js') 3 | ; 4 | 5 | // API 6 | module.exports = terminator; 7 | 8 | /** 9 | * Terminates jobs in the attached state context 10 | * 11 | * @this AsyncKitState# 12 | * @param {function} callback - final callback to invoke after termination 13 | */ 14 | function terminator(callback) 15 | { 16 | if (!Object.keys(this.jobs).length) 17 | { 18 | return; 19 | } 20 | 21 | // fast forward iteration index 22 | this.index = this.size; 23 | 24 | // abort jobs 25 | abort(this); 26 | 27 | // send back results we have so far 28 | async(callback)(null, this.results); 29 | } 30 | -------------------------------------------------------------------------------- /node_modules/asynckit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "asynckit@^0.4.0", 3 | "_id": "asynckit@0.4.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", 6 | "_location": "/asynckit", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "asynckit@^0.4.0", 12 | "name": "asynckit", 13 | "escapedName": "asynckit", 14 | "rawSpec": "^0.4.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^0.4.0" 17 | }, 18 | "_requiredBy": [ 19 | "/@discordjs/form-data" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 22 | "_shasum": "c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79", 23 | "_spec": "asynckit@^0.4.0", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\@discordjs\\form-data", 25 | "author": { 26 | "name": "Alex Indigo", 27 | "email": "iam@alexindigo.com" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/alexindigo/asynckit/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "dependencies": {}, 34 | "deprecated": false, 35 | "description": "Minimal async jobs utility library, with streams support", 36 | "devDependencies": { 37 | "browserify": "^13.0.0", 38 | "browserify-istanbul": "^2.0.0", 39 | "coveralls": "^2.11.9", 40 | "eslint": "^2.9.0", 41 | "istanbul": "^0.4.3", 42 | "obake": "^0.1.2", 43 | "phantomjs-prebuilt": "^2.1.7", 44 | "pre-commit": "^1.1.3", 45 | "reamde": "^1.1.0", 46 | "rimraf": "^2.5.2", 47 | "size-table": "^0.2.0", 48 | "tap-spec": "^4.1.1", 49 | "tape": "^4.5.1" 50 | }, 51 | "homepage": "https://github.com/alexindigo/asynckit#readme", 52 | "keywords": [ 53 | "async", 54 | "jobs", 55 | "parallel", 56 | "serial", 57 | "iterator", 58 | "array", 59 | "object", 60 | "stream", 61 | "destroy", 62 | "terminate", 63 | "abort" 64 | ], 65 | "license": "MIT", 66 | "main": "index.js", 67 | "name": "asynckit", 68 | "pre-commit": [ 69 | "clean", 70 | "lint", 71 | "test", 72 | "browser", 73 | "report", 74 | "size" 75 | ], 76 | "repository": { 77 | "type": "git", 78 | "url": "git+https://github.com/alexindigo/asynckit.git" 79 | }, 80 | "scripts": { 81 | "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec", 82 | "clean": "rimraf coverage", 83 | "debug": "tape test/test-*.js", 84 | "lint": "eslint *.js lib/*.js test/*.js", 85 | "report": "istanbul report", 86 | "size": "browserify index.js | size-table asynckit", 87 | "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec", 88 | "win-test": "tape test/test-*.js" 89 | }, 90 | "version": "0.4.0" 91 | } 92 | -------------------------------------------------------------------------------- /node_modules/asynckit/parallel.js: -------------------------------------------------------------------------------- 1 | var iterate = require('./lib/iterate.js') 2 | , initState = require('./lib/state.js') 3 | , terminator = require('./lib/terminator.js') 4 | ; 5 | 6 | // Public API 7 | module.exports = parallel; 8 | 9 | /** 10 | * Runs iterator over provided array elements in parallel 11 | * 12 | * @param {array|object} list - array or object (named list) to iterate over 13 | * @param {function} iterator - iterator to run 14 | * @param {function} callback - invoked when all elements processed 15 | * @returns {function} - jobs terminator 16 | */ 17 | function parallel(list, iterator, callback) 18 | { 19 | var state = initState(list); 20 | 21 | while (state.index < (state['keyedList'] || list).length) 22 | { 23 | iterate(list, iterator, state, function(error, result) 24 | { 25 | if (error) 26 | { 27 | callback(error, result); 28 | return; 29 | } 30 | 31 | // looks like it's the last one 32 | if (Object.keys(state.jobs).length === 0) 33 | { 34 | callback(null, state.results); 35 | return; 36 | } 37 | }); 38 | 39 | state.index++; 40 | } 41 | 42 | return terminator.bind(state, callback); 43 | } 44 | -------------------------------------------------------------------------------- /node_modules/asynckit/serial.js: -------------------------------------------------------------------------------- 1 | var serialOrdered = require('./serialOrdered.js'); 2 | 3 | // Public API 4 | module.exports = serial; 5 | 6 | /** 7 | * Runs iterator over provided array elements in series 8 | * 9 | * @param {array|object} list - array or object (named list) to iterate over 10 | * @param {function} iterator - iterator to run 11 | * @param {function} callback - invoked when all elements processed 12 | * @returns {function} - jobs terminator 13 | */ 14 | function serial(list, iterator, callback) 15 | { 16 | return serialOrdered(list, iterator, null, callback); 17 | } 18 | -------------------------------------------------------------------------------- /node_modules/asynckit/serialOrdered.js: -------------------------------------------------------------------------------- 1 | var iterate = require('./lib/iterate.js') 2 | , initState = require('./lib/state.js') 3 | , terminator = require('./lib/terminator.js') 4 | ; 5 | 6 | // Public API 7 | module.exports = serialOrdered; 8 | // sorting helpers 9 | module.exports.ascending = ascending; 10 | module.exports.descending = descending; 11 | 12 | /** 13 | * Runs iterator over provided sorted array elements in series 14 | * 15 | * @param {array|object} list - array or object (named list) to iterate over 16 | * @param {function} iterator - iterator to run 17 | * @param {function} sortMethod - custom sort function 18 | * @param {function} callback - invoked when all elements processed 19 | * @returns {function} - jobs terminator 20 | */ 21 | function serialOrdered(list, iterator, sortMethod, callback) 22 | { 23 | var state = initState(list, sortMethod); 24 | 25 | iterate(list, iterator, state, function iteratorHandler(error, result) 26 | { 27 | if (error) 28 | { 29 | callback(error, result); 30 | return; 31 | } 32 | 33 | state.index++; 34 | 35 | // are we there yet? 36 | if (state.index < (state['keyedList'] || list).length) 37 | { 38 | iterate(list, iterator, state, iteratorHandler); 39 | return; 40 | } 41 | 42 | // done here 43 | callback(null, state.results); 44 | }); 45 | 46 | return terminator.bind(state, callback); 47 | } 48 | 49 | /* 50 | * -- Sort methods 51 | */ 52 | 53 | /** 54 | * sort helper to sort array elements in ascending order 55 | * 56 | * @param {mixed} a - an item to compare 57 | * @param {mixed} b - an item to compare 58 | * @returns {number} - comparison result 59 | */ 60 | function ascending(a, b) 61 | { 62 | return a < b ? -1 : a > b ? 1 : 0; 63 | } 64 | 65 | /** 66 | * sort helper to sort array elements in descending order 67 | * 68 | * @param {mixed} a - an item to compare 69 | * @param {mixed} b - an item to compare 70 | * @returns {number} - comparison result 71 | */ 72 | function descending(a, b) 73 | { 74 | return -1 * ascending(a, b); 75 | } 76 | -------------------------------------------------------------------------------- /node_modules/asynckit/stream.js: -------------------------------------------------------------------------------- 1 | var inherits = require('util').inherits 2 | , Readable = require('stream').Readable 3 | , ReadableAsyncKit = require('./lib/readable_asynckit.js') 4 | , ReadableParallel = require('./lib/readable_parallel.js') 5 | , ReadableSerial = require('./lib/readable_serial.js') 6 | , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js') 7 | ; 8 | 9 | // API 10 | module.exports = 11 | { 12 | parallel : ReadableParallel, 13 | serial : ReadableSerial, 14 | serialOrdered : ReadableSerialOrdered, 15 | }; 16 | 17 | inherits(ReadableAsyncKit, Readable); 18 | 19 | inherits(ReadableParallel, ReadableAsyncKit); 20 | inherits(ReadableSerial, ReadableAsyncKit); 21 | inherits(ReadableSerialOrdered, ReadableAsyncKit); 22 | -------------------------------------------------------------------------------- /node_modules/combined-stream/License: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Debuggable Limited 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/combined-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "combined-stream@^1.0.8", 3 | "_id": "combined-stream@1.0.8", 4 | "_inBundle": false, 5 | "_integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 6 | "_location": "/combined-stream", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "combined-stream@^1.0.8", 12 | "name": "combined-stream", 13 | "escapedName": "combined-stream", 14 | "rawSpec": "^1.0.8", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.8" 17 | }, 18 | "_requiredBy": [ 19 | "/@discordjs/form-data" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 22 | "_shasum": "c3d45a8b34fd730631a110a8a2520682b31d5a7f", 23 | "_spec": "combined-stream@^1.0.8", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\@discordjs\\form-data", 25 | "author": { 26 | "name": "Felix Geisendörfer", 27 | "email": "felix@debuggable.com", 28 | "url": "http://debuggable.com/" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/felixge/node-combined-stream/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "delayed-stream": "~1.0.0" 36 | }, 37 | "deprecated": false, 38 | "description": "A stream that emits multiple other streams one after another.", 39 | "devDependencies": { 40 | "far": "~0.0.7" 41 | }, 42 | "engines": { 43 | "node": ">= 0.8" 44 | }, 45 | "homepage": "https://github.com/felixge/node-combined-stream", 46 | "license": "MIT", 47 | "main": "./lib/combined_stream", 48 | "name": "combined-stream", 49 | "repository": { 50 | "type": "git", 51 | "url": "git://github.com/felixge/node-combined-stream.git" 52 | }, 53 | "scripts": { 54 | "test": "node test/run.js" 55 | }, 56 | "version": "1.0.8" 57 | } 58 | -------------------------------------------------------------------------------- /node_modules/combined-stream/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | delayed-stream@~1.0.0: 6 | version "1.0.0" 7 | resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" 8 | 9 | far@~0.0.7: 10 | version "0.0.7" 11 | resolved "https://registry.yarnpkg.com/far/-/far-0.0.7.tgz#01c1fd362bcd26ce9cf161af3938aa34619f79a7" 12 | dependencies: 13 | oop "0.0.3" 14 | 15 | oop@0.0.3: 16 | version "0.0.3" 17 | resolved "https://registry.yarnpkg.com/oop/-/oop-0.0.3.tgz#70fa405a5650891a194fdc82ca68dad6dabf4401" 18 | -------------------------------------------------------------------------------- /node_modules/delayed-stream/.npmignore: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /node_modules/delayed-stream/License: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Debuggable Limited 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/delayed-stream/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | 3 | test: 4 | @./test/run.js 5 | 6 | .PHONY: test 7 | 8 | -------------------------------------------------------------------------------- /node_modules/delayed-stream/lib/delayed_stream.js: -------------------------------------------------------------------------------- 1 | var Stream = require('stream').Stream; 2 | var util = require('util'); 3 | 4 | module.exports = DelayedStream; 5 | function DelayedStream() { 6 | this.source = null; 7 | this.dataSize = 0; 8 | this.maxDataSize = 1024 * 1024; 9 | this.pauseStream = true; 10 | 11 | this._maxDataSizeExceeded = false; 12 | this._released = false; 13 | this._bufferedEvents = []; 14 | } 15 | util.inherits(DelayedStream, Stream); 16 | 17 | DelayedStream.create = function(source, options) { 18 | var delayedStream = new this(); 19 | 20 | options = options || {}; 21 | for (var option in options) { 22 | delayedStream[option] = options[option]; 23 | } 24 | 25 | delayedStream.source = source; 26 | 27 | var realEmit = source.emit; 28 | source.emit = function() { 29 | delayedStream._handleEmit(arguments); 30 | return realEmit.apply(source, arguments); 31 | }; 32 | 33 | source.on('error', function() {}); 34 | if (delayedStream.pauseStream) { 35 | source.pause(); 36 | } 37 | 38 | return delayedStream; 39 | }; 40 | 41 | Object.defineProperty(DelayedStream.prototype, 'readable', { 42 | configurable: true, 43 | enumerable: true, 44 | get: function() { 45 | return this.source.readable; 46 | } 47 | }); 48 | 49 | DelayedStream.prototype.setEncoding = function() { 50 | return this.source.setEncoding.apply(this.source, arguments); 51 | }; 52 | 53 | DelayedStream.prototype.resume = function() { 54 | if (!this._released) { 55 | this.release(); 56 | } 57 | 58 | this.source.resume(); 59 | }; 60 | 61 | DelayedStream.prototype.pause = function() { 62 | this.source.pause(); 63 | }; 64 | 65 | DelayedStream.prototype.release = function() { 66 | this._released = true; 67 | 68 | this._bufferedEvents.forEach(function(args) { 69 | this.emit.apply(this, args); 70 | }.bind(this)); 71 | this._bufferedEvents = []; 72 | }; 73 | 74 | DelayedStream.prototype.pipe = function() { 75 | var r = Stream.prototype.pipe.apply(this, arguments); 76 | this.resume(); 77 | return r; 78 | }; 79 | 80 | DelayedStream.prototype._handleEmit = function(args) { 81 | if (this._released) { 82 | this.emit.apply(this, args); 83 | return; 84 | } 85 | 86 | if (args[0] === 'data') { 87 | this.dataSize += args[1].length; 88 | this._checkIfMaxDataSizeExceeded(); 89 | } 90 | 91 | this._bufferedEvents.push(args); 92 | }; 93 | 94 | DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { 95 | if (this._maxDataSizeExceeded) { 96 | return; 97 | } 98 | 99 | if (this.dataSize <= this.maxDataSize) { 100 | return; 101 | } 102 | 103 | this._maxDataSizeExceeded = true; 104 | var message = 105 | 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' 106 | this.emit('error', new Error(message)); 107 | }; 108 | -------------------------------------------------------------------------------- /node_modules/delayed-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "delayed-stream@~1.0.0", 3 | "_id": "delayed-stream@1.0.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", 6 | "_location": "/delayed-stream", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "delayed-stream@~1.0.0", 12 | "name": "delayed-stream", 13 | "escapedName": "delayed-stream", 14 | "rawSpec": "~1.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "~1.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/combined-stream" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 22 | "_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", 23 | "_spec": "delayed-stream@~1.0.0", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\combined-stream", 25 | "author": { 26 | "name": "Felix Geisendörfer", 27 | "email": "felix@debuggable.com", 28 | "url": "http://debuggable.com/" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/felixge/node-delayed-stream/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "contributors": [ 35 | { 36 | "name": "Mike Atkins", 37 | "email": "apeherder@gmail.com" 38 | } 39 | ], 40 | "dependencies": {}, 41 | "deprecated": false, 42 | "description": "Buffers events from a stream until you are ready to handle them.", 43 | "devDependencies": { 44 | "fake": "0.2.0", 45 | "far": "0.0.1" 46 | }, 47 | "engines": { 48 | "node": ">=0.4.0" 49 | }, 50 | "homepage": "https://github.com/felixge/node-delayed-stream", 51 | "license": "MIT", 52 | "main": "./lib/delayed_stream", 53 | "name": "delayed-stream", 54 | "repository": { 55 | "type": "git", 56 | "url": "git://github.com/felixge/node-delayed-stream.git" 57 | }, 58 | "scripts": { 59 | "test": "make test" 60 | }, 61 | "version": "1.0.0" 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/discord.js/.tern-project: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaVersion": 7, 3 | "libs": [], 4 | "loadEagerly": ["./src/*.js"], 5 | "dontLoad": ["node_modules/**"], 6 | "plugins": { 7 | "es_modules": {}, 8 | "node": {}, 9 | "doc_comment": { 10 | "fullDocs": true, 11 | "strong": true 12 | }, 13 | "webpack": { 14 | "configPath": "./webpack.config.js" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /node_modules/discord.js/esm/discord.mjs: -------------------------------------------------------------------------------- 1 | import Discord from '../src/index.js'; 2 | 3 | export default Discord; 4 | 5 | export const { 6 | BaseClient, 7 | Client, 8 | Shard, 9 | ShardClientUtil, 10 | ShardingManager, 11 | WebhookClient, 12 | ActivityFlags, 13 | BitField, 14 | Collection, 15 | Constants, 16 | DataResolver, 17 | BaseManager, 18 | DiscordAPIError, 19 | HTTPError, 20 | MessageFlags, 21 | Intents, 22 | Permissions, 23 | Speaking, 24 | Snowflake, 25 | SnowflakeUtil, 26 | Structures, 27 | SystemChannelFlags, 28 | Util, 29 | version, 30 | ChannelManager, 31 | GuildChannelManager, 32 | GuildEmojiManager, 33 | GuildEmojiRoleManager, 34 | GuildMemberManager, 35 | GuildMemberRoleManager, 36 | GuildManager, 37 | ReactionUserManager, 38 | MessageManager, 39 | PresenceManager, 40 | RoleManager, 41 | UserManager, 42 | discordSort, 43 | escapeMarkdown, 44 | fetchRecommendedShards, 45 | resolveColor, 46 | resolveString, 47 | splitMessage, 48 | Base, 49 | Activity, 50 | APIMessage, 51 | CategoryChannel, 52 | Channel, 53 | ClientApplication, 54 | ClientUser, 55 | Collector, 56 | DMChannel, 57 | Emoji, 58 | Guild, 59 | GuildAuditLogs, 60 | GuildChannel, 61 | GuildEmoji, 62 | GuildMember, 63 | Integration, 64 | Invite, 65 | Message, 66 | MessageAttachment, 67 | MessageCollector, 68 | MessageEmbed, 69 | MessageMentions, 70 | MessageReaction, 71 | NewsChannel, 72 | PermissionOverwrites, 73 | Presence, 74 | ClientPresence, 75 | ReactionCollector, 76 | ReactionEmoji, 77 | RichPresenceAssets, 78 | Role, 79 | StoreChannel, 80 | Team, 81 | TeamMember, 82 | TextChannel, 83 | User, 84 | VoiceChannel, 85 | VoiceRegion, 86 | VoiceState, 87 | Webhook, 88 | WebSocket 89 | } = Discord; 90 | -------------------------------------------------------------------------------- /node_modules/discord.js/jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["node_modules/jsdoc-strip-async-await"] 3 | } 4 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/WebSocket.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { browser } = require('./util/Constants'); 4 | 5 | let erlpack; 6 | 7 | try { 8 | erlpack = require('erlpack'); 9 | if (!erlpack.pack) erlpack = null; 10 | } catch {} // eslint-disable-line no-empty 11 | 12 | let TextDecoder; 13 | 14 | if (browser) { 15 | TextDecoder = window.TextDecoder; // eslint-disable-line no-undef 16 | exports.WebSocket = window.WebSocket; // eslint-disable-line no-undef 17 | } else { 18 | TextDecoder = require('util').TextDecoder; 19 | exports.WebSocket = require('ws'); 20 | } 21 | 22 | const ab = new TextDecoder(); 23 | 24 | exports.encoding = erlpack ? 'etf' : 'json'; 25 | 26 | exports.pack = erlpack ? erlpack.pack : JSON.stringify; 27 | 28 | exports.unpack = (data, type) => { 29 | if (exports.encoding === 'json' || type === 'json') { 30 | if (typeof data !== 'string') { 31 | data = ab.decode(data); 32 | } 33 | return JSON.parse(data); 34 | } 35 | if (!Buffer.isBuffer(data)) data = Buffer.from(new Uint8Array(data)); 36 | return erlpack.unpack(data); 37 | }; 38 | 39 | exports.create = (gateway, query = {}, ...args) => { 40 | const [g, q] = gateway.split('?'); 41 | query.encoding = exports.encoding; 42 | query = new URLSearchParams(query); 43 | if (q) new URLSearchParams(q).forEach((v, k) => query.set(k, v)); 44 | const ws = new exports.WebSocket(`${g}?${query}`, ...args); 45 | if (browser) ws.binaryType = 'arraybuffer'; 46 | return ws; 47 | }; 48 | 49 | for (const state of ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']) exports[state] = exports.WebSocket[state]; 50 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/WebhookClient.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseClient = require('./BaseClient'); 4 | const Webhook = require('../structures/Webhook'); 5 | 6 | /** 7 | * The webhook client. 8 | * @implements {Webhook} 9 | * @extends {BaseClient} 10 | */ 11 | class WebhookClient extends BaseClient { 12 | /** 13 | * @param {Snowflake} id ID of the webhook 14 | * @param {string} token Token of the webhook 15 | * @param {ClientOptions} [options] Options for the client 16 | * @example 17 | * // Create a new webhook and send a message 18 | * const hook = new Discord.WebhookClient('1234', 'abcdef'); 19 | * hook.send('This will send a message').catch(console.error); 20 | */ 21 | constructor(id, token, options) { 22 | super(options); 23 | Object.defineProperty(this, 'client', { value: this }); 24 | this.id = id; 25 | Object.defineProperty(this, 'token', { value: token, writable: true, configurable: true }); 26 | } 27 | } 28 | 29 | Webhook.applyToClass(WebhookClient); 30 | 31 | module.exports = WebhookClient; 32 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/Action.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { PartialTypes } = require('../../util/Constants'); 4 | 5 | /* 6 | 7 | ABOUT ACTIONS 8 | 9 | Actions are similar to WebSocket Packet Handlers, but since introducing 10 | the REST API methods, in order to prevent rewriting code to handle data, 11 | "actions" have been introduced. They're basically what Packet Handlers 12 | used to be but they're strictly for manipulating data and making sure 13 | that WebSocket events don't clash with REST methods. 14 | 15 | */ 16 | 17 | class GenericAction { 18 | constructor(client) { 19 | this.client = client; 20 | } 21 | 22 | handle(data) { 23 | return data; 24 | } 25 | 26 | getPayload(data, manager, id, partialType, cache) { 27 | const existing = manager.cache.get(id); 28 | if (!existing && this.client.options.partials.includes(partialType)) { 29 | return manager.add(data, cache); 30 | } 31 | return existing; 32 | } 33 | 34 | getChannel(data) { 35 | const id = data.channel_id || data.id; 36 | return ( 37 | data.channel || 38 | this.getPayload( 39 | { 40 | id, 41 | guild_id: data.guild_id, 42 | recipients: [data.author || { id: data.user_id }], 43 | }, 44 | this.client.channels, 45 | id, 46 | PartialTypes.CHANNEL, 47 | ) 48 | ); 49 | } 50 | 51 | getMessage(data, channel, cache) { 52 | const id = data.message_id || data.id; 53 | return ( 54 | data.message || 55 | this.getPayload( 56 | { 57 | id, 58 | channel_id: channel.id, 59 | guild_id: data.guild_id || (channel.guild ? channel.guild.id : null), 60 | }, 61 | channel.messages, 62 | id, 63 | PartialTypes.MESSAGE, 64 | cache, 65 | ) 66 | ); 67 | } 68 | 69 | getReaction(data, message, user) { 70 | const id = data.emoji.id || decodeURIComponent(data.emoji.name); 71 | return this.getPayload( 72 | { 73 | emoji: data.emoji, 74 | count: message.partial ? null : 0, 75 | me: user ? user.id === this.client.user.id : false, 76 | }, 77 | message.reactions, 78 | id, 79 | PartialTypes.REACTION, 80 | ); 81 | } 82 | 83 | getMember(data, guild) { 84 | const id = data.user.id; 85 | return this.getPayload( 86 | { 87 | user: { 88 | id, 89 | }, 90 | }, 91 | guild.members, 92 | id, 93 | PartialTypes.GUILD_MEMBER, 94 | ); 95 | } 96 | 97 | getUser(data) { 98 | const id = data.user_id; 99 | return data.user || this.getPayload({ id }, this.client.users, id, PartialTypes.USER); 100 | } 101 | } 102 | 103 | module.exports = GenericAction; 104 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/ActionsManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class ActionsManager { 4 | constructor(client) { 5 | this.client = client; 6 | 7 | this.register(require('./MessageCreate')); 8 | this.register(require('./MessageDelete')); 9 | this.register(require('./MessageDeleteBulk')); 10 | this.register(require('./MessageUpdate')); 11 | this.register(require('./MessageReactionAdd')); 12 | this.register(require('./MessageReactionRemove')); 13 | this.register(require('./MessageReactionRemoveAll')); 14 | this.register(require('./MessageReactionRemoveEmoji')); 15 | this.register(require('./ChannelCreate')); 16 | this.register(require('./ChannelDelete')); 17 | this.register(require('./ChannelUpdate')); 18 | this.register(require('./GuildDelete')); 19 | this.register(require('./GuildUpdate')); 20 | this.register(require('./InviteCreate')); 21 | this.register(require('./InviteDelete')); 22 | this.register(require('./GuildMemberRemove')); 23 | this.register(require('./GuildBanRemove')); 24 | this.register(require('./GuildRoleCreate')); 25 | this.register(require('./GuildRoleDelete')); 26 | this.register(require('./GuildRoleUpdate')); 27 | this.register(require('./PresenceUpdate')); 28 | this.register(require('./UserUpdate')); 29 | this.register(require('./VoiceStateUpdate')); 30 | this.register(require('./GuildEmojiCreate')); 31 | this.register(require('./GuildEmojiDelete')); 32 | this.register(require('./GuildEmojiUpdate')); 33 | this.register(require('./GuildEmojisUpdate')); 34 | this.register(require('./GuildRolesPositionUpdate')); 35 | this.register(require('./GuildChannelsPositionUpdate')); 36 | this.register(require('./GuildIntegrationsUpdate')); 37 | this.register(require('./WebhooksUpdate')); 38 | } 39 | 40 | register(Action) { 41 | this[Action.name.replace(/Action$/, '')] = new Action(this.client); 42 | } 43 | } 44 | 45 | module.exports = ActionsManager; 46 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/ChannelCreate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class ChannelCreateAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const existing = client.channels.cache.has(data.id); 10 | const channel = client.channels.add(data); 11 | if (!existing && channel) { 12 | /** 13 | * Emitted whenever a channel is created. 14 | * @event Client#channelCreate 15 | * @param {DMChannel|GuildChannel} channel The channel that was created 16 | */ 17 | client.emit(Events.CHANNEL_CREATE, channel); 18 | } 19 | return { channel }; 20 | } 21 | } 22 | 23 | module.exports = ChannelCreateAction; 24 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/ChannelDelete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const DMChannel = require('../../structures/DMChannel'); 5 | const { Events } = require('../../util/Constants'); 6 | 7 | class ChannelDeleteAction extends Action { 8 | constructor(client) { 9 | super(client); 10 | this.deleted = new Map(); 11 | } 12 | 13 | handle(data) { 14 | const client = this.client; 15 | let channel = client.channels.cache.get(data.id); 16 | 17 | if (channel) { 18 | client.channels.remove(channel.id); 19 | channel.deleted = true; 20 | if (channel.messages && !(channel instanceof DMChannel)) { 21 | for (const message of channel.messages.cache.values()) { 22 | message.deleted = true; 23 | } 24 | } 25 | /** 26 | * Emitted whenever a channel is deleted. 27 | * @event Client#channelDelete 28 | * @param {DMChannel|GuildChannel} channel The channel that was deleted 29 | */ 30 | client.emit(Events.CHANNEL_DELETE, channel); 31 | } 32 | 33 | return { channel }; 34 | } 35 | } 36 | 37 | module.exports = ChannelDeleteAction; 38 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/ChannelUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const Channel = require('../../structures/Channel'); 5 | const { ChannelTypes } = require('../../util/Constants'); 6 | 7 | class ChannelUpdateAction extends Action { 8 | handle(data) { 9 | const client = this.client; 10 | 11 | let channel = client.channels.cache.get(data.id); 12 | if (channel) { 13 | const old = channel._update(data); 14 | 15 | if (ChannelTypes[channel.type.toUpperCase()] !== data.type) { 16 | const newChannel = Channel.create(this.client, data, channel.guild); 17 | for (const [id, message] of channel.messages.cache) newChannel.messages.cache.set(id, message); 18 | newChannel._typing = new Map(channel._typing); 19 | channel = newChannel; 20 | this.client.channels.cache.set(channel.id, channel); 21 | } 22 | 23 | return { 24 | old, 25 | updated: channel, 26 | }; 27 | } 28 | 29 | return {}; 30 | } 31 | } 32 | 33 | module.exports = ChannelUpdateAction; 34 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildBanRemove.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildBanRemove extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | const user = client.users.add(data.user); 11 | /** 12 | * Emitted whenever a member is unbanned from a guild. 13 | * @event Client#guildBanRemove 14 | * @param {Guild} guild The guild that the unban occurred in 15 | * @param {User} user The user that was unbanned 16 | */ 17 | if (guild && user) client.emit(Events.GUILD_BAN_REMOVE, guild, user); 18 | } 19 | } 20 | 21 | module.exports = GuildBanRemove; 22 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildChannelsPositionUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | 5 | class GuildChannelsPositionUpdate extends Action { 6 | handle(data) { 7 | const client = this.client; 8 | 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | if (guild) { 11 | for (const partialChannel of data.channels) { 12 | const channel = guild.channels.cache.get(partialChannel.id); 13 | if (channel) channel.rawPosition = partialChannel.position; 14 | } 15 | } 16 | 17 | return { guild }; 18 | } 19 | } 20 | 21 | module.exports = GuildChannelsPositionUpdate; 22 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildDelete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildDeleteAction extends Action { 7 | constructor(client) { 8 | super(client); 9 | this.deleted = new Map(); 10 | } 11 | 12 | handle(data) { 13 | const client = this.client; 14 | 15 | let guild = client.guilds.cache.get(data.id); 16 | if (guild) { 17 | for (const channel of guild.channels.cache.values()) { 18 | if (channel.type === 'text') channel.stopTyping(true); 19 | } 20 | 21 | if (data.unavailable) { 22 | // Guild is unavailable 23 | guild.available = false; 24 | 25 | /** 26 | * Emitted whenever a guild becomes unavailable, likely due to a server outage. 27 | * @event Client#guildUnavailable 28 | * @param {Guild} guild The guild that has become unavailable 29 | */ 30 | client.emit(Events.GUILD_UNAVAILABLE, guild); 31 | 32 | // Stops the GuildDelete packet thinking a guild was actually deleted, 33 | // handles emitting of event itself 34 | return { 35 | guild: null, 36 | }; 37 | } 38 | 39 | for (const channel of guild.channels.cache.values()) this.client.channels.remove(channel.id); 40 | if (guild.voice && guild.voice.connection) guild.voice.connection.disconnect(); 41 | 42 | // Delete guild 43 | client.guilds.cache.delete(guild.id); 44 | guild.deleted = true; 45 | 46 | /** 47 | * Emitted whenever a guild kicks the client or the guild is deleted/left. 48 | * @event Client#guildDelete 49 | * @param {Guild} guild The guild that was deleted 50 | */ 51 | client.emit(Events.GUILD_DELETE, guild); 52 | 53 | this.deleted.set(guild.id, guild); 54 | this.scheduleForDeletion(guild.id); 55 | } else { 56 | guild = this.deleted.get(data.id) || null; 57 | } 58 | 59 | return { guild }; 60 | } 61 | 62 | scheduleForDeletion(id) { 63 | this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout); 64 | } 65 | } 66 | 67 | module.exports = GuildDeleteAction; 68 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildEmojiCreate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildEmojiCreateAction extends Action { 7 | handle(guild, createdEmoji) { 8 | const emoji = guild.emojis.add(createdEmoji); 9 | /** 10 | * Emitted whenever a custom emoji is created in a guild. 11 | * @event Client#emojiCreate 12 | * @param {GuildEmoji} emoji The emoji that was created 13 | */ 14 | this.client.emit(Events.GUILD_EMOJI_CREATE, emoji); 15 | return { emoji }; 16 | } 17 | } 18 | 19 | module.exports = GuildEmojiCreateAction; 20 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildEmojiDelete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildEmojiDeleteAction extends Action { 7 | handle(emoji) { 8 | emoji.guild.emojis.cache.delete(emoji.id); 9 | emoji.deleted = true; 10 | /** 11 | * Emitted whenever a custom emoji is deleted in a guild. 12 | * @event Client#emojiDelete 13 | * @param {GuildEmoji} emoji The emoji that was deleted 14 | */ 15 | this.client.emit(Events.GUILD_EMOJI_DELETE, emoji); 16 | return { emoji }; 17 | } 18 | } 19 | 20 | module.exports = GuildEmojiDeleteAction; 21 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildEmojiUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildEmojiUpdateAction extends Action { 7 | handle(current, data) { 8 | const old = current._update(data); 9 | /** 10 | * Emitted whenever a custom emoji is updated in a guild. 11 | * @event Client#emojiUpdate 12 | * @param {GuildEmoji} oldEmoji The old emoji 13 | * @param {GuildEmoji} newEmoji The new emoji 14 | */ 15 | this.client.emit(Events.GUILD_EMOJI_UPDATE, old, current); 16 | return { emoji: current }; 17 | } 18 | } 19 | 20 | module.exports = GuildEmojiUpdateAction; 21 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildEmojisUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | 5 | class GuildEmojisUpdateAction extends Action { 6 | handle(data) { 7 | const guild = this.client.guilds.cache.get(data.guild_id); 8 | if (!guild || !guild.emojis) return; 9 | 10 | const deletions = new Map(guild.emojis.cache); 11 | 12 | for (const emoji of data.emojis) { 13 | // Determine type of emoji event 14 | const cachedEmoji = guild.emojis.cache.get(emoji.id); 15 | if (cachedEmoji) { 16 | deletions.delete(emoji.id); 17 | if (!cachedEmoji.equals(emoji)) { 18 | // Emoji updated 19 | this.client.actions.GuildEmojiUpdate.handle(cachedEmoji, emoji); 20 | } 21 | } else { 22 | // Emoji added 23 | this.client.actions.GuildEmojiCreate.handle(guild, emoji); 24 | } 25 | } 26 | 27 | for (const emoji of deletions.values()) { 28 | // Emoji deleted 29 | this.client.actions.GuildEmojiDelete.handle(emoji); 30 | } 31 | } 32 | } 33 | 34 | module.exports = GuildEmojisUpdateAction; 35 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildIntegrationsUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildIntegrationsUpdate extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | /** 11 | * Emitted whenever a guild integration is updated 12 | * @event Client#guildIntegrationsUpdate 13 | * @param {Guild} guild The guild whose integrations were updated 14 | */ 15 | if (guild) client.emit(Events.GUILD_INTEGRATIONS_UPDATE, guild); 16 | } 17 | } 18 | 19 | module.exports = GuildIntegrationsUpdate; 20 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildMemberRemove.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events, Status } = require('../../util/Constants'); 5 | 6 | class GuildMemberRemoveAction extends Action { 7 | handle(data, shard) { 8 | const client = this.client; 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | let member = null; 11 | if (guild) { 12 | member = this.getMember(data, guild); 13 | guild.memberCount--; 14 | if (member) { 15 | member.deleted = true; 16 | guild.members.cache.delete(member.id); 17 | /** 18 | * Emitted whenever a member leaves a guild, or is kicked. 19 | * @event Client#guildMemberRemove 20 | * @param {GuildMember} member The member that has left/been kicked from the guild 21 | */ 22 | if (shard.status === Status.READY) client.emit(Events.GUILD_MEMBER_REMOVE, member); 23 | } 24 | guild.voiceStates.cache.delete(data.user.id); 25 | } 26 | return { guild, member }; 27 | } 28 | } 29 | 30 | module.exports = GuildMemberRemoveAction; 31 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildRoleCreate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildRoleCreate extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | let role; 11 | if (guild) { 12 | const already = guild.roles.cache.has(data.role.id); 13 | role = guild.roles.add(data.role); 14 | /** 15 | * Emitted whenever a role is created. 16 | * @event Client#roleCreate 17 | * @param {Role} role The role that was created 18 | */ 19 | if (!already) client.emit(Events.GUILD_ROLE_CREATE, role); 20 | } 21 | return { role }; 22 | } 23 | } 24 | 25 | module.exports = GuildRoleCreate; 26 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildRoleDelete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildRoleDeleteAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | let role; 11 | 12 | if (guild) { 13 | role = guild.roles.cache.get(data.role_id); 14 | if (role) { 15 | guild.roles.cache.delete(data.role_id); 16 | role.deleted = true; 17 | /** 18 | * Emitted whenever a guild role is deleted. 19 | * @event Client#roleDelete 20 | * @param {Role} role The role that was deleted 21 | */ 22 | client.emit(Events.GUILD_ROLE_DELETE, role); 23 | } 24 | } 25 | 26 | return { role }; 27 | } 28 | } 29 | 30 | module.exports = GuildRoleDeleteAction; 31 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildRoleUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildRoleUpdateAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | 11 | if (guild) { 12 | let old = null; 13 | 14 | const role = guild.roles.cache.get(data.role.id); 15 | if (role) { 16 | old = role._update(data.role); 17 | /** 18 | * Emitted whenever a guild role is updated. 19 | * @event Client#roleUpdate 20 | * @param {Role} oldRole The role before the update 21 | * @param {Role} newRole The role after the update 22 | */ 23 | client.emit(Events.GUILD_ROLE_UPDATE, old, role); 24 | } 25 | 26 | return { 27 | old, 28 | updated: role, 29 | }; 30 | } 31 | 32 | return { 33 | old: null, 34 | updated: null, 35 | }; 36 | } 37 | } 38 | 39 | module.exports = GuildRoleUpdateAction; 40 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildRolesPositionUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | 5 | class GuildRolesPositionUpdate extends Action { 6 | handle(data) { 7 | const client = this.client; 8 | 9 | const guild = client.guilds.cache.get(data.guild_id); 10 | if (guild) { 11 | for (const partialRole of data.roles) { 12 | const role = guild.roles.cache.get(partialRole.id); 13 | if (role) role.rawPosition = partialRole.position; 14 | } 15 | } 16 | 17 | return { guild }; 18 | } 19 | } 20 | 21 | module.exports = GuildRolesPositionUpdate; 22 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/GuildUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class GuildUpdateAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | 10 | const guild = client.guilds.cache.get(data.id); 11 | if (guild) { 12 | const old = guild._update(data); 13 | /** 14 | * Emitted whenever a guild is updated - e.g. name change. 15 | * @event Client#guildUpdate 16 | * @param {Guild} oldGuild The guild before the update 17 | * @param {Guild} newGuild The guild after the update 18 | */ 19 | client.emit(Events.GUILD_UPDATE, old, guild); 20 | return { 21 | old, 22 | updated: guild, 23 | }; 24 | } 25 | 26 | return { 27 | old: null, 28 | updated: null, 29 | }; 30 | } 31 | } 32 | 33 | module.exports = GuildUpdateAction; 34 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/InviteCreate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const Invite = require('../../structures/Invite'); 5 | const { Events } = require('../../util/Constants'); 6 | 7 | class InviteCreateAction extends Action { 8 | handle(data) { 9 | const client = this.client; 10 | const channel = client.channels.cache.get(data.channel_id); 11 | const guild = client.guilds.cache.get(data.guild_id); 12 | if (!channel && !guild) return false; 13 | 14 | const inviteData = Object.assign(data, { channel, guild }); 15 | const invite = new Invite(client, inviteData); 16 | /** 17 | * Emitted when an invite is created. 18 | * This event only triggers if the client has `MANAGE_GUILD` permissions for the guild, 19 | * or `MANAGE_CHANNEL` permissions for the channel. 20 | * @event Client#inviteCreate 21 | * @param {Invite} invite The invite that was created 22 | */ 23 | client.emit(Events.INVITE_CREATE, invite); 24 | return { invite }; 25 | } 26 | } 27 | 28 | module.exports = InviteCreateAction; 29 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/InviteDelete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const Invite = require('../../structures/Invite'); 5 | const { Events } = require('../../util/Constants'); 6 | 7 | class InviteDeleteAction extends Action { 8 | handle(data) { 9 | const client = this.client; 10 | const channel = client.channels.cache.get(data.channel_id); 11 | const guild = client.guilds.cache.get(data.guild_id); 12 | if (!channel && !guild) return false; 13 | 14 | const inviteData = Object.assign(data, { channel, guild }); 15 | const invite = new Invite(client, inviteData); 16 | 17 | /** 18 | * Emitted when an invite is deleted. 19 | * This event only triggers if the client has `MANAGE_GUILD` permissions for the guild, 20 | * or `MANAGE_CHANNEL` permissions for the channel. 21 | * @event Client#inviteDelete 22 | * @param {Invite} invite The invite that was deleted 23 | */ 24 | client.emit(Events.INVITE_DELETE, invite); 25 | return { invite }; 26 | } 27 | } 28 | 29 | module.exports = InviteDeleteAction; 30 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageCreate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class MessageCreateAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const channel = client.channels.cache.get(data.channel_id); 10 | if (channel) { 11 | const existing = channel.messages.cache.get(data.id); 12 | if (existing) return { message: existing }; 13 | const message = channel.messages.add(data); 14 | const user = message.author; 15 | let member = message.member; 16 | channel.lastMessageID = data.id; 17 | if (user) { 18 | user.lastMessageID = data.id; 19 | user.lastMessageChannelID = channel.id; 20 | } 21 | if (member) { 22 | member.lastMessageID = data.id; 23 | member.lastMessageChannelID = channel.id; 24 | } 25 | 26 | /** 27 | * Emitted whenever a message is created. 28 | * @event Client#message 29 | * @param {Message} message The created message 30 | */ 31 | client.emit(Events.MESSAGE_CREATE, message); 32 | return { message }; 33 | } 34 | 35 | return {}; 36 | } 37 | } 38 | 39 | module.exports = MessageCreateAction; 40 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageDelete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class MessageDeleteAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const channel = this.getChannel(data); 10 | let message; 11 | if (channel) { 12 | message = this.getMessage(data, channel); 13 | if (message) { 14 | channel.messages.cache.delete(message.id); 15 | message.deleted = true; 16 | /** 17 | * Emitted whenever a message is deleted. 18 | * @event Client#messageDelete 19 | * @param {Message} message The deleted message 20 | */ 21 | client.emit(Events.MESSAGE_DELETE, message); 22 | } 23 | } 24 | 25 | return { message }; 26 | } 27 | } 28 | 29 | module.exports = MessageDeleteAction; 30 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageDeleteBulk.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const Collection = require('../../util/Collection'); 5 | const { Events } = require('../../util/Constants'); 6 | 7 | class MessageDeleteBulkAction extends Action { 8 | handle(data) { 9 | const client = this.client; 10 | const channel = client.channels.cache.get(data.channel_id); 11 | 12 | if (channel) { 13 | const ids = data.ids; 14 | const messages = new Collection(); 15 | for (const id of ids) { 16 | const message = this.getMessage( 17 | { 18 | id, 19 | guild_id: data.guild_id, 20 | }, 21 | channel, 22 | false, 23 | ); 24 | if (message) { 25 | message.deleted = true; 26 | messages.set(message.id, message); 27 | channel.messages.cache.delete(id); 28 | } 29 | } 30 | 31 | /** 32 | * Emitted whenever messages are deleted in bulk. 33 | * @event Client#messageDeleteBulk 34 | * @param {Collection} messages The deleted messages, mapped by their ID 35 | */ 36 | if (messages.size > 0) client.emit(Events.MESSAGE_BULK_DELETE, messages); 37 | return { messages }; 38 | } 39 | return {}; 40 | } 41 | } 42 | 43 | module.exports = MessageDeleteBulkAction; 44 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageReactionAdd.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | const { PartialTypes } = require('../../util/Constants'); 6 | 7 | /* 8 | { user_id: 'id', 9 | message_id: 'id', 10 | emoji: { name: '�', id: null }, 11 | channel_id: 'id' } } 12 | */ 13 | 14 | class MessageReactionAdd extends Action { 15 | handle(data) { 16 | if (!data.emoji) return false; 17 | 18 | const user = this.getUser(data); 19 | if (!user) return false; 20 | 21 | // Verify channel 22 | const channel = this.getChannel(data); 23 | if (!channel || channel.type === 'voice') return false; 24 | 25 | // Verify message 26 | const message = this.getMessage(data, channel); 27 | if (!message) return false; 28 | 29 | // Verify reaction 30 | if (message.partial && !this.client.options.partials.includes(PartialTypes.REACTION)) return false; 31 | const reaction = message.reactions.add({ 32 | emoji: data.emoji, 33 | count: message.partial ? null : 0, 34 | me: user.id === this.client.user.id, 35 | }); 36 | if (!reaction) return false; 37 | reaction._add(user); 38 | /** 39 | * Emitted whenever a reaction is added to a cached message. 40 | * @event Client#messageReactionAdd 41 | * @param {MessageReaction} messageReaction The reaction object 42 | * @param {User} user The user that applied the guild or reaction emoji 43 | */ 44 | this.client.emit(Events.MESSAGE_REACTION_ADD, reaction, user); 45 | 46 | return { message, reaction, user }; 47 | } 48 | } 49 | 50 | module.exports = MessageReactionAdd; 51 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageReactionRemove.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | /* 7 | { user_id: 'id', 8 | message_id: 'id', 9 | emoji: { name: '�', id: null }, 10 | channel_id: 'id' } } 11 | */ 12 | 13 | class MessageReactionRemove extends Action { 14 | handle(data) { 15 | if (!data.emoji) return false; 16 | 17 | const user = this.getUser(data); 18 | if (!user) return false; 19 | 20 | // Verify channel 21 | const channel = this.getChannel(data); 22 | if (!channel || channel.type === 'voice') return false; 23 | 24 | // Verify message 25 | const message = this.getMessage(data, channel); 26 | if (!message) return false; 27 | 28 | // Verify reaction 29 | const reaction = this.getReaction(data, message, user); 30 | if (!reaction) return false; 31 | reaction._remove(user); 32 | /** 33 | * Emitted whenever a reaction is removed from a cached message. 34 | * @event Client#messageReactionRemove 35 | * @param {MessageReaction} messageReaction The reaction object 36 | * @param {User} user The user whose emoji or reaction emoji was removed 37 | */ 38 | this.client.emit(Events.MESSAGE_REACTION_REMOVE, reaction, user); 39 | 40 | return { message, reaction, user }; 41 | } 42 | } 43 | 44 | module.exports = MessageReactionRemove; 45 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageReactionRemoveAll.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class MessageReactionRemoveAll extends Action { 7 | handle(data) { 8 | // Verify channel 9 | const channel = this.getChannel(data); 10 | if (!channel || channel.type === 'voice') return false; 11 | 12 | // Verify message 13 | const message = this.getMessage(data, channel); 14 | if (!message) return false; 15 | 16 | message.reactions.cache.clear(); 17 | this.client.emit(Events.MESSAGE_REACTION_REMOVE_ALL, message); 18 | 19 | return { message }; 20 | } 21 | } 22 | 23 | /** 24 | * Emitted whenever all reactions are removed from a cached message. 25 | * @event Client#messageReactionRemoveAll 26 | * @param {Message} message The message the reactions were removed from 27 | */ 28 | 29 | module.exports = MessageReactionRemoveAll; 30 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageReactionRemoveEmoji.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class MessageReactionRemoveEmoji extends Action { 7 | handle(data) { 8 | const channel = this.getChannel(data); 9 | if (!channel || channel.type === 'voice') return false; 10 | 11 | const message = this.getMessage(data, channel); 12 | if (!message) return false; 13 | 14 | const reaction = this.getReaction(data, message); 15 | if (!reaction) return false; 16 | if (!message.partial) message.reactions.cache.delete(reaction.emoji.id || reaction.emoji.name); 17 | 18 | /** 19 | * Emitted when a bot removes an emoji reaction from a cached message. 20 | * @event Client#messageReactionRemoveEmoji 21 | * @param {MessageReaction} reaction The reaction that was removed 22 | */ 23 | this.client.emit(Events.MESSAGE_REACTION_REMOVE_EMOJI, reaction); 24 | return { reaction }; 25 | } 26 | } 27 | 28 | module.exports = MessageReactionRemoveEmoji; 29 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/MessageUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | 5 | class MessageUpdateAction extends Action { 6 | handle(data) { 7 | const channel = this.getChannel(data); 8 | if (channel) { 9 | const { id, channel_id, guild_id, author, timestamp, type } = data; 10 | const message = this.getMessage({ id, channel_id, guild_id, author, timestamp, type }, channel); 11 | if (message) { 12 | message.patch(data); 13 | return { 14 | old: message._edits[0], 15 | updated: message, 16 | }; 17 | } 18 | } 19 | 20 | return {}; 21 | } 22 | } 23 | 24 | module.exports = MessageUpdateAction; 25 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/PresenceUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class PresenceUpdateAction extends Action { 7 | handle(data) { 8 | let user = this.client.users.cache.get(data.user.id); 9 | if (!user && data.user.username) user = this.client.users.add(data.user); 10 | if (!user) return; 11 | 12 | if (data.user && data.user.username) { 13 | if (!user.equals(data.user)) this.client.actions.UserUpdate.handle(data.user); 14 | } 15 | 16 | const guild = this.client.guilds.cache.get(data.guild_id); 17 | if (!guild) return; 18 | 19 | let oldPresence = guild.presences.cache.get(user.id); 20 | if (oldPresence) oldPresence = oldPresence._clone(); 21 | let member = guild.members.cache.get(user.id); 22 | if (!member && data.status !== 'offline') { 23 | member = guild.members.add({ 24 | user, 25 | roles: data.roles, 26 | deaf: false, 27 | mute: false, 28 | }); 29 | this.client.emit(Events.GUILD_MEMBER_AVAILABLE, member); 30 | } 31 | guild.presences.add(Object.assign(data, { guild })); 32 | if (member && this.client.listenerCount(Events.PRESENCE_UPDATE)) { 33 | /** 34 | * Emitted whenever a guild member's presence (e.g. status, activity) is changed. 35 | * @event Client#presenceUpdate 36 | * @param {?Presence} oldPresence The presence before the update, if one at all 37 | * @param {Presence} newPresence The presence after the update 38 | */ 39 | this.client.emit(Events.PRESENCE_UPDATE, oldPresence, member.presence); 40 | } 41 | } 42 | } 43 | 44 | module.exports = PresenceUpdateAction; 45 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/UserUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class UserUpdateAction extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | 10 | const newUser = client.users.cache.get(data.id); 11 | const oldUser = newUser._update(data); 12 | 13 | if (!oldUser.equals(newUser)) { 14 | /** 15 | * Emitted whenever a user's details (e.g. username) are changed. 16 | * @event Client#userUpdate 17 | * @param {User} oldUser The user before the update 18 | * @param {User} newUser The user after the update 19 | */ 20 | client.emit(Events.USER_UPDATE, oldUser, newUser); 21 | return { 22 | old: oldUser, 23 | updated: newUser, 24 | }; 25 | } 26 | 27 | return { 28 | old: null, 29 | updated: null, 30 | }; 31 | } 32 | } 33 | 34 | module.exports = UserUpdateAction; 35 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/VoiceStateUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const VoiceState = require('../../structures/VoiceState'); 5 | const { Events } = require('../../util/Constants'); 6 | 7 | class VoiceStateUpdate extends Action { 8 | handle(data) { 9 | const client = this.client; 10 | const guild = client.guilds.cache.get(data.guild_id); 11 | if (guild) { 12 | // Update the state 13 | const oldState = guild.voiceStates.cache.has(data.user_id) 14 | ? guild.voiceStates.cache.get(data.user_id)._clone() 15 | : new VoiceState(guild, { user_id: data.user_id }); 16 | 17 | const newState = guild.voiceStates.add(data); 18 | 19 | // Get the member 20 | let member = guild.members.cache.get(data.user_id); 21 | if (member && data.member) { 22 | member._patch(data.member); 23 | } else if (data.member && data.member.user && data.member.joined_at) { 24 | member = guild.members.add(data.member); 25 | } 26 | 27 | // Emit event 28 | if (member && member.user.id === client.user.id) { 29 | client.emit('debug', `[VOICE] received voice state update: ${JSON.stringify(data)}`); 30 | client.voice.onVoiceStateUpdate(data); 31 | } 32 | 33 | /** 34 | * Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes. 35 | * @event Client#voiceStateUpdate 36 | * @param {VoiceState} oldState The voice state before the update 37 | * @param {VoiceState} newState The voice state after the update 38 | */ 39 | client.emit(Events.VOICE_STATE_UPDATE, oldState, newState); 40 | } 41 | } 42 | } 43 | 44 | module.exports = VoiceStateUpdate; 45 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/actions/WebhooksUpdate.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Action = require('./Action'); 4 | const { Events } = require('../../util/Constants'); 5 | 6 | class WebhooksUpdate extends Action { 7 | handle(data) { 8 | const client = this.client; 9 | const channel = client.channels.cache.get(data.channel_id); 10 | /** 11 | * Emitted whenever a guild text channel has its webhooks changed. 12 | * @event Client#webhookUpdate 13 | * @param {TextChannel} channel The channel that had a webhook update 14 | */ 15 | if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel); 16 | } 17 | } 18 | 19 | module.exports = WebhooksUpdate; 20 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/dispatcher/BroadcastDispatcher.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const StreamDispatcher = require('./StreamDispatcher'); 4 | 5 | /** 6 | * The class that sends voice packet data to the voice connection. 7 | * @implements {VolumeInterface} 8 | * @extends {StreamDispatcher} 9 | */ 10 | class BroadcastDispatcher extends StreamDispatcher { 11 | constructor(player, options, streams) { 12 | super(player, options, streams); 13 | this.broadcast = player.broadcast; 14 | } 15 | 16 | _write(chunk, enc, done) { 17 | if (!this.startTime) this.startTime = Date.now(); 18 | for (const dispatcher of this.broadcast.subscribers) { 19 | dispatcher._write(chunk, enc); 20 | } 21 | this._step(done); 22 | } 23 | 24 | _destroy(err, cb) { 25 | if (this.player.dispatcher === this) this.player.dispatcher = null; 26 | const { streams } = this; 27 | if (streams.opus) streams.opus.unpipe(this); 28 | if (streams.ffmpeg) streams.ffmpeg.destroy(); 29 | super._destroy(err, cb); 30 | } 31 | 32 | /** 33 | * Set the bitrate of the current Opus encoder if using a compatible Opus stream. 34 | * @param {number} value New bitrate, in kbps 35 | * If set to 'auto', 48kbps will be used 36 | * @returns {boolean} true if the bitrate has been successfully changed. 37 | */ 38 | setBitrate(value) { 39 | if (!value || !this.streams.opus || !this.streams.opus.setBitrate) return false; 40 | const bitrate = value === 'auto' ? 48 : value; 41 | this.streams.opus.setBitrate(bitrate * 1000); 42 | return true; 43 | } 44 | } 45 | 46 | module.exports = BroadcastDispatcher; 47 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/player/AudioPlayer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BasePlayer = require('./BasePlayer'); 4 | 5 | /** 6 | * An Audio Player for a Voice Connection. 7 | * @private 8 | * @extends {BasePlayer} 9 | */ 10 | class AudioPlayer extends BasePlayer { 11 | constructor(voiceConnection) { 12 | super(); 13 | /** 14 | * The voice connection that the player serves 15 | * @type {VoiceConnection} 16 | */ 17 | this.voiceConnection = voiceConnection; 18 | } 19 | 20 | playBroadcast(broadcast, options) { 21 | const dispatcher = this.createDispatcher(options, { broadcast }); 22 | broadcast.add(dispatcher); 23 | return dispatcher; 24 | } 25 | } 26 | 27 | module.exports = AudioPlayer; 28 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/player/BroadcastAudioPlayer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BasePlayer = require('./BasePlayer'); 4 | const BroadcastDispatcher = require('../dispatcher/BroadcastDispatcher'); 5 | 6 | /** 7 | * An Audio Player for a Voice Connection. 8 | * @private 9 | * @extends {BasePlayer} 10 | */ 11 | class AudioPlayer extends BasePlayer { 12 | constructor(broadcast) { 13 | super(); 14 | /** 15 | * The broadcast that the player serves 16 | * @type {VoiceBroadcast} 17 | */ 18 | this.broadcast = broadcast; 19 | } 20 | 21 | createDispatcher(options, streams) { 22 | this.destroyDispatcher(); 23 | const dispatcher = (this.dispatcher = new BroadcastDispatcher(this, options, streams)); 24 | return dispatcher; 25 | } 26 | } 27 | 28 | module.exports = AudioPlayer; 29 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/receiver/Receiver.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const EventEmitter = require('events'); 4 | const prism = require('prism-media'); 5 | const PacketHandler = require('./PacketHandler'); 6 | const { Error } = require('../../../errors'); 7 | 8 | /** 9 | * Receives audio packets from a voice connection. 10 | * @example 11 | * const receiver = connection.createReceiver(); 12 | * // opusStream is a ReadableStream - that means you could play it back to a voice channel if you wanted to! 13 | * const opusStream = receiver.createStream(user); 14 | */ 15 | class VoiceReceiver extends EventEmitter { 16 | constructor(connection) { 17 | super(); 18 | this.connection = connection; 19 | this.packets = new PacketHandler(this); 20 | /** 21 | * Emitted whenever there is a warning 22 | * @event VoiceReceiver#debug 23 | * @param {Error|string} error The error or message to debug 24 | */ 25 | this.packets.on('error', err => this.emit('debug', err)); 26 | } 27 | 28 | /** 29 | * Options passed to `VoiceReceiver#createStream`. 30 | * @typedef {Object} ReceiveStreamOptions 31 | * @property {string} [mode='opus'] The mode for audio output. This defaults to opus, meaning discord.js won't decode 32 | * the packets for you. You can set this to 'pcm' so that the stream's output will be 16-bit little-endian stereo 33 | * audio 34 | * @property {string} [end='silence'] When the stream should be destroyed. If `silence`, this will be when the user 35 | * stops talking. Otherwise, if `manual`, this should be handled by you. 36 | */ 37 | 38 | /** 39 | * Creates a new audio receiving stream. If a stream already exists for a user, then that stream will be returned 40 | * rather than generating a new one. 41 | * @param {UserResolvable} user The user to start listening to. 42 | * @param {ReceiveStreamOptions} options Options. 43 | * @returns {ReadableStream} 44 | */ 45 | createStream(user, { mode = 'opus', end = 'silence' } = {}) { 46 | user = this.connection.client.users.resolve(user); 47 | if (!user) throw new Error('VOICE_USER_MISSING'); 48 | const stream = this.packets.makeStream(user.id, end); 49 | if (mode === 'pcm') { 50 | const decoder = new prism.opus.Decoder({ channels: 2, rate: 48000, frameSize: 960 }); 51 | stream.pipe(decoder); 52 | return decoder; 53 | } 54 | return stream; 55 | } 56 | } 57 | 58 | module.exports = VoiceReceiver; 59 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/util/Secretbox.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const libs = { 4 | sodium: sodium => ({ 5 | open: sodium.api.crypto_secretbox_open_easy, 6 | close: sodium.api.crypto_secretbox_easy, 7 | random: n => sodium.randombytes_buf(n), 8 | }), 9 | 'libsodium-wrappers': sodium => ({ 10 | open: sodium.crypto_secretbox_open_easy, 11 | close: sodium.crypto_secretbox_easy, 12 | random: n => sodium.randombytes_buf(n), 13 | }), 14 | tweetnacl: tweetnacl => ({ 15 | open: tweetnacl.secretbox.open, 16 | close: tweetnacl.secretbox, 17 | random: n => tweetnacl.randomBytes(n), 18 | }), 19 | }; 20 | 21 | exports.methods = {}; 22 | 23 | (async () => { 24 | for (const libName of Object.keys(libs)) { 25 | try { 26 | const lib = require(libName); 27 | if (libName === 'libsodium-wrappers' && lib.ready) await lib.ready; // eslint-disable-line no-await-in-loop 28 | exports.methods = libs[libName](lib); 29 | break; 30 | } catch {} // eslint-disable-line no-empty 31 | } 32 | })(); 33 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/util/Silence.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Readable } = require('stream'); 4 | 5 | const SILENCE_FRAME = Buffer.from([0xf8, 0xff, 0xfe]); 6 | 7 | class Silence extends Readable { 8 | _read() { 9 | this.push(SILENCE_FRAME); 10 | } 11 | } 12 | 13 | module.exports = Silence; 14 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/voice/util/VolumeInterface.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const EventEmitter = require('events'); 4 | 5 | /** 6 | * An interface class for volume transformation. 7 | * @extends {EventEmitter} 8 | */ 9 | class VolumeInterface extends EventEmitter { 10 | constructor({ volume = 1 } = {}) { 11 | super(); 12 | this.setVolume(volume); 13 | } 14 | 15 | /** 16 | * Whether or not the volume of this stream is editable 17 | * @type {boolean} 18 | * @readonly 19 | */ 20 | get volumeEditable() { 21 | return true; 22 | } 23 | 24 | /** 25 | * The current volume of the stream 26 | * @type {number} 27 | * @readonly 28 | */ 29 | get volume() { 30 | return this._volume; 31 | } 32 | 33 | /** 34 | * The current volume of the stream in decibels 35 | * @type {number} 36 | * @readonly 37 | */ 38 | get volumeDecibels() { 39 | return Math.log10(this.volume) * 20; 40 | } 41 | 42 | /** 43 | * The current volume of the stream from a logarithmic scale 44 | * @type {number} 45 | * @readonly 46 | */ 47 | get volumeLogarithmic() { 48 | return Math.pow(this.volume, 1 / 1.660964); 49 | } 50 | 51 | applyVolume(buffer, volume) { 52 | volume = volume || this._volume; 53 | if (volume === 1) return buffer; 54 | 55 | const out = Buffer.alloc(buffer.length); 56 | for (let i = 0; i < buffer.length; i += 2) { 57 | if (i >= buffer.length - 1) break; 58 | const uint = Math.min(32767, Math.max(-32767, Math.floor(volume * buffer.readInt16LE(i)))); 59 | out.writeInt16LE(uint, i); 60 | } 61 | 62 | return out; 63 | } 64 | 65 | /** 66 | * Sets the volume relative to the input stream - i.e. 1 is normal, 0.5 is half, 2 is double. 67 | * @param {number} volume The volume that you want to set 68 | */ 69 | setVolume(volume) { 70 | /** 71 | * Emitted when the volume of this interface changes. 72 | * @event VolumeInterface#volumeChange 73 | * @param {number} oldVolume The old volume of this interface 74 | * @param {number} newVolume The new volume of this interface 75 | */ 76 | this.emit('volumeChange', this._volume, volume); 77 | this._volume = volume; 78 | } 79 | 80 | /** 81 | * Sets the volume in decibels. 82 | * @param {number} db The decibels 83 | */ 84 | setVolumeDecibels(db) { 85 | this.setVolume(Math.pow(10, db / 20)); 86 | } 87 | 88 | /** 89 | * Sets the volume so that a perceived value of 0.5 is half the perceived volume etc. 90 | * @param {number} value The value for the volume 91 | */ 92 | setVolumeLogarithmic(value) { 93 | this.setVolume(Math.pow(value, 1.660964)); 94 | } 95 | } 96 | 97 | const props = ['volumeDecibels', 'volumeLogarithmic', 'setVolumeDecibels', 'setVolumeLogarithmic']; 98 | 99 | exports.applyToClass = function applyToClass(structure) { 100 | for (const prop of props) { 101 | Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop)); 102 | } 103 | }; 104 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/CHANNEL_CREATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.ChannelCreate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/CHANNEL_DELETE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.ChannelDelete.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, { d: data }) => { 6 | const channel = client.channels.cache.get(data.channel_id); 7 | const time = new Date(data.last_pin_timestamp); 8 | 9 | if (channel && !Number.isNaN(time.getTime())) { 10 | // Discord sends null for last_pin_timestamp if the last pinned message was removed 11 | channel.lastPinTimestamp = time.getTime() || null; 12 | 13 | /** 14 | * Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event, 15 | * not much information can be provided easily here - you need to manually check the pins yourself. 16 | * @event Client#channelPinsUpdate 17 | * @param {DMChannel|TextChannel} channel The channel that the pins update occurred in 18 | * @param {Date} time The time of the pins update 19 | */ 20 | client.emit(Events.CHANNEL_PINS_UPDATE, channel, time); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/CHANNEL_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, packet) => { 6 | const { old, updated } = client.actions.ChannelUpdate.handle(packet.d); 7 | if (old && updated) { 8 | /** 9 | * Emitted whenever a channel is updated - e.g. name change, topic change, channel type change. 10 | * @event Client#channelUpdate 11 | * @param {DMChannel|GuildChannel} oldChannel The channel before the update 12 | * @param {DMChannel|GuildChannel} newChannel The channel after the update 13 | */ 14 | client.emit(Events.CHANNEL_UPDATE, old, updated); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_BAN_ADD.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, { d: data }) => { 6 | const guild = client.guilds.cache.get(data.guild_id); 7 | const user = client.users.add(data.user); 8 | 9 | /** 10 | * Emitted whenever a member is banned from a guild. 11 | * @event Client#guildBanAdd 12 | * @param {Guild} guild The guild that the ban occurred in 13 | * @param {User} user The user that was banned 14 | */ 15 | if (guild && user) client.emit(Events.GUILD_BAN_ADD, guild, user); 16 | }; 17 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_BAN_REMOVE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildBanRemove.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_CREATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events, Status } = require('../../../util/Constants'); 4 | 5 | module.exports = async (client, { d: data }, shard) => { 6 | let guild = client.guilds.cache.get(data.id); 7 | if (guild) { 8 | if (!guild.available && !data.unavailable) { 9 | // A newly available guild 10 | guild._patch(data); 11 | // If the client was ready before and we had unavailable guilds, fetch them 12 | if (client.ws.status === Status.READY && client.options.fetchAllMembers) { 13 | await guild.members 14 | .fetch() 15 | .catch(err => client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`)); 16 | } 17 | } 18 | } else { 19 | // A new guild 20 | data.shardID = shard.id; 21 | guild = client.guilds.add(data); 22 | if (client.ws.status === Status.READY) { 23 | /** 24 | * Emitted whenever the client joins a guild. 25 | * @event Client#guildCreate 26 | * @param {Guild} guild The created guild 27 | */ 28 | if (client.options.fetchAllMembers) { 29 | await guild.members 30 | .fetch() 31 | .catch(err => client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`)); 32 | } 33 | client.emit(Events.GUILD_CREATE, guild); 34 | } 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_DELETE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildDelete.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildEmojisUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildIntegrationsUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Collection = require('../../../util/Collection'); 4 | const { Events } = require('../../../util/Constants'); 5 | 6 | module.exports = (client, { d: data }) => { 7 | const guild = client.guilds.cache.get(data.guild_id); 8 | if (!guild) return; 9 | const members = new Collection(); 10 | 11 | for (const member of data.members) members.set(member.user.id, guild.members.add(member)); 12 | if (data.presences) { 13 | for (const presence of data.presences) guild.presences.cache.add(Object.assign(presence, { guild })); 14 | } 15 | /** 16 | * Emitted whenever a chunk of guild members is received (all members come from the same guild). 17 | * @event Client#guildMembersChunk 18 | * @param {Collection} members The members in the chunk 19 | * @param {Guild} guild The guild related to the member chunk 20 | */ 21 | client.emit(Events.GUILD_MEMBERS_CHUNK, members, guild); 22 | }; 23 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBER_ADD.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events, Status } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, { d: data }, shard) => { 6 | const guild = client.guilds.cache.get(data.guild_id); 7 | if (guild) { 8 | guild.memberCount++; 9 | const member = guild.members.add(data); 10 | if (shard.status === Status.READY) { 11 | /** 12 | * Emitted whenever a user joins a guild. 13 | * @event Client#guildMemberAdd 14 | * @param {GuildMember} member The member that has joined a guild 15 | */ 16 | client.emit(Events.GUILD_MEMBER_ADD, member); 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet, shard) => { 4 | client.actions.GuildMemberRemove.handle(packet.d, shard); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Status, Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, { d: data }, shard) => { 6 | const guild = client.guilds.cache.get(data.guild_id); 7 | if (guild) { 8 | const member = guild.members.cache.get(data.user.id); 9 | if (member) { 10 | const old = member._update(data); 11 | if (shard.status === Status.READY) { 12 | /** 13 | * Emitted whenever a guild member changes - i.e. new role, removed role, nickname. 14 | * @event Client#guildMemberUpdate 15 | * @param {GuildMember} oldMember The member before the update 16 | * @param {GuildMember} newMember The member after the update 17 | */ 18 | client.emit(Events.GUILD_MEMBER_UPDATE, old, member); 19 | } 20 | } 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_ROLE_CREATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildRoleCreate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_ROLE_DELETE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildRoleDelete.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildRoleUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/GUILD_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.GuildUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/INVITE_CREATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.InviteCreate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/INVITE_DELETE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.InviteDelete.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageCreate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_DELETE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageDelete.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageDeleteBulk.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageReactionAdd.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageReactionRemove.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageReactionRemoveAll.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.MessageReactionRemoveEmoji.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, packet) => { 6 | const { old, updated } = client.actions.MessageUpdate.handle(packet.d); 7 | if (old && updated) { 8 | /** 9 | * Emitted whenever a message is updated - e.g. embed or content change. 10 | * @event Client#messageUpdate 11 | * @param {Message} oldMessage The message before the update 12 | * @param {Message} newMessage The message after the update 13 | */ 14 | client.emit(Events.MESSAGE_UPDATE, old, updated); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/PRESENCE_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.PresenceUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/READY.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let ClientUser; 4 | 5 | module.exports = (client, { d: data }, shard) => { 6 | if (client.user) { 7 | client.user._patch(data.user); 8 | } else { 9 | if (!ClientUser) ClientUser = require('../../../structures/ClientUser'); 10 | const clientUser = new ClientUser(client, data.user); 11 | client.user = clientUser; 12 | client.users.cache.set(clientUser.id, clientUser); 13 | } 14 | 15 | for (const guild of data.guilds) { 16 | guild.shardID = shard.id; 17 | client.guilds.add(guild); 18 | } 19 | 20 | shard.checkReady(); 21 | }; 22 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/RESUMED.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, packet, shard) => { 6 | const replayed = shard.sequence - shard.closeSequence; 7 | /** 8 | * Emitted when a shard resumes successfully. 9 | * @event Client#shardResume 10 | * @param {number} id The shard ID that resumed 11 | * @param {number} replayedEvents The amount of replayed events 12 | */ 13 | client.emit(Events.SHARD_RESUME, shard.id, replayed); 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/TYPING_START.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { Events } = require('../../../util/Constants'); 4 | 5 | module.exports = (client, { d: data }) => { 6 | const channel = client.channels.cache.get(data.channel_id); 7 | const user = client.users.cache.get(data.user_id); 8 | const timestamp = new Date(data.timestamp * 1000); 9 | 10 | if (channel && user) { 11 | if (channel.type === 'voice') { 12 | client.emit(Events.WARN, `Discord sent a typing packet to a voice channel ${channel.id}`); 13 | return; 14 | } 15 | 16 | if (channel._typing.has(user.id)) { 17 | const typing = channel._typing.get(user.id); 18 | 19 | typing.lastTimestamp = timestamp; 20 | typing.elapsedTime = Date.now() - typing.since; 21 | client.clearTimeout(typing.timeout); 22 | typing.timeout = tooLate(channel, user); 23 | } else { 24 | const since = new Date(); 25 | const lastTimestamp = new Date(); 26 | channel._typing.set(user.id, { 27 | user, 28 | since, 29 | lastTimestamp, 30 | elapsedTime: Date.now() - since, 31 | timeout: tooLate(channel, user), 32 | }); 33 | 34 | /** 35 | * Emitted whenever a user starts typing in a channel. 36 | * @event Client#typingStart 37 | * @param {Channel} channel The channel the user started typing in 38 | * @param {User} user The user that started typing 39 | */ 40 | client.emit(Events.TYPING_START, channel, user); 41 | } 42 | } 43 | }; 44 | 45 | function tooLate(channel, user) { 46 | return channel.client.setTimeout(() => { 47 | channel._typing.delete(user.id); 48 | }, 10000); 49 | } 50 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/USER_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.UserUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.emit('debug', `[VOICE] received voice server: ${JSON.stringify(packet)}`); 5 | client.voice.onVoiceServer(packet.d); 6 | }; 7 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.VoiceStateUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/WEBHOOKS_UPDATE.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = (client, packet) => { 4 | client.actions.WebhooksUpdate.handle(packet.d); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/client/websocket/handlers/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { WSEvents } = require('../../../util/Constants'); 4 | 5 | const handlers = {}; 6 | 7 | for (const name of Object.keys(WSEvents)) { 8 | try { 9 | handlers[name] = require(`./${name}.js`); 10 | } catch {} // eslint-disable-line no-empty 11 | } 12 | 13 | module.exports = handlers; 14 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/errors/DJSError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Heavily inspired by node's `internal/errors` module 4 | 5 | const kCode = Symbol('code'); 6 | const messages = new Map(); 7 | 8 | /** 9 | * Extend an error of some sort into a DiscordjsError. 10 | * @param {Error} Base Base error to extend 11 | * @returns {DiscordjsError} 12 | */ 13 | function makeDiscordjsError(Base) { 14 | return class DiscordjsError extends Base { 15 | constructor(key, ...args) { 16 | super(message(key, args)); 17 | this[kCode] = key; 18 | if (Error.captureStackTrace) Error.captureStackTrace(this, DiscordjsError); 19 | } 20 | 21 | get name() { 22 | return `${super.name} [${this[kCode]}]`; 23 | } 24 | 25 | get code() { 26 | return this[kCode]; 27 | } 28 | }; 29 | } 30 | 31 | /** 32 | * Format the message for an error. 33 | * @param {string} key Error key 34 | * @param {Array<*>} args Arguments to pass for util format or as function args 35 | * @returns {string} Formatted string 36 | */ 37 | function message(key, args) { 38 | if (typeof key !== 'string') throw new Error('Error message key must be a string'); 39 | const msg = messages.get(key); 40 | if (!msg) throw new Error(`An invalid error message key was used: ${key}.`); 41 | if (typeof msg === 'function') return msg(...args); 42 | if (args === undefined || args.length === 0) return msg; 43 | args.unshift(msg); 44 | return String(...args); 45 | } 46 | 47 | /** 48 | * Register an error code and message. 49 | * @param {string} sym Unique name for the error 50 | * @param {*} val Value of the error 51 | */ 52 | function register(sym, val) { 53 | messages.set(sym, typeof val === 'function' ? val : String(val)); 54 | } 55 | 56 | module.exports = { 57 | register, 58 | Error: makeDiscordjsError(Error), 59 | TypeError: makeDiscordjsError(TypeError), 60 | RangeError: makeDiscordjsError(RangeError), 61 | }; 62 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/errors/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./DJSError'); 4 | module.exports.Messages = require('./Messages'); 5 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/BaseManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Collection = require('../util/Collection'); 4 | let Structures; 5 | 6 | /** 7 | * Manages the API methods of a data model and holds its cache. 8 | * @abstract 9 | */ 10 | class BaseManager { 11 | constructor(client, iterable, holds, cacheType = Collection, ...cacheOptions) { 12 | if (!Structures) Structures = require('../util/Structures'); 13 | /** 14 | * The data structure belonging to this manager 15 | * @name BaseManager#holds 16 | * @type {Function} 17 | * @private 18 | * @readonly 19 | */ 20 | Object.defineProperty(this, 'holds', { value: Structures.get(holds.name) || holds }); 21 | 22 | /** 23 | * The client that instantiated this Manager 24 | * @name BaseManager#client 25 | * @type {Client} 26 | * @readonly 27 | */ 28 | Object.defineProperty(this, 'client', { value: client }); 29 | 30 | /** 31 | * The type of Collection of the Manager 32 | * @type {Collection} 33 | */ 34 | this.cacheType = cacheType; 35 | 36 | /** 37 | * Holds the cache for the data model 38 | * @type {Collection} 39 | */ 40 | this.cache = new cacheType(...cacheOptions); 41 | if (iterable) for (const i of iterable) this.add(i); 42 | } 43 | 44 | add(data, cache = true, { id, extras = [] } = {}) { 45 | const existing = this.cache.get(id || data.id); 46 | if (existing && existing._patch && cache) existing._patch(data); 47 | if (existing) return existing; 48 | 49 | const entry = this.holds ? new this.holds(this.client, data, ...extras) : data; 50 | if (cache) this.cache.set(id || entry.id, entry); 51 | return entry; 52 | } 53 | 54 | /** 55 | * Resolves a data entry to a data Object. 56 | * @param {string|Object} idOrInstance The id or instance of something in this Manager 57 | * @returns {?Object} An instance from this Manager 58 | */ 59 | resolve(idOrInstance) { 60 | if (idOrInstance instanceof this.holds) return idOrInstance; 61 | if (typeof idOrInstance === 'string') return this.cache.get(idOrInstance) || null; 62 | return null; 63 | } 64 | 65 | /** 66 | * Resolves a data entry to a instance ID. 67 | * @param {string|Object} idOrInstance The id or instance of something in this Manager 68 | * @returns {?Snowflake} 69 | */ 70 | resolveID(idOrInstance) { 71 | if (idOrInstance instanceof this.holds) return idOrInstance.id; 72 | if (typeof idOrInstance === 'string') return idOrInstance; 73 | return null; 74 | } 75 | 76 | valueOf() { 77 | return this.cache; 78 | } 79 | } 80 | 81 | module.exports = BaseManager; 82 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/ChannelManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseManager = require('./BaseManager'); 4 | const Channel = require('../structures/Channel'); 5 | const { Events } = require('../util/Constants'); 6 | 7 | /** 8 | * A manager of channels belonging to a client 9 | * @extends {BaseManager} 10 | */ 11 | class ChannelManager extends BaseManager { 12 | constructor(client, iterable) { 13 | super(client, iterable, Channel); 14 | } 15 | 16 | /** 17 | * The cache of Channels 18 | * @type {Collection} 19 | * @name ChannelManager#cache 20 | */ 21 | 22 | add(data, guild, cache = true) { 23 | const existing = this.cache.get(data.id); 24 | if (existing) { 25 | if (existing._patch && cache) existing._patch(data); 26 | if (guild) guild.channels.add(existing); 27 | return existing; 28 | } 29 | 30 | const channel = Channel.create(this.client, data, guild); 31 | 32 | if (!channel) { 33 | this.client.emit(Events.DEBUG, `Failed to find guild, or unknown type for channel ${data.id} ${data.type}`); 34 | return null; 35 | } 36 | 37 | if (cache) this.cache.set(channel.id, channel); 38 | 39 | return channel; 40 | } 41 | 42 | remove(id) { 43 | const channel = this.cache.get(id); 44 | if (channel.guild) channel.guild.channels.cache.delete(id); 45 | this.cache.delete(id); 46 | } 47 | 48 | /** 49 | * Data that can be resolved to give a Channel object. This can be: 50 | * * A Channel object 51 | * * A Snowflake 52 | * @typedef {Channel|Snowflake} ChannelResolvable 53 | */ 54 | 55 | /** 56 | * Resolves a ChannelResolvable to a Channel object. 57 | * @method resolve 58 | * @memberof ChannelManager 59 | * @instance 60 | * @param {ChannelResolvable} channel The channel resolvable to resolve 61 | * @returns {?Channel} 62 | */ 63 | 64 | /** 65 | * Resolves a ChannelResolvable to a channel ID string. 66 | * @method resolveID 67 | * @memberof ChannelManager 68 | * @instance 69 | * @param {ChannelResolvable} channel The channel resolvable to resolve 70 | * @returns {?Snowflake} 71 | */ 72 | 73 | /** 74 | * Obtains a channel from Discord, or the channel cache if it's already available. 75 | * @param {Snowflake} id ID of the channel 76 | * @param {boolean} [cache=true] Whether to cache the new channel object if it isn't already 77 | * @returns {Promise} 78 | * @example 79 | * // Fetch a channel by its id 80 | * client.channels.fetch('222109930545610754') 81 | * .then(channel => console.log(channel.name)) 82 | * .catch(console.error); 83 | */ 84 | async fetch(id, cache = true) { 85 | const existing = this.cache.get(id); 86 | if (existing && !existing.partial) return existing; 87 | 88 | const data = await this.client.api.channels(id).get(); 89 | return this.add(data, null, cache); 90 | } 91 | } 92 | 93 | module.exports = ChannelManager; 94 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/PresenceManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseManager = require('./BaseManager'); 4 | const { Presence } = require('../structures/Presence'); 5 | 6 | /** 7 | * Manages API methods for Presences and holds their cache. 8 | * @extends {BaseManager} 9 | */ 10 | class PresenceManager extends BaseManager { 11 | constructor(client, iterable) { 12 | super(client, iterable, Presence); 13 | } 14 | 15 | /** 16 | * The cache of Presences 17 | * @type {Collection} 18 | * @name PresenceManager#cache 19 | */ 20 | 21 | add(data, cache) { 22 | const existing = this.cache.get(data.user.id); 23 | return existing ? existing.patch(data) : super.add(data, cache, { id: data.user.id }); 24 | } 25 | 26 | /** 27 | * Data that can be resolved to a Presence object. This can be: 28 | * * A Presence 29 | * * A UserResolvable 30 | * * A Snowflake 31 | * @typedef {Presence|UserResolvable|Snowflake} PresenceResolvable 32 | */ 33 | 34 | /** 35 | * Resolves a PresenceResolvable to a Presence object. 36 | * @param {PresenceResolvable} presence The presence resolvable to resolve 37 | * @returns {?Presence} 38 | */ 39 | resolve(presence) { 40 | const presenceResolvable = super.resolve(presence); 41 | if (presenceResolvable) return presenceResolvable; 42 | const UserResolvable = this.client.users.resolveID(presence); 43 | return super.resolve(UserResolvable) || null; 44 | } 45 | 46 | /** 47 | * Resolves a PresenceResolvable to a Presence ID string. 48 | * @param {PresenceResolvable} presence The presence resolvable to resolve 49 | * @returns {?Snowflake} 50 | */ 51 | resolveID(presence) { 52 | const presenceResolvable = super.resolveID(presence); 53 | if (presenceResolvable) return presenceResolvable; 54 | const userResolvable = this.client.users.resolveID(presence); 55 | return this.cache.has(userResolvable) ? userResolvable : null; 56 | } 57 | } 58 | 59 | module.exports = PresenceManager; 60 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/ReactionManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseManager = require('./BaseManager'); 4 | const MessageReaction = require('../structures/MessageReaction'); 5 | 6 | /** 7 | * Manages API methods for reactions and holds their cache. 8 | * @extends {BaseManager} 9 | */ 10 | class ReactionManager extends BaseManager { 11 | constructor(message, iterable) { 12 | super(message.client, iterable, MessageReaction); 13 | 14 | /** 15 | * The message that this manager belongs to 16 | * @type {Message} 17 | */ 18 | this.message = message; 19 | } 20 | 21 | add(data, cache) { 22 | return super.add(data, cache, { id: data.emoji.id || data.emoji.name, extras: [this.message] }); 23 | } 24 | 25 | /** 26 | * The reaction cache of this manager 27 | * @type {Collection} 28 | * @name ReactionManager#cache 29 | */ 30 | 31 | /** 32 | * Data that can be resolved to a MessageReaction object. This can be: 33 | * * A MessageReaction 34 | * * A Snowflake 35 | * @typedef {MessageReaction|Snowflake} MessageReactionResolvable 36 | */ 37 | 38 | /** 39 | * Resolves a MessageReactionResolvable to a MessageReaction object. 40 | * @method resolve 41 | * @memberof ReactionManager 42 | * @instance 43 | * @param {MessageReactionResolvable} reaction The MessageReaction to resolve 44 | * @returns {?MessageReaction} 45 | */ 46 | 47 | /** 48 | * Resolves a MessageReactionResolvable to a MessageReaction ID string. 49 | * @method resolveID 50 | * @memberof ReactionManager 51 | * @instance 52 | * @param {MessageReactionResolvable} reaction The MessageReaction to resolve 53 | * @returns {?Snowflake} 54 | */ 55 | 56 | /** 57 | * Removes all reactions from a message. 58 | * @returns {Promise} 59 | */ 60 | removeAll() { 61 | return this.client.api 62 | .channels(this.message.channel.id) 63 | .messages(this.message.id) 64 | .reactions.delete() 65 | .then(() => this.message); 66 | } 67 | } 68 | 69 | module.exports = ReactionManager; 70 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/ReactionUserManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseManager = require('./BaseManager'); 4 | const { Error } = require('../errors'); 5 | const Collection = require('../util/Collection'); 6 | 7 | /** 8 | * Manages API methods for users who reacted to a reaction and stores their cache. 9 | * @extends {BaseManager} 10 | */ 11 | class ReactionUserManager extends BaseManager { 12 | constructor(client, iterable, reaction) { 13 | super(client, iterable, { name: 'User' }); 14 | /** 15 | * The reaction that this manager belongs to 16 | * @type {MessageReaction} 17 | */ 18 | this.reaction = reaction; 19 | } 20 | 21 | /** 22 | * The cache of this manager 23 | * @type {Collection} 24 | * @name ReactionUserManager#cache 25 | */ 26 | 27 | /** 28 | * Fetches all the users that gave this reaction. Resolves with a collection of users, mapped by their IDs. 29 | * @param {Object} [options] Options for fetching the users 30 | * @param {number} [options.limit=100] The maximum amount of users to fetch, defaults to 100 31 | * @param {Snowflake} [options.before] Limit fetching users to those with an id lower than the supplied id 32 | * @param {Snowflake} [options.after] Limit fetching users to those with an id greater than the supplied id 33 | * @returns {Promise>} 34 | */ 35 | async fetch({ limit = 100, after, before } = {}) { 36 | const message = this.reaction.message; 37 | const data = await this.client.api.channels[message.channel.id].messages[message.id].reactions[ 38 | this.reaction.emoji.identifier 39 | ].get({ query: { limit, before, after } }); 40 | const users = new Collection(); 41 | for (const rawUser of data) { 42 | const user = this.client.users.add(rawUser); 43 | this.cache.set(user.id, user); 44 | users.set(user.id, user); 45 | } 46 | return users; 47 | } 48 | 49 | /** 50 | * Removes a user from this reaction. 51 | * @param {UserResolvable} [user=this.reaction.message.client.user] The user to remove the reaction of 52 | * @returns {Promise} 53 | */ 54 | remove(user = this.reaction.message.client.user) { 55 | const message = this.reaction.message; 56 | const userID = message.client.users.resolveID(user); 57 | if (!userID) return Promise.reject(new Error('REACTION_RESOLVE_USER')); 58 | return message.client.api.channels[message.channel.id].messages[message.id].reactions[ 59 | this.reaction.emoji.identifier 60 | ][userID === message.client.user.id ? '@me' : userID] 61 | .delete() 62 | .then(() => this.reaction); 63 | } 64 | } 65 | 66 | module.exports = ReactionUserManager; 67 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/UserManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseManager = require('./BaseManager'); 4 | const GuildMember = require('../structures/GuildMember'); 5 | const Message = require('../structures/Message'); 6 | const User = require('../structures/User'); 7 | 8 | /** 9 | * Manages API methods for users and stores their cache. 10 | * @extends {BaseManager} 11 | */ 12 | class UserManager extends BaseManager { 13 | constructor(client, iterable) { 14 | super(client, iterable, User); 15 | } 16 | 17 | /** 18 | * The cache of this manager 19 | * @type {Collection} 20 | * @name UserManager#cache 21 | */ 22 | 23 | /** 24 | * Data that resolves to give a User object. This can be: 25 | * * A User object 26 | * * A Snowflake 27 | * * A Message object (resolves to the message author) 28 | * * A GuildMember object 29 | * @typedef {User|Snowflake|Message|GuildMember} UserResolvable 30 | */ 31 | 32 | /** 33 | * Resolves a UserResolvable to a User object. 34 | * @param {UserResolvable} user The UserResolvable to identify 35 | * @returns {?User} 36 | */ 37 | resolve(user) { 38 | if (user instanceof GuildMember) return user.user; 39 | if (user instanceof Message) return user.author; 40 | return super.resolve(user); 41 | } 42 | 43 | /** 44 | * Resolves a UserResolvable to a user ID string. 45 | * @param {UserResolvable} user The UserResolvable to identify 46 | * @returns {?Snowflake} 47 | */ 48 | resolveID(user) { 49 | if (user instanceof GuildMember) return user.user.id; 50 | if (user instanceof Message) return user.author.id; 51 | return super.resolveID(user); 52 | } 53 | 54 | /** 55 | * Obtains a user from Discord, or the user cache if it's already available. 56 | * @param {Snowflake} id ID of the user 57 | * @param {boolean} [cache=true] Whether to cache the new user object if it isn't already 58 | * @returns {Promise} 59 | */ 60 | async fetch(id, cache = true) { 61 | const existing = this.cache.get(id); 62 | if (existing && !existing.partial) return existing; 63 | const data = await this.client.api.users(id).get(); 64 | return this.add(data, cache); 65 | } 66 | } 67 | 68 | module.exports = UserManager; 69 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/managers/VoiceStateManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseManager = require('./BaseManager'); 4 | const VoiceState = require('../structures/VoiceState'); 5 | 6 | /** 7 | * Manages API methods for VoiceStates and stores their cache. 8 | * @extends {BaseManager} 9 | */ 10 | class VoiceStateManager extends BaseManager { 11 | constructor(guild, iterable) { 12 | super(guild.client, iterable, VoiceState); 13 | /** 14 | * The guild this manager belongs to 15 | * @type {Guild} 16 | */ 17 | this.guild = guild; 18 | } 19 | 20 | /** 21 | * The cache of this manager 22 | * @type {Collection} 23 | * @name VoiceStateManager#cache 24 | */ 25 | 26 | add(data, cache = true) { 27 | const existing = this.cache.get(data.user_id); 28 | if (existing) return existing._patch(data); 29 | 30 | const entry = new VoiceState(this.guild, data); 31 | if (cache) this.cache.set(data.user_id, entry); 32 | return entry; 33 | } 34 | } 35 | 36 | module.exports = VoiceStateManager; 37 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/rest/APIRequest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const https = require('https'); 4 | const FormData = require('@discordjs/form-data'); 5 | const AbortController = require('abort-controller'); 6 | const fetch = require('node-fetch'); 7 | const { browser, UserAgent } = require('../util/Constants'); 8 | 9 | if (https.Agent) var agent = new https.Agent({ keepAlive: true }); 10 | 11 | class APIRequest { 12 | constructor(rest, method, path, options) { 13 | this.rest = rest; 14 | this.client = rest.client; 15 | this.method = method; 16 | this.route = options.route; 17 | this.options = options; 18 | 19 | let queryString = ''; 20 | if (options.query) { 21 | // Filter out undefined query options 22 | const query = Object.entries(options.query).filter(([, value]) => value !== null && typeof value !== 'undefined'); 23 | queryString = new URLSearchParams(query).toString(); 24 | } 25 | this.path = `${path}${queryString && `?${queryString}`}`; 26 | } 27 | 28 | make() { 29 | const API = 30 | this.options.versioned === false 31 | ? this.client.options.http.api 32 | : `${this.client.options.http.api}/v${this.client.options.http.version}`; 33 | const url = API + this.path; 34 | let headers = {}; 35 | 36 | if (this.options.auth !== false) headers.Authorization = this.rest.getAuth(); 37 | if (this.options.reason) headers['X-Audit-Log-Reason'] = encodeURIComponent(this.options.reason); 38 | if (!browser) headers['User-Agent'] = UserAgent; 39 | if (this.options.headers) headers = Object.assign(headers, this.options.headers); 40 | 41 | let body; 42 | if (this.options.files && this.options.files.length) { 43 | body = new FormData(); 44 | for (const file of this.options.files) if (file && file.file) body.append(file.name, file.file, file.name); 45 | if (typeof this.options.data !== 'undefined') body.append('payload_json', JSON.stringify(this.options.data)); 46 | if (!browser) headers = Object.assign(headers, body.getHeaders()); 47 | // eslint-disable-next-line eqeqeq 48 | } else if (this.options.data != null) { 49 | body = JSON.stringify(this.options.data); 50 | headers['Content-Type'] = 'application/json'; 51 | } 52 | 53 | const controller = new AbortController(); 54 | const timeout = this.client.setTimeout(() => controller.abort(), this.client.options.restRequestTimeout); 55 | return fetch(url, { 56 | method: this.method, 57 | headers, 58 | agent, 59 | body, 60 | signal: controller.signal, 61 | }).finally(() => this.client.clearTimeout(timeout)); 62 | } 63 | } 64 | 65 | module.exports = APIRequest; 66 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/rest/APIRouter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const noop = () => {}; // eslint-disable-line no-empty-function 4 | const methods = ['get', 'post', 'delete', 'patch', 'put']; 5 | const reflectors = [ 6 | 'toString', 7 | 'valueOf', 8 | 'inspect', 9 | 'constructor', 10 | Symbol.toPrimitive, 11 | Symbol.for('nodejs.util.inspect.custom'), 12 | ]; 13 | 14 | function buildRoute(manager) { 15 | const route = ['']; 16 | const handler = { 17 | get(target, name) { 18 | if (reflectors.includes(name)) return () => route.join('/'); 19 | if (methods.includes(name)) { 20 | const routeBucket = []; 21 | for (let i = 0; i < route.length; i++) { 22 | // Reactions routes and sub-routes all share the same bucket 23 | if (route[i - 1] === 'reactions') break; 24 | // Literal IDs should only be taken account if they are the Major ID (the Channel/Guild ID) 25 | if (/\d{16,19}/g.test(route[i]) && !/channels|guilds/.test(route[i - 1])) routeBucket.push(':id'); 26 | // All other parts of the route should be considered as part of the bucket identifier 27 | else routeBucket.push(route[i]); 28 | } 29 | return options => 30 | manager.request( 31 | name, 32 | route.join('/'), 33 | Object.assign( 34 | { 35 | versioned: manager.versioned, 36 | route: routeBucket.join('/'), 37 | }, 38 | options, 39 | ), 40 | ); 41 | } 42 | route.push(name); 43 | return new Proxy(noop, handler); 44 | }, 45 | apply(target, _, args) { 46 | route.push(...args.filter(x => x != null)); // eslint-disable-line eqeqeq 47 | return new Proxy(noop, handler); 48 | }, 49 | }; 50 | return new Proxy(noop, handler); 51 | } 52 | 53 | module.exports = buildRoute; 54 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/rest/DiscordAPIError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Represents an error from the Discord API. 5 | * @extends Error 6 | */ 7 | class DiscordAPIError extends Error { 8 | constructor(path, error, method, status) { 9 | super(); 10 | const flattened = this.constructor.flattenErrors(error.errors || error).join('\n'); 11 | this.name = 'DiscordAPIError'; 12 | this.message = error.message && flattened ? `${error.message}\n${flattened}` : error.message || flattened; 13 | 14 | /** 15 | * The HTTP method used for the request 16 | * @type {string} 17 | */ 18 | this.method = method; 19 | 20 | /** 21 | * The path of the request relative to the HTTP endpoint 22 | * @type {string} 23 | */ 24 | this.path = path; 25 | 26 | /** 27 | * HTTP error code returned by Discord 28 | * @type {number} 29 | */ 30 | this.code = error.code; 31 | 32 | /** 33 | * The HTTP status code 34 | * @type {number} 35 | */ 36 | this.httpStatus = status; 37 | } 38 | 39 | /** 40 | * Flattens an errors object returned from the API into an array. 41 | * @param {Object} obj Discord errors object 42 | * @param {string} [key] Used internally to determine key names of nested fields 43 | * @returns {string[]} 44 | * @private 45 | */ 46 | static flattenErrors(obj, key = '') { 47 | let messages = []; 48 | 49 | for (const [k, v] of Object.entries(obj)) { 50 | if (k === 'message') continue; 51 | const newKey = key ? (isNaN(k) ? `${key}.${k}` : `${key}[${k}]`) : k; 52 | 53 | if (v._errors) { 54 | messages.push(`${newKey}: ${v._errors.map(e => e.message).join(' ')}`); 55 | } else if (v.code || v.message) { 56 | messages.push(`${v.code ? `${v.code}: ` : ''}${v.message}`.trim()); 57 | } else if (typeof v === 'string') { 58 | messages.push(v); 59 | } else { 60 | messages = messages.concat(this.flattenErrors(v, newKey)); 61 | } 62 | } 63 | 64 | return messages; 65 | } 66 | } 67 | 68 | module.exports = DiscordAPIError; 69 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/rest/HTTPError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Represents a HTTP error from a request. 5 | * @extends Error 6 | */ 7 | class HTTPError extends Error { 8 | constructor(message, name, code, method, path) { 9 | super(message); 10 | 11 | /** 12 | * The name of the error 13 | * @type {string} 14 | */ 15 | this.name = name; 16 | 17 | /** 18 | * HTTP error code returned from the request 19 | * @type {number} 20 | */ 21 | this.code = code || 500; 22 | 23 | /** 24 | * The HTTP method used for the request 25 | * @type {string} 26 | */ 27 | this.method = method; 28 | 29 | /** 30 | * The path of the request relative to the HTTP endpoint 31 | * @type {string} 32 | */ 33 | this.path = path; 34 | } 35 | } 36 | 37 | module.exports = HTTPError; 38 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/rest/RESTManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const APIRequest = require('./APIRequest'); 4 | const routeBuilder = require('./APIRouter'); 5 | const RequestHandler = require('./RequestHandler'); 6 | const { Error } = require('../errors'); 7 | const Collection = require('../util/Collection'); 8 | const { Endpoints } = require('../util/Constants'); 9 | 10 | class RESTManager { 11 | constructor(client, tokenPrefix = 'Bot') { 12 | this.client = client; 13 | this.handlers = new Collection(); 14 | this.tokenPrefix = tokenPrefix; 15 | this.versioned = true; 16 | this.globalTimeout = null; 17 | if (client.options.restSweepInterval > 0) { 18 | client.setInterval(() => { 19 | this.handlers.sweep(handler => handler._inactive); 20 | }, client.options.restSweepInterval * 1000); 21 | } 22 | } 23 | 24 | get api() { 25 | return routeBuilder(this); 26 | } 27 | 28 | getAuth() { 29 | const token = this.client.token || this.client.accessToken; 30 | if (token) return `${this.tokenPrefix} ${token}`; 31 | throw new Error('TOKEN_MISSING'); 32 | } 33 | 34 | get cdn() { 35 | return Endpoints.CDN(this.client.options.http.cdn); 36 | } 37 | 38 | push(handler, apiRequest) { 39 | return new Promise((resolve, reject) => { 40 | handler 41 | .push({ 42 | request: apiRequest, 43 | resolve, 44 | reject, 45 | retries: 0, 46 | }) 47 | .catch(reject); 48 | }); 49 | } 50 | 51 | request(method, url, options = {}) { 52 | const apiRequest = new APIRequest(this, method, url, options); 53 | let handler = this.handlers.get(apiRequest.route); 54 | 55 | if (!handler) { 56 | handler = new RequestHandler(this); 57 | this.handlers.set(apiRequest.route, handler); 58 | } 59 | 60 | return this.push(handler, apiRequest); 61 | } 62 | 63 | set endpoint(endpoint) { 64 | this.client.options.http.api = endpoint; 65 | } 66 | } 67 | 68 | module.exports = RESTManager; 69 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/Base.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Util = require('../util/Util'); 4 | 5 | /** 6 | * Represents a data model that is identifiable by a Snowflake (i.e. Discord API data models). 7 | */ 8 | class Base { 9 | constructor(client) { 10 | /** 11 | * The client that instantiated this 12 | * @name Base#client 13 | * @type {Client} 14 | * @readonly 15 | */ 16 | Object.defineProperty(this, 'client', { value: client }); 17 | } 18 | 19 | _clone() { 20 | return Object.assign(Object.create(this), this); 21 | } 22 | 23 | _patch(data) { 24 | return data; 25 | } 26 | 27 | _update(data) { 28 | const clone = this._clone(); 29 | this._patch(data); 30 | return clone; 31 | } 32 | 33 | toJSON(...props) { 34 | return Util.flatten(this, ...props); 35 | } 36 | 37 | valueOf() { 38 | return this.id; 39 | } 40 | } 41 | 42 | module.exports = Base; 43 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/BaseGuildEmoji.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Emoji = require('./Emoji'); 4 | 5 | /** 6 | * Parent class for {@link GuildEmoji} and {@link GuildPreviewEmoji}. 7 | * @extends {Emoji} 8 | */ 9 | class BaseGuildEmoji extends Emoji { 10 | constructor(client, data, guild) { 11 | super(client, data); 12 | 13 | /** 14 | * The guild this emoji is a part of 15 | * @type {Guild|GuildPreview} 16 | */ 17 | this.guild = guild; 18 | 19 | /** 20 | * Array of role ids this emoji is active for 21 | * @name BaseGuildEmoji#_roles 22 | * @type {Snowflake[]} 23 | * @private 24 | */ 25 | Object.defineProperty(this, '_roles', { value: [], writable: true }); 26 | 27 | this._patch(data); 28 | } 29 | 30 | _patch(data) { 31 | if (data.name) this.name = data.name; 32 | 33 | /** 34 | * Whether or not this emoji requires colons surrounding it 35 | * @type {boolean} 36 | * @name GuildEmoji#requiresColons 37 | */ 38 | if (typeof data.require_colons !== 'undefined') this.requiresColons = data.require_colons; 39 | 40 | /** 41 | * Whether this emoji is managed by an external service 42 | * @type {boolean} 43 | * @name GuildEmoji#managed 44 | */ 45 | if (typeof data.managed !== 'undefined') this.managed = data.managed; 46 | 47 | /** 48 | * Whether this emoji is available 49 | * @type {boolean} 50 | * @name GuildEmoji#available 51 | */ 52 | if (typeof data.available !== 'undefined') this.available = data.available; 53 | 54 | if (data.roles) this._roles = data.roles; 55 | } 56 | } 57 | 58 | module.exports = BaseGuildEmoji; 59 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/CategoryChannel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const GuildChannel = require('./GuildChannel'); 4 | 5 | /** 6 | * Represents a guild category channel on Discord. 7 | * @extends {GuildChannel} 8 | */ 9 | class CategoryChannel extends GuildChannel { 10 | /** 11 | * Channels that are a part of this category 12 | * @type {?Collection} 13 | * @readonly 14 | */ 15 | get children() { 16 | return this.guild.channels.cache.filter(c => c.parentID === this.id); 17 | } 18 | 19 | /** 20 | * Sets the category parent of this channel. 21 | * It is not currently possible to set the parent of a CategoryChannel. 22 | * @method setParent 23 | * @memberof CategoryChannel 24 | * @instance 25 | * @param {?GuildChannel|Snowflake} channel Parent channel 26 | * @param {Object} [options={}] Options to pass 27 | * @param {boolean} [options.lockPermissions=true] Lock the permissions to what the parent's permissions are 28 | * @param {string} [options.reason] Reason for modifying the parent of this channel 29 | * @returns {Promise} 30 | */ 31 | } 32 | 33 | module.exports = CategoryChannel; 34 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/DMChannel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Channel = require('./Channel'); 4 | const TextBasedChannel = require('./interfaces/TextBasedChannel'); 5 | const MessageManager = require('../managers/MessageManager'); 6 | 7 | /** 8 | * Represents a direct message channel between two users. 9 | * @extends {Channel} 10 | * @implements {TextBasedChannel} 11 | */ 12 | class DMChannel extends Channel { 13 | /** 14 | * @param {Client} client The instantiating client 15 | * @param {Object} data The data for the DM channel 16 | */ 17 | constructor(client, data) { 18 | super(client, data); 19 | // Override the channel type so partials have a known type 20 | this.type = 'dm'; 21 | /** 22 | * A manager of the messages belonging to this channel 23 | * @type {MessageManager} 24 | */ 25 | this.messages = new MessageManager(this); 26 | this._typing = new Map(); 27 | } 28 | 29 | _patch(data) { 30 | super._patch(data); 31 | 32 | if (data.recipients) { 33 | /** 34 | * The recipient on the other end of the DM 35 | * @type {User} 36 | */ 37 | this.recipient = this.client.users.add(data.recipients[0]); 38 | } 39 | 40 | /** 41 | * The ID of the last message in the channel, if one was sent 42 | * @type {?Snowflake} 43 | */ 44 | this.lastMessageID = data.last_message_id; 45 | 46 | /** 47 | * The timestamp when the last pinned message was pinned, if there was one 48 | * @type {?number} 49 | */ 50 | this.lastPinTimestamp = data.last_pin_timestamp ? new Date(data.last_pin_timestamp).getTime() : null; 51 | } 52 | 53 | /** 54 | * Whether this DMChannel is a partial 55 | * @type {boolean} 56 | * @readonly 57 | */ 58 | get partial() { 59 | return typeof this.lastMessageID === 'undefined'; 60 | } 61 | 62 | /** 63 | * Fetch this DMChannel. 64 | * @returns {Promise} 65 | */ 66 | fetch() { 67 | return this.recipient.createDM(); 68 | } 69 | 70 | /** 71 | * When concatenated with a string, this automatically returns the recipient's mention instead of the 72 | * DMChannel object. 73 | * @returns {string} 74 | * @example 75 | * // Logs: Hello from <@123456789012345678>! 76 | * console.log(`Hello from ${channel}!`); 77 | */ 78 | toString() { 79 | return this.recipient.toString(); 80 | } 81 | 82 | // These are here only for documentation purposes - they are implemented by TextBasedChannel 83 | /* eslint-disable no-empty-function */ 84 | get lastMessage() {} 85 | get lastPinAt() {} 86 | send() {} 87 | startTyping() {} 88 | stopTyping() {} 89 | get typing() {} 90 | get typingCount() {} 91 | createMessageCollector() {} 92 | awaitMessages() {} 93 | // Doesn't work on DM channels; bulkDelete() {} 94 | } 95 | 96 | TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']); 97 | 98 | module.exports = DMChannel; 99 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/Emoji.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Base = require('./Base'); 4 | const Snowflake = require('../util/Snowflake'); 5 | 6 | /** 7 | * Represents an emoji, see {@link GuildEmoji} and {@link ReactionEmoji}. 8 | * @extends {Base} 9 | */ 10 | class Emoji extends Base { 11 | constructor(client, emoji) { 12 | super(client); 13 | /** 14 | * Whether this emoji is animated 15 | * @type {boolean} 16 | */ 17 | this.animated = emoji.animated; 18 | 19 | /** 20 | * The name of this emoji 21 | * @type {string} 22 | */ 23 | this.name = emoji.name; 24 | 25 | /** 26 | * The ID of this emoji 27 | * @type {?Snowflake} 28 | */ 29 | this.id = emoji.id; 30 | 31 | /** 32 | * Whether this emoji has been deleted 33 | * @type {boolean} 34 | */ 35 | this.deleted = false; 36 | } 37 | 38 | /** 39 | * The identifier of this emoji, used for message reactions 40 | * @type {string} 41 | * @readonly 42 | */ 43 | get identifier() { 44 | if (this.id) return `${this.animated ? 'a:' : ''}${this.name}:${this.id}`; 45 | return encodeURIComponent(this.name); 46 | } 47 | 48 | /** 49 | * The URL to the emoji file if its a custom emoji 50 | * @type {?string} 51 | * @readonly 52 | */ 53 | get url() { 54 | if (!this.id) return null; 55 | return this.client.rest.cdn.Emoji(this.id, this.animated ? 'gif' : 'png'); 56 | } 57 | 58 | /** 59 | * The timestamp the emoji was created at, or null if unicode 60 | * @type {?number} 61 | * @readonly 62 | */ 63 | get createdTimestamp() { 64 | if (!this.id) return null; 65 | return Snowflake.deconstruct(this.id).timestamp; 66 | } 67 | 68 | /** 69 | * The time the emoji was created at, or null if unicode 70 | * @type {?Date} 71 | * @readonly 72 | */ 73 | get createdAt() { 74 | if (!this.id) return null; 75 | return new Date(this.createdTimestamp); 76 | } 77 | 78 | /** 79 | * When concatenated with a string, this automatically returns the text required to form a graphical emoji on Discord 80 | * instead of the Emoji object. 81 | * @returns {string} 82 | * @example 83 | * // Send a custom emoji from a guild: 84 | * const emoji = guild.emojis.cache.first(); 85 | * msg.reply(`Hello! ${emoji}`); 86 | * @example 87 | * // Send the emoji used in a reaction to the channel the reaction is part of 88 | * reaction.message.channel.send(`The emoji used was: ${reaction.emoji}`); 89 | */ 90 | toString() { 91 | return this.id ? `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>` : this.name; 92 | } 93 | 94 | toJSON() { 95 | return super.toJSON({ 96 | guild: 'guildID', 97 | createdTimestamp: true, 98 | url: true, 99 | identifier: true, 100 | }); 101 | } 102 | } 103 | 104 | module.exports = Emoji; 105 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/GuildPreviewEmoji.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseGuildEmoji = require('./BaseGuildEmoji'); 4 | 5 | /** 6 | * Represents an instance of an emoji belonging to a public guild obtained through Discord's preview endpoint. 7 | * @extends {BaseGuildEmoji} 8 | */ 9 | class GuildPreviewEmoji extends BaseGuildEmoji { 10 | /** 11 | * The public guild this emoji is part of 12 | * @type {GuildPreview} 13 | * @name GuildPreviewEmoji#guild 14 | */ 15 | 16 | /** 17 | * Set of roles this emoji is active for 18 | * @type {Set} 19 | * @readonly 20 | */ 21 | get roles() { 22 | return new Set(this._roles); 23 | } 24 | } 25 | 26 | module.exports = GuildPreviewEmoji; 27 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/MessageAttachment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Util = require('../util/Util'); 4 | 5 | /** 6 | * Represents an attachment in a message. 7 | */ 8 | class MessageAttachment { 9 | /** 10 | * @param {BufferResolvable|Stream} attachment The file 11 | * @param {string} [name=null] The name of the file, if any 12 | * @param {Object} [data] Extra data 13 | */ 14 | constructor(attachment, name = null, data) { 15 | this.attachment = attachment; 16 | /** 17 | * The name of this attachment 18 | * @type {?string} 19 | */ 20 | this.name = name; 21 | if (data) this._patch(data); 22 | } 23 | 24 | /** 25 | * Sets the file of this attachment. 26 | * @param {BufferResolvable|Stream} attachment The file 27 | * @param {string} [name=null] The name of the file, if any 28 | * @returns {MessageAttachment} This attachment 29 | */ 30 | setFile(attachment, name = null) { 31 | this.attachment = attachment; 32 | this.name = name; 33 | return this; 34 | } 35 | 36 | /** 37 | * Sets the name of this attachment. 38 | * @param {string} name The name of the file 39 | * @returns {MessageAttachment} This attachment 40 | */ 41 | setName(name) { 42 | this.name = name; 43 | return this; 44 | } 45 | 46 | _patch(data) { 47 | /** 48 | * The ID of this attachment 49 | * @type {Snowflake} 50 | */ 51 | this.id = data.id; 52 | 53 | /** 54 | * The size of this attachment in bytes 55 | * @type {number} 56 | */ 57 | this.size = data.size; 58 | 59 | /** 60 | * The URL to this attachment 61 | * @type {string} 62 | */ 63 | this.url = data.url; 64 | 65 | /** 66 | * The Proxy URL to this attachment 67 | * @type {string} 68 | */ 69 | this.proxyURL = data.proxy_url; 70 | 71 | /** 72 | * The height of this attachment (if an image or video) 73 | * @type {?number} 74 | */ 75 | this.height = typeof data.height !== 'undefined' ? data.height : null; 76 | 77 | /** 78 | * The width of this attachment (if an image or video) 79 | * @type {?number} 80 | */ 81 | this.width = typeof data.width !== 'undefined' ? data.width : null; 82 | } 83 | 84 | /** 85 | * Whether or not this attachment has been marked as a spoiler 86 | * @type {boolean} 87 | * @readonly 88 | */ 89 | get spoiler() { 90 | return Util.basename(this.url).startsWith('SPOILER_'); 91 | } 92 | 93 | toJSON() { 94 | return Util.flatten(this); 95 | } 96 | } 97 | 98 | module.exports = MessageAttachment; 99 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/NewsChannel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const TextChannel = require('./TextChannel'); 4 | 5 | /** 6 | * Represents a guild news channel on Discord. 7 | * @extends {TextChannel} 8 | */ 9 | class NewsChannel extends TextChannel { 10 | _patch(data) { 11 | super._patch(data); 12 | 13 | // News channels don't have a rate limit per user, remove it 14 | this.rateLimitPerUser = undefined; 15 | } 16 | } 17 | 18 | module.exports = NewsChannel; 19 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/PartialGroupDMChannel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Channel = require('./Channel'); 4 | const { Error } = require('../errors'); 5 | 6 | /** 7 | * Represents a Partial Group DM Channel on Discord. 8 | * @extends {Channel} 9 | */ 10 | class PartialGroupDMChannel extends Channel { 11 | constructor(client, data) { 12 | super(client, data); 13 | 14 | /** 15 | * The name of this Group DM Channel 16 | * @type {string} 17 | */ 18 | this.name = data.name; 19 | 20 | /** 21 | * The hash of the channel icon 22 | * @type {?string} 23 | */ 24 | this.icon = data.icon; 25 | } 26 | 27 | /** 28 | * The URL to this channel's icon. 29 | * @param {ImageURLOptions} [options={}] Options for the Image URL 30 | * @returns {?string} 31 | */ 32 | iconURL({ format, size } = {}) { 33 | if (!this.icon) return null; 34 | return this.client.rest.cdn.GDMIcon(this.id, this.icon, format, size); 35 | } 36 | 37 | delete() { 38 | return Promise.reject(new Error('DELETE_GROUP_DM_CHANNEL')); 39 | } 40 | 41 | fetch() { 42 | return Promise.reject(new Error('FETCH_GROUP_DM_CHANNEL')); 43 | } 44 | } 45 | 46 | module.exports = PartialGroupDMChannel; 47 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/ReactionEmoji.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Emoji = require('./Emoji'); 4 | const Util = require('../util/Util'); 5 | 6 | /** 7 | * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis 8 | * will use this class opposed to the Emoji class when the client doesn't know enough 9 | * information about them. 10 | * @extends {Emoji} 11 | */ 12 | class ReactionEmoji extends Emoji { 13 | constructor(reaction, emoji) { 14 | super(reaction.message.client, emoji); 15 | /** 16 | * The message reaction this emoji refers to 17 | * @type {MessageReaction} 18 | */ 19 | this.reaction = reaction; 20 | } 21 | 22 | toJSON() { 23 | return Util.flatten(this, { identifier: true }); 24 | } 25 | 26 | valueOf() { 27 | return this.id; 28 | } 29 | } 30 | 31 | module.exports = ReactionEmoji; 32 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/StoreChannel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const GuildChannel = require('./GuildChannel'); 4 | 5 | /** 6 | * Represents a guild store channel on Discord. 7 | * @extends {GuildChannel} 8 | */ 9 | class StoreChannel extends GuildChannel { 10 | _patch(data) { 11 | super._patch(data); 12 | 13 | /** 14 | * If the guild considers this channel NSFW 15 | * @type {boolean} 16 | * @readonly 17 | */ 18 | this.nsfw = data.nsfw; 19 | } 20 | } 21 | 22 | module.exports = StoreChannel; 23 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/Team.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Base = require('./Base'); 4 | const TeamMember = require('./TeamMember'); 5 | const Collection = require('../util/Collection'); 6 | const Snowflake = require('../util/Snowflake'); 7 | 8 | /** 9 | * Represents a Client OAuth2 Application Team. 10 | * @extends {Base} 11 | */ 12 | class Team extends Base { 13 | constructor(client, data) { 14 | super(client); 15 | this._patch(data); 16 | } 17 | 18 | _patch(data) { 19 | /** 20 | * The ID of the Team 21 | * @type {Snowflake} 22 | */ 23 | this.id = data.id; 24 | 25 | /** 26 | * The name of the Team 27 | * @type {string} 28 | */ 29 | this.name = data.name; 30 | 31 | /** 32 | * The Team's icon hash 33 | * @type {?string} 34 | */ 35 | this.icon = data.icon || null; 36 | 37 | /** 38 | * The Team's owner id 39 | * @type {?string} 40 | */ 41 | this.ownerID = data.owner_user_id || null; 42 | 43 | /** 44 | * The Team's members 45 | * @type {Collection} 46 | */ 47 | this.members = new Collection(); 48 | 49 | for (const memberData of data.members) { 50 | const member = new TeamMember(this, memberData); 51 | this.members.set(member.id, member); 52 | } 53 | } 54 | 55 | /** 56 | * The owner of this team 57 | * @type {?TeamMember} 58 | * @readonly 59 | */ 60 | get owner() { 61 | return this.members.get(this.ownerID) || null; 62 | } 63 | 64 | /** 65 | * The timestamp the team was created at 66 | * @type {number} 67 | * @readonly 68 | */ 69 | get createdTimestamp() { 70 | return Snowflake.deconstruct(this.id).timestamp; 71 | } 72 | 73 | /** 74 | * The time the team was created at 75 | * @type {Date} 76 | * @readonly 77 | */ 78 | get createdAt() { 79 | return new Date(this.createdTimestamp); 80 | } 81 | 82 | /** 83 | * A link to the teams's icon. 84 | * @param {ImageURLOptions} [options={}] Options for the Image URL 85 | * @returns {?string} URL to the icon 86 | */ 87 | iconURL({ format, size } = {}) { 88 | if (!this.icon) return null; 89 | return this.client.rest.cdn.TeamIcon(this.id, this.icon, { format, size }); 90 | } 91 | 92 | /** 93 | * When concatenated with a string, this automatically returns the Team's name instead of the 94 | * Team object. 95 | * @returns {string} 96 | * @example 97 | * // Logs: Team name: My Team 98 | * console.log(`Team name: ${team}`); 99 | */ 100 | toString() { 101 | return this.name; 102 | } 103 | 104 | toJSON() { 105 | return super.toJSON({ createdTimestamp: true }); 106 | } 107 | } 108 | 109 | module.exports = Team; 110 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/TeamMember.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Base = require('./Base'); 4 | const { MembershipStates } = require('../util/Constants'); 5 | 6 | /** 7 | * Represents a Client OAuth2 Application Team Member. 8 | * @extends {Base} 9 | */ 10 | class TeamMember extends Base { 11 | constructor(team, data) { 12 | super(team.client); 13 | 14 | /** 15 | * The Team this member is part of 16 | * @type {Team} 17 | */ 18 | this.team = team; 19 | 20 | this._patch(data); 21 | } 22 | 23 | _patch(data) { 24 | /** 25 | * The permissions this Team Member has with regard to the team 26 | * @type {string[]} 27 | */ 28 | this.permissions = data.permissions; 29 | 30 | /** 31 | * The permissions this Team Member has with regard to the team 32 | * @type {MembershipStates} 33 | */ 34 | this.membershipState = MembershipStates[data.membership_state]; 35 | 36 | /** 37 | * The user for this Team Member 38 | * @type {User} 39 | */ 40 | this.user = this.client.users.add(data.user); 41 | } 42 | 43 | /** 44 | * The ID of the Team Member 45 | * @type {Snowflake} 46 | * @readonly 47 | */ 48 | get id() { 49 | return this.user.id; 50 | } 51 | 52 | /** 53 | * When concatenated with a string, this automatically returns the team members's mention instead of the 54 | * TeamMember object. 55 | * @returns {string} 56 | * @example 57 | * // Logs: Team Member's mention: <@123456789012345678> 58 | * console.log(`Team Member's mention: ${teamMember}`); 59 | */ 60 | toString() { 61 | return this.user.toString(); 62 | } 63 | } 64 | 65 | module.exports = TeamMember; 66 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/structures/VoiceRegion.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Util = require('../util/Util'); 4 | 5 | /** 6 | * Represents a Discord voice region for guilds. 7 | */ 8 | class VoiceRegion { 9 | constructor(data) { 10 | /** 11 | * The ID of the region 12 | * @type {string} 13 | */ 14 | this.id = data.id; 15 | 16 | /** 17 | * Name of the region 18 | * @type {string} 19 | */ 20 | this.name = data.name; 21 | 22 | /** 23 | * Whether the region is VIP-only 24 | * @type {boolean} 25 | */ 26 | this.vip = data.vip; 27 | 28 | /** 29 | * Whether the region is deprecated 30 | * @type {boolean} 31 | */ 32 | this.deprecated = data.deprecated; 33 | 34 | /** 35 | * Whether the region is optimal 36 | * @type {boolean} 37 | */ 38 | this.optimal = data.optimal; 39 | 40 | /** 41 | * Whether the region is custom 42 | * @type {boolean} 43 | */ 44 | this.custom = data.custom; 45 | } 46 | 47 | toJSON() { 48 | return Util.flatten(this); 49 | } 50 | } 51 | 52 | module.exports = VoiceRegion; 53 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/ActivityFlags.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BitField = require('./BitField'); 4 | 5 | /** 6 | * Data structure that makes it easy to interact with an {@link Activity#flags} bitfield. 7 | * @extends {BitField} 8 | */ 9 | class ActivityFlags extends BitField {} 10 | 11 | /** 12 | * @name ActivityFlags 13 | * @kind constructor 14 | * @memberof ActivityFlags 15 | * @param {BitFieldResolvable} [bits=0] Bit(s) to read from 16 | */ 17 | 18 | /** 19 | * Numeric activity flags. All available properties: 20 | * * `INSTANCE` 21 | * * `JOIN` 22 | * * `SPECTATE` 23 | * * `JOIN_REQUEST` 24 | * * `SYNC` 25 | * * `PLAY` 26 | * @type {Object} 27 | * @see {@link https://discordapp.com/developers/docs/topics/gateway#activity-object-activity-flags} 28 | */ 29 | ActivityFlags.FLAGS = { 30 | INSTANCE: 1 << 0, 31 | JOIN: 1 << 1, 32 | SPECTATE: 1 << 2, 33 | JOIN_REQUEST: 1 << 3, 34 | SYNC: 1 << 4, 35 | PLAY: 1 << 5, 36 | }; 37 | 38 | module.exports = ActivityFlags; 39 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/Collection.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BaseCollection = require('@discordjs/collection'); 4 | const Util = require('./Util'); 5 | 6 | class Collection extends BaseCollection { 7 | toJSON() { 8 | return this.map(e => (typeof e.toJSON === 'function' ? e.toJSON() : Util.flatten(e))); 9 | } 10 | } 11 | 12 | module.exports = Collection; 13 | 14 | /** 15 | * @external Collection 16 | * @see {@link https://discord.js.org/#/docs/collection/master/class/Collection} 17 | */ 18 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/Intents.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const BitField = require('./BitField'); 3 | 4 | /** 5 | * Data structure that makes it easy to calculate intents. 6 | * @extends {BitField} 7 | */ 8 | class Intents extends BitField {} 9 | 10 | /** 11 | * @name Intents 12 | * @kind constructor 13 | * @memberof Intents 14 | * @param {IntentsResolvable} [bits=0] Bit(s) to read from 15 | */ 16 | 17 | /** 18 | * Data that can be resolved to give a permission number. This can be: 19 | * * A string (see {@link Intents.FLAGS}) 20 | * * An intents flag 21 | * * An instance of Intents 22 | * * An array of IntentsResolvable 23 | * @typedef {string|number|Intents|IntentsResolvable[]} IntentsResolvable 24 | */ 25 | 26 | /** 27 | * Numeric websocket intents. All available properties: 28 | * * `GUILDS` 29 | * * `GUILD_MEMBERS` 30 | * * `GUILD_BANS` 31 | * * `GUILD_EMOJIS` 32 | * * `GUILD_INTEGRATIONS` 33 | * * `GUILD_WEBHOOKS` 34 | * * `GUILD_INVITES` 35 | * * `GUILD_VOICE_STATES` 36 | * * `GUILD_PRESENCES` 37 | * * `GUILD_MESSAGES` 38 | * * `GUILD_MESSAGE_REACTIONS` 39 | * * `GUILD_MESSAGE_TYPING` 40 | * * `DIRECT_MESSAGES` 41 | * * `DIRECT_MESSAGE_REACTIONS` 42 | * * `DIRECT_MESSAGE_TYPING` 43 | * @type {Object} 44 | * @see {@link https://discordapp.com/developers/docs/topics/gateway#list-of-intents} 45 | */ 46 | Intents.FLAGS = { 47 | GUILDS: 1 << 0, 48 | GUILD_MEMBERS: 1 << 1, 49 | GUILD_BANS: 1 << 2, 50 | GUILD_EMOJIS: 1 << 3, 51 | GUILD_INTEGRATIONS: 1 << 4, 52 | GUILD_WEBHOOKS: 1 << 5, 53 | GUILD_INVITES: 1 << 6, 54 | GUILD_VOICE_STATES: 1 << 7, 55 | GUILD_PRESENCES: 1 << 8, 56 | GUILD_MESSAGES: 1 << 9, 57 | GUILD_MESSAGE_REACTIONS: 1 << 10, 58 | GUILD_MESSAGE_TYPING: 1 << 11, 59 | DIRECT_MESSAGES: 1 << 12, 60 | DIRECT_MESSAGE_REACTIONS: 1 << 13, 61 | DIRECT_MESSAGE_TYPING: 1 << 14, 62 | }; 63 | 64 | /** 65 | * Bitfield representing all privileged intents 66 | * @type {number} 67 | * @see {@link https://discordapp.com/developers/docs/topics/gateway#privileged-intents} 68 | */ 69 | Intents.PRIVILEGED = Intents.FLAGS.GUILD_MEMBERS | Intents.FLAGS.GUILD_PRESENCES; 70 | 71 | /** 72 | * Bitfield representing all intents combined 73 | * @type {number} 74 | */ 75 | Intents.ALL = Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0); 76 | 77 | /** 78 | * Bitfield representing all non-privileged intents 79 | * @type {number} 80 | */ 81 | Intents.NON_PRIVILEGED = Intents.ALL & ~Intents.PRIVILEGED; 82 | 83 | module.exports = Intents; 84 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/LimitedCollection.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Collection = require('./Collection.js'); 4 | 5 | /** 6 | * A Collection which holds a max amount of entries. The first key is deleted if the Collection has 7 | * reached max size. 8 | * @extends {Collection} 9 | * @param {number} [maxSize=0] The maximum size of the Collection 10 | * @param {Iterable} [iterable=null] Optional entries passed to the Map constructor. 11 | * @private 12 | */ 13 | class LimitedCollection extends Collection { 14 | constructor(maxSize = 0, iterable = null) { 15 | super(iterable); 16 | /** 17 | * The max size of the Collection. 18 | * @type {number} 19 | */ 20 | this.maxSize = maxSize; 21 | } 22 | 23 | set(key, value) { 24 | if (this.maxSize === 0) return this; 25 | if (this.size >= this.maxSize && !this.has(key)) this.delete(this.firstKey()); 26 | return super.set(key, value); 27 | } 28 | 29 | static get [Symbol.species]() { 30 | return Collection; 31 | } 32 | } 33 | 34 | module.exports = LimitedCollection; 35 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/MessageFlags.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BitField = require('./BitField'); 4 | 5 | /** 6 | * Data structure that makes it easy to interact with an {@link Message#flags} bitfield. 7 | * @extends {BitField} 8 | */ 9 | class MessageFlags extends BitField {} 10 | 11 | /** 12 | * @name MessageFlags 13 | * @kind constructor 14 | * @memberof MessageFlags 15 | * @param {BitFieldResolvable} [bits=0] Bit(s) to read from 16 | */ 17 | 18 | /** 19 | * Numeric message flags. All available properties: 20 | * * `CROSSPOSTED` 21 | * * `IS_CROSSPOST` 22 | * * `SUPPRESS_EMBEDS` 23 | * * `SOURCE_MESSAGE_DELETED` 24 | * * `URGENT` 25 | * @type {Object} 26 | * @see {@link https://discordapp.com/developers/docs/resources/channel#message-object-message-flags} 27 | */ 28 | MessageFlags.FLAGS = { 29 | CROSSPOSTED: 1 << 0, 30 | IS_CROSSPOST: 1 << 1, 31 | SUPPRESS_EMBEDS: 1 << 2, 32 | SOURCE_MESSAGE_DELETED: 1 << 3, 33 | URGENT: 1 << 4, 34 | }; 35 | 36 | module.exports = MessageFlags; 37 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/Speaking.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BitField = require('./BitField'); 4 | 5 | /** 6 | * Data structure that makes it easy to interact with a {@link VoiceConnection#speaking} 7 | * and {@link guildMemberSpeaking} event bitfields. 8 | * @extends {BitField} 9 | */ 10 | class Speaking extends BitField {} 11 | 12 | /** 13 | * @name Speaking 14 | * @kind constructor 15 | * @memberof Speaking 16 | * @param {BitFieldResolvable} [bits=0] Bit(s) to read from 17 | */ 18 | 19 | /** 20 | * Numeric speaking flags. All available properties: 21 | * * `SPEAKING` 22 | * * `SOUNDSHARE` 23 | * * `PRIORITY_SPEAKING` 24 | * @type {Object} 25 | * @see {@link https://discordapp.com/developers/docs/topics/voice-connections#speaking} 26 | */ 27 | Speaking.FLAGS = { 28 | SPEAKING: 1 << 0, 29 | SOUNDSHARE: 1 << 1, 30 | PRIORITY_SPEAKING: 1 << 2, 31 | }; 32 | 33 | module.exports = Speaking; 34 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/SystemChannelFlags.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const BitField = require('./BitField'); 4 | 5 | /** 6 | * Data structure that makes it easy to interact with a {@link Guild#systemChannelFlags} bitfield. 7 | * Note that all event message types are enabled by default, 8 | * and by setting their corresponding flags you are disabling them 9 | * @extends {BitField} 10 | */ 11 | class SystemChannelFlags extends BitField {} 12 | 13 | /** 14 | * @name SystemChannelFlags 15 | * @kind constructor 16 | * @memberof SystemChannelFlags 17 | * @param {SystemChannelFlagsResolvable} [bits=0] Bit(s) to read from 18 | */ 19 | 20 | /** 21 | * Data that can be resolved to give a sytem channel flag bitfield. This can be: 22 | * * A string (see {@link SystemChannelFlags.FLAGS}) 23 | * * A sytem channel flag 24 | * * An instance of SystemChannelFlags 25 | * * An Array of SystemChannelFlagsResolvable 26 | * @typedef {string|number|SystemChannelFlags|SystemChannelFlagsResolvable[]} SystemChannelFlagsResolvable 27 | */ 28 | 29 | /** 30 | * Numeric system channel flags. All available properties: 31 | * * `WELCOME_MESSAGE_DISABLED` 32 | * * `BOOST_MESSAGE_DISABLED` 33 | * @type {Object} 34 | */ 35 | SystemChannelFlags.FLAGS = { 36 | WELCOME_MESSAGE_DISABLED: 1 << 0, 37 | BOOST_MESSAGE_DISABLED: 1 << 1, 38 | }; 39 | 40 | module.exports = SystemChannelFlags; 41 | -------------------------------------------------------------------------------- /node_modules/discord.js/src/util/UserFlags.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const BitField = require('./BitField'); 3 | 4 | /** 5 | * Data structure that makes it easy to interact with a {@link User#flags} bitfield. 6 | * @extends {BitField} 7 | */ 8 | class UserFlags extends BitField {} 9 | 10 | /** 11 | * @name UserFlags 12 | * @kind constructor 13 | * @memberof UserFlags 14 | * @param {BitFieldResolvable} [bits=0] Bit(s) to read from 15 | */ 16 | 17 | /** 18 | * Numeric user flags. All available properties: 19 | * * `DISCORD_EMPLOYEE` 20 | * * `DISCORD_PARTNER` 21 | * * `HYPESQUAD_EVENTS` 22 | * * `BUGHUNTER_LEVEL_1` 23 | * * `HOUSE_BRAVERY` 24 | * * `HOUSE_BRILLIANCE` 25 | * * `HOUSE_BALANCE` 26 | * * `EARLY_SUPPORTER` 27 | * * `TEAM_USER` 28 | * * `SYSTEM` 29 | * * `BUGHUNTER_LEVEL_2` 30 | * * `VERIFIED_BOT` 31 | * * `VERIFIED_DEVELOPER` 32 | * @type {Object} 33 | * @see {@link https://discordapp.com/developers/docs/resources/user#user-object-user-flags} 34 | */ 35 | UserFlags.FLAGS = { 36 | DISCORD_EMPLOYEE: 1 << 0, 37 | DISCORD_PARTNER: 1 << 1, 38 | HYPESQUAD_EVENTS: 1 << 2, 39 | BUGHUNTER_LEVEL_1: 1 << 3, 40 | HOUSE_BRAVERY: 1 << 6, 41 | HOUSE_BRILLIANCE: 1 << 7, 42 | HOUSE_BALANCE: 1 << 8, 43 | EARLY_SUPPORTER: 1 << 9, 44 | TEAM_USER: 1 << 10, 45 | SYSTEM: 1 << 12, 46 | BUGHUNTER_LEVEL_2: 1 << 14, 47 | VERIFIED_BOT: 1 << 16, 48 | VERIFIED_DEVELOPER: 1 << 17, 49 | }; 50 | 51 | module.exports = UserFlags; 52 | -------------------------------------------------------------------------------- /node_modules/discord.js/typings/index.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import { Client } from 'discord.js'; 4 | 5 | const client: Client = new Client(); 6 | 7 | client.on('ready', () => { 8 | console.log(`Client is logged in as ${client.user!.tag} and ready!`); 9 | }); 10 | 11 | client.on('guildCreate', g => { 12 | const channel = g.channels.cache.random(); 13 | if (!channel) return; 14 | 15 | channel.setName('foo').then(updatedChannel => { 16 | console.log(`New channel name: ${updatedChannel.name}`); 17 | }); 18 | }); 19 | 20 | client.on('messageReactionRemoveAll', async message => { 21 | console.log(`messageReactionRemoveAll - id: ${message.id} (${message.id.length})`); 22 | 23 | if (message.partial) message = await message.fetch(); 24 | 25 | console.log(`messageReactionRemoveAll - content: ${message.content}`); 26 | }); 27 | 28 | client.login('absolutely-valid-token'); 29 | -------------------------------------------------------------------------------- /node_modules/event-target-shim/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Toru Nagashima 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/mime-db/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong me@jongleberry.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /node_modules/mime-db/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * mime-db 3 | * Copyright(c) 2014 Jonathan Ong 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module exports. 9 | */ 10 | 11 | module.exports = require('./db.json') 12 | -------------------------------------------------------------------------------- /node_modules/mime-types/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /node_modules/mime-types/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "mime-types@^2.1.12", 3 | "_id": "mime-types@2.1.27", 4 | "_inBundle": false, 5 | "_integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", 6 | "_location": "/mime-types", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "mime-types@^2.1.12", 12 | "name": "mime-types", 13 | "escapedName": "mime-types", 14 | "rawSpec": "^2.1.12", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.1.12" 17 | }, 18 | "_requiredBy": [ 19 | "/@discordjs/form-data" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", 22 | "_shasum": "47949f98e279ea53119f5722e0f34e529bec009f", 23 | "_spec": "mime-types@^2.1.12", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\@discordjs\\form-data", 25 | "bugs": { 26 | "url": "https://github.com/jshttp/mime-types/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "contributors": [ 30 | { 31 | "name": "Douglas Christopher Wilson", 32 | "email": "doug@somethingdoug.com" 33 | }, 34 | { 35 | "name": "Jeremiah Senkpiel", 36 | "email": "fishrock123@rocketmail.com", 37 | "url": "https://searchbeam.jit.su" 38 | }, 39 | { 40 | "name": "Jonathan Ong", 41 | "email": "me@jongleberry.com", 42 | "url": "http://jongleberry.com" 43 | } 44 | ], 45 | "dependencies": { 46 | "mime-db": "1.44.0" 47 | }, 48 | "deprecated": false, 49 | "description": "The ultimate javascript content-type utility.", 50 | "devDependencies": { 51 | "eslint": "6.8.0", 52 | "eslint-config-standard": "14.1.1", 53 | "eslint-plugin-import": "2.20.2", 54 | "eslint-plugin-markdown": "1.0.2", 55 | "eslint-plugin-node": "11.1.0", 56 | "eslint-plugin-promise": "4.2.1", 57 | "eslint-plugin-standard": "4.0.1", 58 | "mocha": "7.1.1", 59 | "nyc": "15.0.1" 60 | }, 61 | "engines": { 62 | "node": ">= 0.6" 63 | }, 64 | "files": [ 65 | "HISTORY.md", 66 | "LICENSE", 67 | "index.js" 68 | ], 69 | "homepage": "https://github.com/jshttp/mime-types#readme", 70 | "keywords": [ 71 | "mime", 72 | "types" 73 | ], 74 | "license": "MIT", 75 | "name": "mime-types", 76 | "repository": { 77 | "type": "git", 78 | "url": "git+https://github.com/jshttp/mime-types.git" 79 | }, 80 | "scripts": { 81 | "lint": "eslint --plugin markdown --ext js,md .", 82 | "test": "mocha --reporter spec test/test.js", 83 | "test-cov": "nyc --reporter=html --reporter=text npm test", 84 | "test-travis": "nyc --reporter=text npm test" 85 | }, 86 | "version": "2.1.27" 87 | } 88 | -------------------------------------------------------------------------------- /node_modules/node-fetch/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 David Frank 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /node_modules/node-fetch/browser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // ref: https://github.com/tc39/proposal-global 4 | var getGlobal = function () { 5 | // the only reliable means to get the global object is 6 | // `Function('return this')()` 7 | // However, this causes CSP violations in Chrome apps. 8 | if (typeof self !== 'undefined') { return self; } 9 | if (typeof window !== 'undefined') { return window; } 10 | if (typeof global !== 'undefined') { return global; } 11 | throw new Error('unable to locate global object'); 12 | } 13 | 14 | var global = getGlobal(); 15 | 16 | module.exports = exports = global.fetch; 17 | 18 | // Needed for TypeScript and Webpack. 19 | exports.default = global.fetch.bind(global); 20 | 21 | exports.Headers = global.Headers; 22 | exports.Request = global.Request; 23 | exports.Response = global.Response; -------------------------------------------------------------------------------- /node_modules/prism-media/README.md: -------------------------------------------------------------------------------- 1 | [![Logo](https://hydrabolt.me/assets/prism-media-logo.svg)](https://hydrabolt.me/prism-media/) 2 | 3 |
4 | 5 | [![Build Status](https://travis-ci.org/amishshah/prism-media.svg?branch=master)](https://travis-ci.org/hydrabolt/prism-media) 6 | [![dependencies](https://david-dm.org/amishshah/prism-media/status.svg)](https://david-dm.org/hydrabolt/prism-media) 7 | [![npm](https://img.shields.io/npm/dt/prism-media.svg)](https://www.npmjs.com/package/prism-media) 8 | [![Patreon](https://img.shields.io/badge/donate-patreon-F96854.svg)](https://www.patreon.com/discordjs) 9 | 10 |
11 | 12 | ## What is it? 13 | 14 | An easy-to-use stream-based toolkit that you can use for media processing. All the features provided have predictable 15 | abstractions and join together coherently. 16 | 17 | ```js 18 | // This example will demux and decode an Opus-containing OGG file, and then write it to a file. 19 | const prism = require('prism-media'); 20 | const fs = require('fs'); 21 | 22 | fs.createReadStream('./audio.ogg') 23 | .pipe(new prism.opus.OggDemuxer()) 24 | .pipe(new prism.opus.Decoder({ rate: 48000, channels: 2, frameSize: 960 })) 25 | .pipe(fs.createWriteStream('./audio.pcm')); 26 | ``` 27 | 28 | The example above can work with either a native or pure JavaScript Opus decoder - you don't need to worry about changing 29 | your code for whichever you install. 30 | 31 | - FFmpeg support (either through npm modules or a normal installation) 32 | - Opus support (native or pure JavaScript) 33 | - Demuxing for WebM/OGG files (no modules required!) 34 | - Volume Altering (no modules required!) 35 | 36 | ## Dependencies 37 | 38 | The following dependencies are all optional, and you should only install one from each category (the first listed in 39 | each category is preferred) 40 | 41 | - Opus 42 | - [`@discordjs/opus`](https://github.com/discordjs/opus) 43 | - [`node-opus`](https://github.com/Rantanen/node-opus) 44 | - [`opusscript`](https://github.com/abalabahaha/opusscript) 45 | - FFmpeg 46 | - [`ffmpeg-static`](http://npmjs.com/ffmpeg-static) 47 | - `ffmpeg` from a [normal installation](https://www.ffmpeg.org/download.html) 48 | 49 | ## Useful Links 50 | 51 | - [Documentation](https://hydrabolt.me/prism-media) 52 | - [Examples](https://github.com/amishshah/prism-media/tree/master/examples) 53 | - [Patreon](https://www.patreon.com/discordjs) 54 | 55 | ## License 56 | 57 | > Copyright 2019 - 2020 Amish Shah 58 | > 59 | > Licensed under the Apache License, Version 2.0 (the "License"); 60 | > you may not use this file except in compliance with the License. 61 | > You may obtain a copy of the License at 62 | > 63 | > http://www.apache.org/licenses/LICENSE-2.0 64 | > 65 | > Unless required by applicable law or agreed to in writing, software 66 | > distributed under the License is distributed on an "AS IS" BASIS, 67 | > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 68 | > See the License for the specific language governing permissions and 69 | > limitations under the License. -------------------------------------------------------------------------------- /node_modules/prism-media/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "prism-media@^1.2.0", 3 | "_id": "prism-media@1.2.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-I+nkWY212lJ500jLe4tN9tWO7nRiBAVdMv76P9kffZjYhw20raMlW1HSSvS+MLXC9MmbNZCazMrAr+5jEEgTuw==", 6 | "_location": "/prism-media", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "prism-media@^1.2.0", 12 | "name": "prism-media", 13 | "escapedName": "prism-media", 14 | "rawSpec": "^1.2.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.2.0" 17 | }, 18 | "_requiredBy": [ 19 | "/discord.js" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.2.tgz", 22 | "_shasum": "4f1c841f248b67d325a24b4e6b1a491b8f50a24f", 23 | "_spec": "prism-media@^1.2.0", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\discord.js", 25 | "author": { 26 | "name": "Amish Shah", 27 | "email": "amishshah.2k@gmail.com" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/hydrabolt/prism-media/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "deprecated": false, 34 | "description": "Easy-to-use stream-based media transcoding", 35 | "devDependencies": { 36 | "docma": "^3.2.2", 37 | "eslint": "^6.8.0", 38 | "jest": "^24.9.0" 39 | }, 40 | "files": [ 41 | "src/", 42 | "typings/" 43 | ], 44 | "homepage": "https://github.com/hydrabolt/prism-media#readme", 45 | "jest": { 46 | "testURL": "http://localhost/" 47 | }, 48 | "keywords": [ 49 | "audio", 50 | "media", 51 | "ffmpeg", 52 | "opus", 53 | "pcm", 54 | "webm", 55 | "ogg" 56 | ], 57 | "license": "Apache-2.0", 58 | "main": "src/index.js", 59 | "name": "prism-media", 60 | "peerDependencies": { 61 | "ffmpeg-static": "^2.4.0 || ^3.0.0", 62 | "@discordjs/opus": "^0.1.0", 63 | "node-opus": "^0.3.1", 64 | "opusscript": "^0.0.6" 65 | }, 66 | "peerDependenciesMeta": { 67 | "@discordjs/opus": { 68 | "optional": true 69 | }, 70 | "node-opus": { 71 | "optional": true 72 | }, 73 | "opusscript": { 74 | "optional": true 75 | }, 76 | "ffmpeg-static": { 77 | "optional": true 78 | } 79 | }, 80 | "repository": { 81 | "type": "git", 82 | "url": "git+https://github.com/hydrabolt/prism-media.git" 83 | }, 84 | "scripts": { 85 | "docs": "docma", 86 | "lint": "eslint src", 87 | "test": "npm run lint && jest && npm run docs" 88 | }, 89 | "types": "typings/index.d.ts", 90 | "version": "1.2.2" 91 | } 92 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/core/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Core features. 3 | * **You shouldn't prefix imports from this namespace with `core`.** 4 | * @namespace core 5 | */ 6 | module.exports = { 7 | FFmpeg: require('./FFmpeg'), 8 | VolumeTransformer: require('./VolumeTransformer'), 9 | }; 10 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | opus: require('./opus'), 3 | vorbis: require('./vorbis'), 4 | ...require('./core'), 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/opus/WebmDemuxer.js: -------------------------------------------------------------------------------- 1 | const WebmBaseDemuxer = require('../core/WebmBase'); 2 | 3 | const OPUS_HEAD = Buffer.from([...'OpusHead'].map(x => x.charCodeAt(0))); 4 | 5 | /** 6 | * Demuxes a Webm stream (containing Opus audio) to output an Opus stream. 7 | * @extends core.WebmBaseDemuxer 8 | * @memberof opus 9 | * @example 10 | * const fs = require('fs'); 11 | * const file = fs.createReadStream('./audio.webm'); 12 | * const demuxer = new prism.opus.WebmDemuxer(); 13 | * const opus = file.pipe(demuxer); 14 | * // opus is now a ReadableStream in object mode outputting Opus packets 15 | */ 16 | class WebmDemuxer extends WebmBaseDemuxer { 17 | _checkHead(data) { 18 | if (!data.slice(0, 8).equals(OPUS_HEAD)) { 19 | throw Error('Audio codec is not Opus!'); 20 | } 21 | } 22 | } 23 | 24 | module.exports = WebmDemuxer; 25 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/opus/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Opus features 3 | * @namespace opus 4 | */ 5 | module.exports = { 6 | // Encoder and Decoder 7 | ...require('./Opus'), 8 | OggDemuxer: require('./OggDemuxer'), 9 | WebmDemuxer: require('./WebmDemuxer'), 10 | }; 11 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/util/Constants.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/randysim/EconomyBot/22cd2c6ac2f96067db6b6e55b804df8c42b1d010/node_modules/prism-media/src/util/Constants.js -------------------------------------------------------------------------------- /node_modules/prism-media/src/util/loader.js: -------------------------------------------------------------------------------- 1 | exports.require = function loader(list) { 2 | const errorLog = []; 3 | for (const [name, fn] of list) { 4 | try { 5 | const data = fn(require(name)); 6 | data.name = name; 7 | return data; 8 | } catch (e) { 9 | errorLog.push(e); 10 | } 11 | } 12 | throw new Error(errorLog.join('\n')); 13 | }; 14 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/vorbis/WebmDemuxer.js: -------------------------------------------------------------------------------- 1 | const WebmBaseDemuxer = require('../core/WebmBase'); 2 | 3 | const VORBIS_HEAD = Buffer.from([...'vorbis'].map(x => x.charCodeAt(0))); 4 | 5 | /** 6 | * Demuxes a Webm stream (containing Vorbis audio) to output a Vorbis stream. 7 | * @memberof vorbis 8 | * @extends core.WebmBaseDemuxer 9 | */ 10 | class WebmDemuxer extends WebmBaseDemuxer { 11 | _checkHead(data) { 12 | if (data.readUInt8(0) !== 2 || !data.slice(4, 10).equals(VORBIS_HEAD)) { 13 | throw Error('Audio codec is not Vorbis!'); 14 | } 15 | 16 | this.push(data.slice(3, 3 + data.readUInt8(1))); 17 | this.push(data.slice(3 + data.readUInt8(1), 3 + data.readUInt8(1) + data.readUInt8(2))); 18 | this.push(data.slice(3 + data.readUInt8(1) + data.readUInt8(2))); 19 | } 20 | } 21 | 22 | module.exports = WebmDemuxer; 23 | -------------------------------------------------------------------------------- /node_modules/prism-media/src/vorbis/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Vorbis features 3 | * @namespace vorbis 4 | */ 5 | 6 | module.exports = { 7 | WebmDemuxer: require('./WebmDemuxer'), 8 | }; 9 | -------------------------------------------------------------------------------- /node_modules/prism-media/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Transform } from 'stream'; 2 | 3 | import { ChildProcess } from 'child_process'; 4 | import { Duplex } from 'stream'; 5 | 6 | import { opus } from './opus'; 7 | import { vorbis } from './vorbis'; 8 | 9 | export interface FFmpegOptions { 10 | args?: string[]; 11 | } 12 | 13 | export interface FFmpegInfo { 14 | command: string; 15 | info: string; 16 | version: string; 17 | } 18 | 19 | export class FFmpeg extends Duplex { 20 | public process: ChildProcess; 21 | constructor(options?: FFmpegOptions); 22 | static getInfo(force?: boolean): FFmpegInfo; 23 | } 24 | 25 | export interface VolumeOptions { 26 | type: 's16le' | 's16be' | 's32le' | 's32be', 27 | volume?: number 28 | } 29 | 30 | export class VolumeTransformer { 31 | public volume: number; 32 | 33 | constructor(options: VolumeOptions); 34 | public setVolume(volume: number): void; 35 | public setVolumeDecibels(db: number): void; 36 | public setVolumeLogarithmic(value: number): void; 37 | public readonly volumeDecibels: number; 38 | public readonly volumeLogarithmic: number; 39 | } 40 | 41 | export { opus, vorbis }; -------------------------------------------------------------------------------- /node_modules/prism-media/typings/opus.d.ts: -------------------------------------------------------------------------------- 1 | import { Transform } from 'stream'; 2 | 3 | interface OpusOptions { 4 | frameSize: number, 5 | channels: number, 6 | rate: number 7 | } 8 | 9 | export class OpusStream extends Transform { 10 | public encoder: any; // TODO: type opusscript/node-opus 11 | 12 | constructor(options?: OpusOptions); 13 | public static readonly type: 'opusscript' | 'node-opus' | '@discordjs/opus'; 14 | public setBitrate(bitrate: number): void; 15 | public setFEC(enabled: boolean): void; 16 | public setPLP(percentage: number): void; 17 | } 18 | 19 | export namespace opus { 20 | interface OpusOptions { 21 | frameSize: number, 22 | channels: number, 23 | rate: number 24 | } 25 | 26 | export class Encoder extends OpusStream {} 27 | export class Decoder extends OpusStream {} 28 | export class OggDemuxer extends Transform {} 29 | export class WebmDemuxer extends Transform {} 30 | } -------------------------------------------------------------------------------- /node_modules/prism-media/typings/vorbis.d.ts: -------------------------------------------------------------------------------- 1 | import { Transform } from 'stream'; 2 | 3 | export namespace vorbis { 4 | export class WebmDemuxer extends Transform {} 5 | } -------------------------------------------------------------------------------- /node_modules/setimmediate/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, and Domenic Denicola 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node_modules/setimmediate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "setimmediate@^1.0.5", 3 | "_id": "setimmediate@1.0.5", 4 | "_inBundle": false, 5 | "_integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", 6 | "_location": "/setimmediate", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "setimmediate@^1.0.5", 12 | "name": "setimmediate", 13 | "escapedName": "setimmediate", 14 | "rawSpec": "^1.0.5", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.5" 17 | }, 18 | "_requiredBy": [ 19 | "/discord.js" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", 22 | "_shasum": "290cbb232e306942d7d7ea9b83732ab7856f8285", 23 | "_spec": "setimmediate@^1.0.5", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\discord.js", 25 | "author": { 26 | "name": "YuzuJS" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/YuzuJS/setImmediate/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "contributors": [ 33 | { 34 | "name": "Domenic Denicola", 35 | "email": "d@domenic.me", 36 | "url": "https://domenic.me" 37 | }, 38 | { 39 | "name": "Donavon West", 40 | "email": "github@donavon.com", 41 | "url": "http://donavon.com" 42 | }, 43 | { 44 | "name": "Yaffle" 45 | } 46 | ], 47 | "deprecated": false, 48 | "description": "A shim for the setImmediate efficient script yielding API", 49 | "devDependencies": { 50 | "http-server": "~0.6.1", 51 | "jshint": "^2.5.0", 52 | "mocha": "~1.18.2", 53 | "opener": "^1.3", 54 | "zuul": "^1.6.4" 55 | }, 56 | "files": [ 57 | "setImmediate.js" 58 | ], 59 | "homepage": "https://github.com/YuzuJS/setImmediate#readme", 60 | "license": "MIT", 61 | "main": "setImmediate.js", 62 | "name": "setimmediate", 63 | "repository": { 64 | "type": "git", 65 | "url": "git+https://github.com/YuzuJS/setImmediate.git" 66 | }, 67 | "scripts": { 68 | "lint": "jshint setImmediate.js", 69 | "test": "mocha test/tests.js", 70 | "test-browser": "opener http://localhost:9008/__zuul && zuul test/tests.js --ui mocha-bdd --local 9008", 71 | "test-browser-only": "opener http://localhost:9007/test/browserOnly/index.html && http-server . -p 9007" 72 | }, 73 | "version": "1.0.5" 74 | } 75 | -------------------------------------------------------------------------------- /node_modules/tweetnacl/AUTHORS.md: -------------------------------------------------------------------------------- 1 | List of TweetNaCl.js authors 2 | ============================ 3 | 4 | Format: Name (GitHub username or URL) 5 | 6 | * Dmitry Chestnykh (@dchest) 7 | * Devi Mandiri (@devi) 8 | * AndSDev (@AndSDev) 9 | 10 | List of authors of third-party public domain code from which TweetNaCl.js code was derived 11 | ========================================================================================== 12 | 13 | [TweetNaCl](http://tweetnacl.cr.yp.to/) 14 | -------------------------------------- 15 | 16 | * Bernard van Gastel 17 | * Daniel J. Bernstein 18 | * Peter Schwabe 19 | * Sjaak Smetsers 20 | * Tanja Lange 21 | * Wesley Janssen 22 | 23 | 24 | [Poly1305-donna](https://github.com/floodyberry/poly1305-donna) 25 | -------------------------------------------------------------- 26 | 27 | * Andrew Moon (@floodyberry) 28 | -------------------------------------------------------------------------------- /node_modules/tweetnacl/LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Important! 2 | 3 | If your contribution is not trivial (not a typo fix, etc.), we can only accept 4 | it if you dedicate your copyright for the contribution to the public domain. 5 | Make sure you understand what it means (see http://unlicense.org/)! If you 6 | agree, please add yourself to AUTHORS.md file, and include the following text 7 | to your pull request description or a comment in it: 8 | 9 | ------------------------------------------------------------------------------ 10 | 11 | I dedicate any and all copyright interest in this software to the 12 | public domain. I make this dedication for the benefit of the public at 13 | large and to the detriment of my heirs and successors. I intend this 14 | dedication to be an overt act of relinquishment in perpetuity of all 15 | present and future rights to this software under copyright law. 16 | 17 | Anyone is free to copy, modify, publish, use, compile, sell, or 18 | distribute this software, either in source code form or as a compiled 19 | binary, for any purpose, commercial or non-commercial, and by any 20 | means. 21 | -------------------------------------------------------------------------------- /node_modules/tweetnacl/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "tweetnacl@^1.0.3", 3 | "_id": "tweetnacl@1.0.3", 4 | "_inBundle": false, 5 | "_integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", 6 | "_location": "/tweetnacl", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "tweetnacl@^1.0.3", 12 | "name": "tweetnacl", 13 | "escapedName": "tweetnacl", 14 | "rawSpec": "^1.0.3", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.3" 17 | }, 18 | "_requiredBy": [ 19 | "/discord.js" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", 22 | "_shasum": "ac0af71680458d8a6378d0d0d050ab1407d35596", 23 | "_spec": "tweetnacl@^1.0.3", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\discord.js", 25 | "author": { 26 | "name": "TweetNaCl-js contributors" 27 | }, 28 | "browser": { 29 | "buffer": false, 30 | "crypto": false 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/dchest/tweetnacl-js/issues" 34 | }, 35 | "bundleDependencies": false, 36 | "deprecated": false, 37 | "description": "Port of TweetNaCl cryptographic library to JavaScript", 38 | "devDependencies": { 39 | "browserify": "^16.2.3", 40 | "eslint": "^6.8.0", 41 | "faucet": "^0.0.1", 42 | "tap-browser-color": "^0.1.2", 43 | "tape": "^4.13.0", 44 | "tweetnacl-util": "^0.15.0", 45 | "uglify-js": "^3.7.5" 46 | }, 47 | "directories": { 48 | "test": "test" 49 | }, 50 | "homepage": "https://tweetnacl.js.org", 51 | "keywords": [ 52 | "crypto", 53 | "cryptography", 54 | "curve25519", 55 | "ed25519", 56 | "encrypt", 57 | "hash", 58 | "key", 59 | "nacl", 60 | "poly1305", 61 | "public", 62 | "salsa20", 63 | "signatures" 64 | ], 65 | "license": "Unlicense", 66 | "main": "nacl-fast.js", 67 | "name": "tweetnacl", 68 | "repository": { 69 | "type": "git", 70 | "url": "git+https://github.com/dchest/tweetnacl-js.git" 71 | }, 72 | "scripts": { 73 | "bench": "node test/benchmark/bench.js", 74 | "build": "uglifyjs nacl.js -c -m -o nacl.min.js && uglifyjs nacl-fast.js -c -m -o nacl-fast.min.js", 75 | "build-test-browser": "browserify test/browser/init.js test/*.js | uglifyjs -c -m -o test/browser/_bundle.js 2>/dev/null && browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null", 76 | "lint": "eslint nacl.js nacl-fast.js test/*.js test/benchmark/*.js", 77 | "test": "npm run test-node-all", 78 | "test-node": "tape test/*.js | faucet", 79 | "test-node-all": "make -C test/c && tape test/*.js test/c/*.js | faucet" 80 | }, 81 | "types": "nacl.d.ts", 82 | "version": "1.0.3" 83 | } 84 | -------------------------------------------------------------------------------- /node_modules/ws/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011 Einar Otto Stangvik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/ws/browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function () { 4 | throw new Error( 5 | 'ws does not work in the browser. Browser clients must use the native ' + 6 | 'WebSocket object' 7 | ); 8 | }; 9 | -------------------------------------------------------------------------------- /node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const WebSocket = require('./lib/websocket'); 4 | 5 | WebSocket.createWebSocketStream = require('./lib/stream'); 6 | WebSocket.Server = require('./lib/websocket-server'); 7 | WebSocket.Receiver = require('./lib/receiver'); 8 | WebSocket.Sender = require('./lib/sender'); 9 | 10 | module.exports = WebSocket; 11 | -------------------------------------------------------------------------------- /node_modules/ws/lib/constants.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], 5 | GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', 6 | kStatusCode: Symbol('status-code'), 7 | kWebSocket: Symbol('websocket'), 8 | EMPTY_BUFFER: Buffer.alloc(0), 9 | NOOP: () => {} 10 | }; 11 | -------------------------------------------------------------------------------- /node_modules/ws/lib/limiter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const kDone = Symbol('kDone'); 4 | const kRun = Symbol('kRun'); 5 | 6 | /** 7 | * A very simple job queue with adjustable concurrency. Adapted from 8 | * https://github.com/STRML/async-limiter 9 | */ 10 | class Limiter { 11 | /** 12 | * Creates a new `Limiter`. 13 | * 14 | * @param {Number} concurrency The maximum number of jobs allowed to run 15 | * concurrently 16 | */ 17 | constructor(concurrency) { 18 | this[kDone] = () => { 19 | this.pending--; 20 | this[kRun](); 21 | }; 22 | this.concurrency = concurrency || Infinity; 23 | this.jobs = []; 24 | this.pending = 0; 25 | } 26 | 27 | /** 28 | * Adds a job to the queue. 29 | * 30 | * @public 31 | */ 32 | add(job) { 33 | this.jobs.push(job); 34 | this[kRun](); 35 | } 36 | 37 | /** 38 | * Removes a job from the queue and runs it if possible. 39 | * 40 | * @private 41 | */ 42 | [kRun]() { 43 | if (this.pending === this.concurrency) return; 44 | 45 | if (this.jobs.length) { 46 | const job = this.jobs.shift(); 47 | 48 | this.pending++; 49 | job(this[kDone]); 50 | } 51 | } 52 | } 53 | 54 | module.exports = Limiter; 55 | -------------------------------------------------------------------------------- /node_modules/ws/lib/validation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | try { 4 | const isValidUTF8 = require('utf-8-validate'); 5 | 6 | exports.isValidUTF8 = 7 | typeof isValidUTF8 === 'object' 8 | ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0 9 | : isValidUTF8; 10 | } catch (e) /* istanbul ignore next */ { 11 | exports.isValidUTF8 = () => true; 12 | } 13 | 14 | /** 15 | * Checks if a status code is allowed in a close frame. 16 | * 17 | * @param {Number} code The status code 18 | * @return {Boolean} `true` if the status code is valid, else `false` 19 | * @public 20 | */ 21 | exports.isValidStatusCode = (code) => { 22 | return ( 23 | (code >= 1000 && 24 | code <= 1014 && 25 | code !== 1004 && 26 | code !== 1005 && 27 | code !== 1006) || 28 | (code >= 3000 && code <= 4999) 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /node_modules/ws/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "ws@^7.2.1", 3 | "_id": "ws@7.3.1", 4 | "_inBundle": false, 5 | "_integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==", 6 | "_location": "/ws", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "ws@^7.2.1", 12 | "name": "ws", 13 | "escapedName": "ws", 14 | "rawSpec": "^7.2.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^7.2.1" 17 | }, 18 | "_requiredBy": [ 19 | "/discord.js" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", 22 | "_shasum": "d0547bf67f7ce4f12a72dfe31262c68d7dc551c8", 23 | "_spec": "ws@^7.2.1", 24 | "_where": "C:\\Users\\phone\\OneDrive\\Desktop\\Bot\\node_modules\\discord.js", 25 | "author": { 26 | "name": "Einar Otto Stangvik", 27 | "email": "einaros@gmail.com", 28 | "url": "http://2x.io" 29 | }, 30 | "browser": "browser.js", 31 | "bugs": { 32 | "url": "https://github.com/websockets/ws/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "deprecated": false, 36 | "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", 37 | "devDependencies": { 38 | "benchmark": "^2.1.4", 39 | "bufferutil": "^4.0.1", 40 | "coveralls": "^3.0.3", 41 | "eslint": "^7.2.0", 42 | "eslint-config-prettier": "^6.0.0", 43 | "eslint-plugin-prettier": "^3.0.1", 44 | "mocha": "^7.0.0", 45 | "nyc": "^15.0.0", 46 | "prettier": "^2.0.5", 47 | "utf-8-validate": "^5.0.2" 48 | }, 49 | "engines": { 50 | "node": ">=8.3.0" 51 | }, 52 | "files": [ 53 | "browser.js", 54 | "index.js", 55 | "lib/*.js" 56 | ], 57 | "homepage": "https://github.com/websockets/ws", 58 | "keywords": [ 59 | "HyBi", 60 | "Push", 61 | "RFC-6455", 62 | "WebSocket", 63 | "WebSockets", 64 | "real-time" 65 | ], 66 | "license": "MIT", 67 | "main": "index.js", 68 | "name": "ws", 69 | "peerDependencies": { 70 | "bufferutil": "^4.0.1", 71 | "utf-8-validate": "^5.0.2" 72 | }, 73 | "peerDependenciesMeta": { 74 | "bufferutil": { 75 | "optional": true 76 | }, 77 | "utf-8-validate": { 78 | "optional": true 79 | } 80 | }, 81 | "repository": { 82 | "type": "git", 83 | "url": "git+https://github.com/websockets/ws.git" 84 | }, 85 | "scripts": { 86 | "integration": "mocha --throw-deprecation test/*.integration.js", 87 | "lint": "eslint --ignore-path .gitignore . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"", 88 | "test": "nyc --reporter=html --reporter=text mocha --throw-deprecation test/*.test.js" 89 | }, 90 | "version": "7.3.1" 91 | } 92 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bot", 3 | "version": "1.0.0", 4 | "description": "Your cool description", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Your Name", 10 | "license": "ISC", 11 | "dependencies": { 12 | "discord.js": "^12.2.0" 13 | } 14 | } 15 | --------------------------------------------------------------------------------