oceanic.js 1.0.2 → 1.0.3-dev.0457ffd

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 (56) hide show
  1. package/README.md +3 -3
  2. package/dist/lib/Constants.d.ts +16 -5
  3. package/dist/lib/Constants.js +25 -10
  4. package/dist/lib/gateway/Shard.d.ts +1 -1
  5. package/dist/lib/gateway/Shard.js +10 -9
  6. package/dist/lib/routes/ApplicationCommands.js +2 -1
  7. package/dist/lib/routes/Channels.js +74 -58
  8. package/dist/lib/routes/Guilds.d.ts +3 -3
  9. package/dist/lib/routes/Guilds.js +36 -15
  10. package/dist/lib/routes/OAuth.js +2 -1
  11. package/dist/lib/routes/Webhooks.js +4 -4
  12. package/dist/lib/structures/ApplicationCommand.d.ts +1 -1
  13. package/dist/lib/structures/ApplicationCommand.js +2 -2
  14. package/dist/lib/structures/AuditLogEntry.js +3 -1
  15. package/dist/lib/structures/CommandInteraction.js +1 -1
  16. package/dist/lib/structures/ForumChannel.d.ts +3 -0
  17. package/dist/lib/structures/ForumChannel.js +6 -1
  18. package/dist/lib/structures/GroupChannel.d.ts +2 -2
  19. package/dist/lib/structures/GroupChannel.js +2 -2
  20. package/dist/lib/structures/Guild.d.ts +18 -4
  21. package/dist/lib/structures/Guild.js +29 -5
  22. package/dist/lib/structures/GuildPreview.d.ts +19 -1
  23. package/dist/lib/structures/GuildPreview.js +49 -1
  24. package/dist/lib/structures/Integration.d.ts +2 -0
  25. package/dist/lib/structures/Integration.js +7 -1
  26. package/dist/lib/structures/Member.d.ts +5 -3
  27. package/dist/lib/structures/Member.js +2 -2
  28. package/dist/lib/structures/Message.d.ts +2 -4
  29. package/dist/lib/structures/Message.js +1 -1
  30. package/dist/lib/structures/PrivateChannel.d.ts +2 -2
  31. package/dist/lib/structures/PrivateChannel.js +2 -2
  32. package/dist/lib/structures/TextableChannel.d.ts +2 -2
  33. package/dist/lib/structures/TextableChannel.js +2 -2
  34. package/dist/lib/structures/ThreadChannel.d.ts +2 -2
  35. package/dist/lib/structures/ThreadChannel.js +2 -2
  36. package/dist/lib/structures/VoiceChannel.d.ts +2 -2
  37. package/dist/lib/structures/VoiceChannel.js +2 -2
  38. package/dist/lib/types/application-commands.d.ts +2 -0
  39. package/dist/lib/types/audit-log.d.ts +10 -0
  40. package/dist/lib/types/channels.d.ts +19 -12
  41. package/dist/lib/types/gateway-raw.d.ts +1 -1
  42. package/dist/lib/types/guilds.d.ts +34 -22
  43. package/dist/lib/types/interactions.d.ts +2 -0
  44. package/dist/lib/types/json.d.ts +2 -0
  45. package/dist/lib/types/oauth.d.ts +2 -0
  46. package/dist/lib/util/InteractionOptionsWrapper.d.ts +3 -3
  47. package/dist/lib/util/InteractionOptionsWrapper.js +1 -1
  48. package/dist/lib/util/Util.d.ts +2 -2
  49. package/dist/lib/util/Util.js +1 -1
  50. package/dist/package.json +1 -1
  51. package/examples/applicationCommand.js +9 -9
  52. package/examples/components.js +8 -8
  53. package/examples/embeds.js +9 -9
  54. package/examples/intents.js +4 -4
  55. package/examples/interactions.js +8 -8
  56. package/package.json +1 -1
@@ -13,18 +13,18 @@ client.on("ready", () => console.log("Ready as", client.user.tag));
13
13
  client.on("messageCreate", async (msg) => {
14
14
  if(msg.content.includes("!embed")) {
15
15
  await client.rest.channels.createMessage(msg.channel.id, {
16
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedOptions.html
16
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedOptions.html
17
17
  // Up to 10 in one message
18
18
  embeds: [
19
19
  {
20
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedAuthorOptions.html
20
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedAuthorOptions.html
21
21
  author: {
22
22
  name: "Author Name",
23
23
  // An image url, or attachment://filename.ext
24
24
  iconURL: "https://i.furry.cool/DonPride.png", // Optional
25
- url: "https://oceanic.owo-whats-this.dev" // Optional
25
+ url: "https://docs.oceanic.ws" // Optional
26
26
  },
27
- // Array of https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedField.html
27
+ // Array of https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedField.html
28
28
  // Up to 25 in one message
29
29
  fields: [
30
30
  {
@@ -38,28 +38,28 @@ client.on("messageCreate", async (msg) => {
38
38
  inline: false
39
39
  }
40
40
  ],
41
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedFooterOptions.html
41
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedFooterOptions.html
42
42
  footer: {
43
43
  text: "Footer Text",
44
44
  // An image url, or attachment://filename.ext
45
45
  iconURL: "https://i.furry.cool/DonPride.png" // Optional
46
46
  },
47
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedImageOptions.html
47
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedImageOptions.html
48
48
  image: {
49
49
  // An image url, or attachment://filename.ext
50
50
  url: "https://i.furry.cool/DonPride.png"
51
51
  },
52
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedThumbnailOptions.html
52
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedThumbnailOptions.html
53
53
  thumbnail: {
54
54
  // An image url, or attachment://filename.ext
55
55
  url: "https://i.furry.cool/DonPride.png"
56
56
  },
57
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_channels.EmbedOptions.html
57
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedOptions.html
58
58
  color: 0xFFA500, // Base-10 color (0x prefix can be used for hex codes)
59
59
  description: "My Cool Embed",
60
60
  timestamp: new Date().toISOString(), // The current time - ISO 8601 format
61
61
  title: "My Amazing Embed",
62
- url: "https://oceanic.owo-whats-this.dev"
62
+ url: "https://docs.oceanic.ws"
63
63
  }
64
64
  ]
65
65
  });
@@ -5,7 +5,7 @@ const client = new Client({
5
5
  gateway: {
6
6
  // List of intents: https://discord.com/developers/docs/topics/gateway#list-of-intents
7
7
  // They change what events our client receives to lower the amount of computer power needed to run it
8
- // Most events also list if they require an intent: https://oceanic.owo-whats-this.dev/latest/interfaces/types_events.ClientEvents.html
8
+ // Most events also list if they require an intent: https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html
9
9
  intents: ["GUILDS", "GUILD_MESSAGES", "MESSAGE_CONTENT"]
10
10
  // If you do not have the MESSAGE_CONTENT intent, various fields like `content`, `components`, `embeds` and more will be empty unless the message belongs to or mentions your client
11
11
  }
@@ -19,19 +19,19 @@ client.on("error", (error) => {
19
19
  });
20
20
 
21
21
  // New Guild Joined
22
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_events.ClientEvents.html#guildCreate
22
+ // https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html#guildCreate
23
23
  bot.on("guildCreate", (guild) => {
24
24
  console.log("Guild Joined:", guild.name);
25
25
  });
26
26
 
27
27
  // Message Sent
28
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_events.ClientEvents.html#messageCreate
28
+ // https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html#messageCreate
29
29
  bot.on("messageCreate", (msg) => {
30
30
  console.log(`New message: ${msg.content}`);
31
31
  });
32
32
 
33
33
  // This event will never be seen as neither `GUILD_MESSAGE_TYPING` or `DIRECT_MESSAGE_TYPING` were included in the intents
34
- // https://oceanic.owo-whats-this.dev/latest/interfaces/types_events.ClientEvents.html#typingStart
34
+ // https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html#typingStart
35
35
  bot.on("typingStart", (channel, user) => { // When a user starts typing
36
36
  console.log(`${user.id} is typing in ${channel.id}`); // User or channel are not necessarily complete (Uncached) to retrieve names
37
37
  });
@@ -14,7 +14,7 @@ client.on("ready", async() => {
14
14
 
15
15
  client.on("interactionCreate", async(interaction) => {
16
16
  switch(interaction.type) {
17
- // https://oceanic.owo-whats-this.dev/latest/classes/CommandInteraction.CommandInteraction.html
17
+ // https://docs.oceanic.ws/latest/classes/CommandInteraction.CommandInteraction.html
18
18
  case InteractionTypes.APPLICATION_COMMAND: {
19
19
  // defer interactions as soon as possible, you have three seconds to send any initial response
20
20
  // if you wait too long, the interaction may be invalidated
@@ -22,14 +22,14 @@ client.on("interactionCreate", async(interaction) => {
22
22
  // If you want the response to be ephemeral, you can provide the flag to the defer function, like so:
23
23
  // await interaction.defer(MessageFlags.EPHEMERAL);
24
24
 
25
- // data = https://oceanic.owo-whats-this.dev/latest/interfaces/Types_Interactions.ApplicationCommandInteractionData.html
25
+ // data = https://docs.oceanic.ws/latest/interfaces/Types_Interactions.ApplicationCommandInteractionData.html
26
26
  switch(interaction.data.type) {
27
27
  // Chat Input commands are what you use in the chat, i.e. slash commands
28
28
  case ApplicationCommandTypes.CHAT_INPUT: {
29
29
  if(interaction.data.name === "greet") {
30
30
  // assume we have two options, user (called user) then string (called greeting) - first is required, second is not
31
31
 
32
- // Get an option named `user` with the type USER - https://oceanic.owo-whats-this.dev/dev/classes/InteractionOptionsWrapper.InteractionOptionsWrapper.html#getUser
32
+ // Get an option named `user` with the type USER - https://docs.oceanic.ws/dev/classes/InteractionOptionsWrapper.InteractionOptionsWrapper.html#getUser
33
33
  // Setting the second parameter to true will throw an error if the option is not present
34
34
  const user = interaction.data.options.getUser("user", true);
35
35
  const greeting = interaction.data.options.getString("greeting", false) || "Hello, ";
@@ -45,7 +45,7 @@ client.on("interactionCreate", async(interaction) => {
45
45
  }
46
46
 
47
47
  // Chat Input application command interactions also have a set of resolved data, which is structured as so:
48
- // https://oceanic.owo-whats-this.dev/latest/interfaces/Types_Interactions.ApplicationCommandInteractionResolvedData.html
48
+ // https://docs.oceanic.ws/latest/interfaces/Types_Interactions.ApplicationCommandInteractionResolvedData.html
49
49
  // the options wrapper pulls values out of resolved automatically, if you use the right method
50
50
  break;
51
51
  }
@@ -83,7 +83,7 @@ client.on("interactionCreate", async(interaction) => {
83
83
  break;
84
84
  }
85
85
 
86
- // https://oceanic.owo-whats-this.dev/latest/classes/ComponentInteraction.ComponentInteraction.html
86
+ // https://docs.oceanic.ws/latest/classes/ComponentInteraction.ComponentInteraction.html
87
87
  case InteractionTypes.MESSAGE_COMPONENT: {
88
88
  // same spiel as above
89
89
  await interaction.defer();
@@ -111,7 +111,7 @@ client.on("interactionCreate", async(interaction) => {
111
111
  break;
112
112
  }
113
113
 
114
- // https://oceanic.owo-whats-this.dev/latest/classes/AutocompleteInteraction.AutocompleteInteraction.html
114
+ // https://docs.oceanic.ws/latest/classes/AutocompleteInteraction.AutocompleteInteraction.html
115
115
  case InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE: {
116
116
  // Autocomplete Interactions cannot be deferred
117
117
  switch(interaction.data.name) {
@@ -146,13 +146,13 @@ client.on("interactionCreate", async(interaction) => {
146
146
  break;
147
147
  }
148
148
 
149
- // https://oceanic.owo-whats-this.dev/latest/classes/ModalSubmitInteraction.ModalSubmitInteraction.html
149
+ // https://docs.oceanic.ws/latest/classes/ModalSubmitInteraction.ModalSubmitInteraction.html
150
150
  case InteractionTypes.MODAL_SUBMIT: {
151
151
  // this will correspond with the customID you provided when creating the modal
152
152
  switch(interaction.data.customID) {
153
153
  case "test-modal": {
154
154
  // the `components` property under data contains all of the components that were submitted
155
- // https://oceanic.owo-whats-this.dev/latest/interfaces/Types_Channels.ModalActionRow.html
155
+ // https://docs.oceanic.ws/latest/interfaces/Types_Channels.ModalActionRow.html
156
156
  console.log(interaction.data.components);
157
157
  break;
158
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oceanic.js",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-dev.0457ffd",
4
4
  "description": "A NodeJS library for interfacing with Discord.",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",