@zygout/eris 0.0.0-stage → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +80 -3
  3. package/esm.mjs +72 -0
  4. package/index.d.ts +4397 -0
  5. package/index.js +75 -0
  6. package/lib/Client.js +4683 -0
  7. package/lib/Constants.d.ts +988 -0
  8. package/lib/Constants.js +1161 -0
  9. package/lib/command/Command.js +552 -0
  10. package/lib/command/CommandClient.js +460 -0
  11. package/lib/errors/DiscordHTTPError.js +63 -0
  12. package/lib/errors/DiscordRESTError.js +77 -0
  13. package/lib/gateway/Shard.js +3029 -0
  14. package/lib/gateway/ShardManager.js +164 -0
  15. package/lib/rest/Endpoints.js +172 -0
  16. package/lib/rest/RequestHandler.js +459 -0
  17. package/lib/structures/ApplicationCommand.js +125 -0
  18. package/lib/structures/AutoModerationRule.js +143 -0
  19. package/lib/structures/AutocompleteInteraction.js +80 -0
  20. package/lib/structures/Base.js +81 -0
  21. package/lib/structures/CategoryChannel.js +77 -0
  22. package/lib/structures/Channel.js +98 -0
  23. package/lib/structures/CommandInteraction.js +473 -0
  24. package/lib/structures/ComponentInteraction.js +538 -0
  25. package/lib/structures/DMChannel.js +278 -0
  26. package/lib/structures/Entitlement.js +77 -0
  27. package/lib/structures/ExtendedUser.js +46 -0
  28. package/lib/structures/ForumChannel.js +24 -0
  29. package/lib/structures/GroupChannel.js +106 -0
  30. package/lib/structures/Guild.js +1677 -0
  31. package/lib/structures/GuildAuditLogEntry.js +190 -0
  32. package/lib/structures/GuildChannel.js +128 -0
  33. package/lib/structures/GuildIntegration.js +99 -0
  34. package/lib/structures/GuildPreview.js +97 -0
  35. package/lib/structures/GuildScheduledEvent.js +176 -0
  36. package/lib/structures/GuildTemplate.js +76 -0
  37. package/lib/structures/GuildTextableChannel.js +260 -0
  38. package/lib/structures/Interaction.js +133 -0
  39. package/lib/structures/Invite.js +143 -0
  40. package/lib/structures/Lobby.js +108 -0
  41. package/lib/structures/LobbyMember.js +59 -0
  42. package/lib/structures/MediaChannel.js +216 -0
  43. package/lib/structures/Member.js +371 -0
  44. package/lib/structures/Message.js +708 -0
  45. package/lib/structures/ModalSubmitInteraction.js +478 -0
  46. package/lib/structures/NewsChannel.js +34 -0
  47. package/lib/structures/NewsThreadChannel.js +12 -0
  48. package/lib/structures/Permission.js +80 -0
  49. package/lib/structures/PermissionOverwrite.js +32 -0
  50. package/lib/structures/PingInteraction.js +39 -0
  51. package/lib/structures/PrivateThreadChannel.js +25 -0
  52. package/lib/structures/PublicThreadChannel.js +26 -0
  53. package/lib/structures/Role.js +163 -0
  54. package/lib/structures/SKU.js +80 -0
  55. package/lib/structures/SoundboardSound.js +79 -0
  56. package/lib/structures/StageChannel.js +59 -0
  57. package/lib/structures/StageInstance.js +55 -0
  58. package/lib/structures/Subscription.js +69 -0
  59. package/lib/structures/TextChannel.js +202 -0
  60. package/lib/structures/ThreadChannel.js +143 -0
  61. package/lib/structures/ThreadMember.js +59 -0
  62. package/lib/structures/UnavailableGuild.js +26 -0
  63. package/lib/structures/UnknownInteraction.js +502 -0
  64. package/lib/structures/User.js +296 -0
  65. package/lib/structures/VoiceChannel.js +166 -0
  66. package/lib/structures/VoiceState.js +84 -0
  67. package/lib/util/BrowserWebSocket.js +76 -0
  68. package/lib/util/Bucket.js +89 -0
  69. package/lib/util/Collection.js +202 -0
  70. package/lib/util/MultipartData.js +70 -0
  71. package/lib/util/Opus.js +33 -0
  72. package/lib/util/SequentialBucket.js +83 -0
  73. package/lib/util/emitDeprecation.js +26 -0
  74. package/lib/voice/Piper.js +300 -0
  75. package/lib/voice/SharedStream.js +238 -0
  76. package/lib/voice/VoiceConnection.js +1440 -0
  77. package/lib/voice/VoiceConnectionManager.js +151 -0
  78. package/lib/voice/VoiceDataStream.js +22 -0
  79. package/lib/voice/streams/BaseTransformer.js +40 -0
  80. package/lib/voice/streams/DCAOpusTransformer.js +78 -0
  81. package/lib/voice/streams/FFmpegDuplex.js +192 -0
  82. package/lib/voice/streams/FFmpegOggTransformer.js +35 -0
  83. package/lib/voice/streams/FFmpegPCMTransformer.js +26 -0
  84. package/lib/voice/streams/OggOpusTransformer.js +108 -0
  85. package/lib/voice/streams/PCMOpusTransformer.js +61 -0
  86. package/lib/voice/streams/VolumeTransformer.js +50 -0
  87. package/lib/voice/streams/WebmOpusTransformer.js +258 -0
  88. package/package.json +82 -6
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-2021 abalabahaha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,80 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ Eris [![NPM version](https://img.shields.io/npm/v/@zygout/eris.svg?style=flat-square&color=informational)](https://npmjs.com/package/@zygout/eris)
2
+ ====
3
+
4
+ A Node.js wrapper for interfacing with Discord.
5
+
6
+ This is a maintained fork of [Eris](https://github.com/abalabahaha/eris), which has had no release since 0.18.0 in September 2024. It keeps the Eris API and follows the current Discord API: voice with end-to-end encryption (DAVE), Components V2, modals with labels, polls, soundboard, monetization, lobbies and more.
7
+
8
+ Installing
9
+ ----------
10
+
11
+ You will need Node.js 10.4+. Refer to [the Getting Started section of the Eris docs](https://abal.moe/Eris/docs) for more details.
12
+
13
+ ```
14
+ npm install eris@npm:@zygout/eris
15
+ ```
16
+
17
+ This installs the package under the name `eris`, so `require("eris")`, the examples and code written for Eris work as is. To use its own name instead, run `npm install @zygout/eris` and `require("@zygout/eris")`.
18
+
19
+ This also installs the optional packages used for voice. If you don't need voice support, leave them out with `--omit=optional` (`--no-optional` on npm 6 and older).
20
+
21
+ Voice support relies on:
22
+
23
+ - `@snazzah/davey`, for end-to-end encryption (the DAVE protocol). Discord requires it for voice calls: without it, Discord refuses the connection with close code `4017`.
24
+ - `@stablelib/xchacha20poly1305`, for transport encryption when AES-256-GCM is not available in your Node.js build. `sodium-native` works too.
25
+ - `opusscript`, to encode audio to Opus. `@discordjs/opus` is faster and is used instead when it is installed.
26
+ - [FFmpeg](https://ffmpeg.org) on your `PATH`, to play files that are not already Opus in an Ogg, WebM or DCA container.
27
+
28
+ Ping Pong Example
29
+ -----------------
30
+
31
+ ```js
32
+ const Eris = require("eris");
33
+
34
+ // Replace TOKEN with your bot account's token
35
+ const bot = new Eris("Bot TOKEN", {
36
+ intents: [
37
+ "guilds",
38
+ "guildMessages",
39
+ "directMessages",
40
+ "messageContent" // Privileged: enable "Message Content Intent" on your application's Bot page first
41
+ ]
42
+ });
43
+
44
+ bot.on("ready", () => { // When the bot is ready
45
+ console.log("Ready!"); // Log "Ready!"
46
+ });
47
+
48
+ bot.on("error", (err) => {
49
+ console.error(err); // or your preferred logger
50
+ });
51
+
52
+ bot.on("messageCreate", (msg) => { // When a message is created
53
+ if(msg.content === "!ping") { // If the message content is "!ping"
54
+ bot.createMessage(msg.channel.id, "Pong!");
55
+ // Send a message in the same channel with "Pong!"
56
+ } else if(msg.content === "!pong") { // Otherwise, if the message is "!pong"
57
+ bot.createMessage(msg.channel.id, "Ping!");
58
+ // Respond with "Ping!"
59
+ }
60
+ });
61
+
62
+ bot.connect(); // Get the bot to connect to Discord
63
+ ```
64
+
65
+ Without the `messageContent` intent, `msg.content` is empty, except in DMs and in messages that mention your bot. Slash commands don't need it: see [applicationCommands.js](examples/applicationCommands.js).
66
+
67
+ More examples can be found in [the examples folder](examples), including messages made of Components V2 and modals in [componentsV2.js](examples/componentsV2.js).
68
+
69
+ Useful Links
70
+ ------------
71
+
72
+ - [The Eris website](https://abal.moe/Eris/) documents Eris 0.18. What this fork adds is documented in the JSDoc comments of `lib/` and in `index.d.ts`.
73
+ - [The GitHub repo](https://github.com/ZyGout/eris) is where this fork is developed. Report bugs and ask questions in its issues.
74
+ - [The npm package webpage](https://npmjs.com/package/@zygout/eris) is the webpage for the npm package.
75
+ - [The original Eris repo](https://github.com/abalabahaha/eris) is where Eris was developed up to 0.18.0.
76
+
77
+ License
78
+ -------
79
+
80
+ Refer to the [LICENSE](LICENSE) file.
package/esm.mjs ADDED
@@ -0,0 +1,72 @@
1
+ import Eris from "./index.js";
2
+
3
+ export default function (token, options) {
4
+ return new Eris.Client(token, options);
5
+ }
6
+
7
+ export const {
8
+ AutoModerationRule,
9
+ ApplicationCommand,
10
+ AutocompleteInteraction,
11
+ Base,
12
+ Bucket,
13
+ CategoryChannel,
14
+ Channel,
15
+ Client,
16
+ Collection,
17
+ Command,
18
+ CommandClient,
19
+ CommandInteraction,
20
+ ComponentInteraction,
21
+ Constants,
22
+ DiscordHTTPError,
23
+ DiscordRESTError,
24
+ DMChannel,
25
+ Entitlement,
26
+ ExtendedUser,
27
+ ForumChannel,
28
+ GroupChannel,
29
+ Guild,
30
+ GuildChannel,
31
+ GuildIntegration,
32
+ GuildPreview,
33
+ GuildScheduledEvent,
34
+ GuildTemplate,
35
+ Interaction,
36
+ Invite,
37
+ Lobby,
38
+ LobbyMember,
39
+ MediaChannel,
40
+ Member,
41
+ Message,
42
+ ModalSubmitInteraction,
43
+ NewsChannel,
44
+ NewsThreadChannel,
45
+ Permission,
46
+ PermissionOverwrite,
47
+ PingInteraction,
48
+ PrivateChannel,
49
+ PrivateThreadChannel,
50
+ PublicThreadChannel,
51
+ RequestHandler,
52
+ Role,
53
+ SequentialBucket,
54
+ Shard,
55
+ SharedStream,
56
+ SKU,
57
+ SoundboardSound,
58
+ StageChannel,
59
+ StageInstance,
60
+ Subscription,
61
+ TextChannel,
62
+ ThreadChannel,
63
+ ThreadMember,
64
+ UnavailableGuild,
65
+ UnknownInteraction,
66
+ User,
67
+ VERSION,
68
+ VoiceChannel,
69
+ VoiceConnection,
70
+ VoiceConnectionManager,
71
+ VoiceState,
72
+ } = Eris;