@zygout/eris 0.19.0 → 0.19.2

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 -20
  2. package/README.md +71 -80
  3. package/esm.mjs +72 -72
  4. package/index.d.ts +4407 -4397
  5. package/index.js +75 -75
  6. package/lib/Client.js +4708 -4683
  7. package/lib/Constants.d.ts +990 -988
  8. package/lib/Constants.js +1163 -1161
  9. package/lib/command/Command.js +552 -552
  10. package/lib/command/CommandClient.js +460 -460
  11. package/lib/errors/DiscordHTTPError.js +63 -63
  12. package/lib/errors/DiscordRESTError.js +77 -77
  13. package/lib/gateway/Shard.js +3029 -3029
  14. package/lib/gateway/ShardManager.js +164 -164
  15. package/lib/rest/Endpoints.js +172 -172
  16. package/lib/rest/RequestHandler.js +459 -459
  17. package/lib/structures/ApplicationCommand.js +125 -125
  18. package/lib/structures/AutoModerationRule.js +143 -143
  19. package/lib/structures/AutocompleteInteraction.js +80 -80
  20. package/lib/structures/Base.js +81 -81
  21. package/lib/structures/CategoryChannel.js +77 -77
  22. package/lib/structures/Channel.js +98 -98
  23. package/lib/structures/CommandInteraction.js +473 -473
  24. package/lib/structures/ComponentInteraction.js +538 -538
  25. package/lib/structures/DMChannel.js +278 -278
  26. package/lib/structures/Entitlement.js +77 -77
  27. package/lib/structures/ExtendedUser.js +46 -46
  28. package/lib/structures/ForumChannel.js +24 -24
  29. package/lib/structures/GroupChannel.js +106 -106
  30. package/lib/structures/Guild.js +1677 -1677
  31. package/lib/structures/GuildAuditLogEntry.js +190 -190
  32. package/lib/structures/GuildChannel.js +128 -128
  33. package/lib/structures/GuildIntegration.js +99 -99
  34. package/lib/structures/GuildPreview.js +97 -97
  35. package/lib/structures/GuildScheduledEvent.js +176 -176
  36. package/lib/structures/GuildTemplate.js +76 -76
  37. package/lib/structures/GuildTextableChannel.js +260 -260
  38. package/lib/structures/Interaction.js +133 -133
  39. package/lib/structures/Invite.js +143 -143
  40. package/lib/structures/Lobby.js +108 -108
  41. package/lib/structures/LobbyMember.js +59 -59
  42. package/lib/structures/MediaChannel.js +216 -216
  43. package/lib/structures/Member.js +371 -371
  44. package/lib/structures/Message.js +708 -708
  45. package/lib/structures/ModalSubmitInteraction.js +478 -478
  46. package/lib/structures/NewsChannel.js +34 -34
  47. package/lib/structures/NewsThreadChannel.js +12 -12
  48. package/lib/structures/Permission.js +80 -80
  49. package/lib/structures/PermissionOverwrite.js +32 -32
  50. package/lib/structures/PingInteraction.js +39 -39
  51. package/lib/structures/PrivateThreadChannel.js +25 -25
  52. package/lib/structures/PublicThreadChannel.js +26 -26
  53. package/lib/structures/Role.js +163 -163
  54. package/lib/structures/SKU.js +80 -80
  55. package/lib/structures/SoundboardSound.js +79 -79
  56. package/lib/structures/StageChannel.js +59 -59
  57. package/lib/structures/StageInstance.js +55 -55
  58. package/lib/structures/Subscription.js +69 -69
  59. package/lib/structures/TextChannel.js +202 -202
  60. package/lib/structures/ThreadChannel.js +143 -143
  61. package/lib/structures/ThreadMember.js +59 -59
  62. package/lib/structures/UnavailableGuild.js +26 -26
  63. package/lib/structures/UnknownInteraction.js +502 -502
  64. package/lib/structures/User.js +296 -296
  65. package/lib/structures/VoiceChannel.js +166 -166
  66. package/lib/structures/VoiceState.js +84 -84
  67. package/lib/util/BrowserWebSocket.js +76 -76
  68. package/lib/util/Bucket.js +89 -89
  69. package/lib/util/Collection.js +202 -202
  70. package/lib/util/MultipartData.js +70 -70
  71. package/lib/util/Opus.js +33 -33
  72. package/lib/util/SequentialBucket.js +83 -83
  73. package/lib/util/emitDeprecation.js +26 -26
  74. package/lib/voice/Piper.js +300 -300
  75. package/lib/voice/SharedStream.js +238 -238
  76. package/lib/voice/VoiceConnection.js +1440 -1440
  77. package/lib/voice/VoiceConnectionManager.js +151 -151
  78. package/lib/voice/VoiceDataStream.js +22 -22
  79. package/lib/voice/streams/BaseTransformer.js +40 -40
  80. package/lib/voice/streams/DCAOpusTransformer.js +78 -78
  81. package/lib/voice/streams/FFmpegDuplex.js +192 -192
  82. package/lib/voice/streams/FFmpegOggTransformer.js +35 -35
  83. package/lib/voice/streams/FFmpegPCMTransformer.js +26 -26
  84. package/lib/voice/streams/OggOpusTransformer.js +108 -108
  85. package/lib/voice/streams/PCMOpusTransformer.js +61 -61
  86. package/lib/voice/streams/VolumeTransformer.js +50 -50
  87. package/lib/voice/streams/WebmOpusTransformer.js +258 -258
  88. package/package.json +83 -82
@@ -1,98 +1,98 @@
1
- "use strict";
2
-
3
- const Base = require("./Base");
4
- const { ChannelTypes } = require("../Constants");
5
-
6
- /**
7
- * Represents a channel. You also probably want to look at CategoryChannel, GroupChannel, NewsChannel, DMChannel, TextChannel, and VoiceChannel.
8
- * @prop {Number} createdAt Timestamp of the channel's creation
9
- * @prop {String} id The ID of the channel
10
- * @prop {String} mention A string that mentions the channel
11
- * @prop {Number} type The type of the channel
12
- */
13
- class Channel extends Base {
14
- constructor(data, client) {
15
- super(data.id);
16
- this.type = data.type;
17
- this._client = client;
18
- }
19
-
20
- get mention() {
21
- return `<#${this.id}>`;
22
- }
23
-
24
- static from(data, client) {
25
- switch (data.type) {
26
- case ChannelTypes.GUILD_TEXT: {
27
- return new TextChannel(data, client);
28
- }
29
- case ChannelTypes.DM: {
30
- return new DMChannel(data, client);
31
- }
32
- case ChannelTypes.GUILD_VOICE: {
33
- return new VoiceChannel(data, client);
34
- }
35
- case ChannelTypes.GROUP_DM: {
36
- return new GroupChannel(data, client);
37
- }
38
- case ChannelTypes.GUILD_CATEGORY: {
39
- return new CategoryChannel(data, client);
40
- }
41
- case ChannelTypes.GUILD_NEWS: {
42
- return new NewsChannel(data, client);
43
- }
44
- case ChannelTypes.GUILD_NEWS_THREAD: {
45
- return new NewsThreadChannel(data, client);
46
- }
47
- case ChannelTypes.GUILD_PUBLIC_THREAD: {
48
- return new PublicThreadChannel(data, client);
49
- }
50
- case ChannelTypes.GUILD_PRIVATE_THREAD: {
51
- return new PrivateThreadChannel(data, client);
52
- }
53
- case ChannelTypes.GUILD_STAGE_VOICE: {
54
- return new StageChannel(data, client);
55
- }
56
- case ChannelTypes.GUILD_FORUM: {
57
- return new ForumChannel(data, client);
58
- }
59
- case ChannelTypes.GUILD_MEDIA: {
60
- return new MediaChannel(data, client);
61
- }
62
- }
63
- if (data.guild_id) {
64
- if (data.last_message_id !== undefined) {
65
- client.emit("warn", new Error(`Unknown guild text channel type: ${data.type}\n${JSON.stringify(data)}`));
66
- return new TextChannel(data, client);
67
- }
68
- client.emit("warn", new Error(`Unknown guild channel type: ${data.type}\n${JSON.stringify(data)}`));
69
- return new GuildChannel(data, client);
70
- }
71
- client.emit("warn", new Error(`Unknown channel type: ${data.type}\n${JSON.stringify(data)}`));
72
- return new Channel(data, client);
73
- }
74
-
75
- toJSON(props = []) {
76
- return super.toJSON([
77
- "type",
78
- ...props,
79
- ]);
80
- }
81
- }
82
-
83
- module.exports = Channel;
84
-
85
- // Circular import
86
- const CategoryChannel = require("./CategoryChannel");
87
- const DMChannel = require("./DMChannel");
88
- const GuildChannel = require("./GuildChannel");
89
- const ForumChannel = require("./ForumChannel");
90
- const GroupChannel = require("./GroupChannel");
91
- const MediaChannel = require("./MediaChannel");
92
- const NewsChannel = require("./NewsChannel");
93
- const NewsThreadChannel = require("./NewsThreadChannel");
94
- const PrivateThreadChannel = require("./PrivateThreadChannel");
95
- const PublicThreadChannel = require("./PublicThreadChannel");
96
- const StageChannel = require("./StageChannel");
97
- const TextChannel = require("./TextChannel");
98
- const VoiceChannel = require("./VoiceChannel");
1
+ "use strict";
2
+
3
+ const Base = require("./Base");
4
+ const { ChannelTypes } = require("../Constants");
5
+
6
+ /**
7
+ * Represents a channel. You also probably want to look at CategoryChannel, GroupChannel, NewsChannel, DMChannel, TextChannel, and VoiceChannel.
8
+ * @prop {Number} createdAt Timestamp of the channel's creation
9
+ * @prop {String} id The ID of the channel
10
+ * @prop {String} mention A string that mentions the channel
11
+ * @prop {Number} type The type of the channel
12
+ */
13
+ class Channel extends Base {
14
+ constructor(data, client) {
15
+ super(data.id);
16
+ this.type = data.type;
17
+ this._client = client;
18
+ }
19
+
20
+ get mention() {
21
+ return `<#${this.id}>`;
22
+ }
23
+
24
+ static from(data, client) {
25
+ switch (data.type) {
26
+ case ChannelTypes.GUILD_TEXT: {
27
+ return new TextChannel(data, client);
28
+ }
29
+ case ChannelTypes.DM: {
30
+ return new DMChannel(data, client);
31
+ }
32
+ case ChannelTypes.GUILD_VOICE: {
33
+ return new VoiceChannel(data, client);
34
+ }
35
+ case ChannelTypes.GROUP_DM: {
36
+ return new GroupChannel(data, client);
37
+ }
38
+ case ChannelTypes.GUILD_CATEGORY: {
39
+ return new CategoryChannel(data, client);
40
+ }
41
+ case ChannelTypes.GUILD_NEWS: {
42
+ return new NewsChannel(data, client);
43
+ }
44
+ case ChannelTypes.GUILD_NEWS_THREAD: {
45
+ return new NewsThreadChannel(data, client);
46
+ }
47
+ case ChannelTypes.GUILD_PUBLIC_THREAD: {
48
+ return new PublicThreadChannel(data, client);
49
+ }
50
+ case ChannelTypes.GUILD_PRIVATE_THREAD: {
51
+ return new PrivateThreadChannel(data, client);
52
+ }
53
+ case ChannelTypes.GUILD_STAGE_VOICE: {
54
+ return new StageChannel(data, client);
55
+ }
56
+ case ChannelTypes.GUILD_FORUM: {
57
+ return new ForumChannel(data, client);
58
+ }
59
+ case ChannelTypes.GUILD_MEDIA: {
60
+ return new MediaChannel(data, client);
61
+ }
62
+ }
63
+ if (data.guild_id) {
64
+ if (data.last_message_id !== undefined) {
65
+ client.emit("warn", new Error(`Unknown guild text channel type: ${data.type}\n${JSON.stringify(data)}`));
66
+ return new TextChannel(data, client);
67
+ }
68
+ client.emit("warn", new Error(`Unknown guild channel type: ${data.type}\n${JSON.stringify(data)}`));
69
+ return new GuildChannel(data, client);
70
+ }
71
+ client.emit("warn", new Error(`Unknown channel type: ${data.type}\n${JSON.stringify(data)}`));
72
+ return new Channel(data, client);
73
+ }
74
+
75
+ toJSON(props = []) {
76
+ return super.toJSON([
77
+ "type",
78
+ ...props,
79
+ ]);
80
+ }
81
+ }
82
+
83
+ module.exports = Channel;
84
+
85
+ // Circular import
86
+ const CategoryChannel = require("./CategoryChannel");
87
+ const DMChannel = require("./DMChannel");
88
+ const GuildChannel = require("./GuildChannel");
89
+ const ForumChannel = require("./ForumChannel");
90
+ const GroupChannel = require("./GroupChannel");
91
+ const MediaChannel = require("./MediaChannel");
92
+ const NewsChannel = require("./NewsChannel");
93
+ const NewsThreadChannel = require("./NewsThreadChannel");
94
+ const PrivateThreadChannel = require("./PrivateThreadChannel");
95
+ const PublicThreadChannel = require("./PublicThreadChannel");
96
+ const StageChannel = require("./StageChannel");
97
+ const TextChannel = require("./TextChannel");
98
+ const VoiceChannel = require("./VoiceChannel");