Skip to content

Commit

Permalink
Fix doc links in examples
Browse files Browse the repository at this point in the history
Updated to target dev
  • Loading branch information
DonovanDMC committed Feb 2, 2024
1 parent eccb626 commit 9721e1d
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 69 deletions.
16 changes: 8 additions & 8 deletions examples/applicationCommand.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The application command management functions are on ClientApplication (client.application) & client.rest.applicationCommands
// https://docs.oceanic.ws/latest/classes/ClientApplication.ClientApplication.html
// https://docs.oceanic.ws/latest/classes/Routes_ApplicationCommands.ApplicationCommands.html
// The application command management functions are on ClientApplication (client.application) & client.rest.applications
// https://docs.oceanic.ws/latest/classes/ClientApplication.html
// https://docs.oceanic.ws/latest/classes/REST_Applications.html
const { ApplicationCommandOptionTypes, ApplicationCommandTypes, Client } = require("oceanic.js");

const client = new Client({
Expand All @@ -13,7 +13,7 @@ const client = new Client({
client.on("ready", async() => {
console.log("Ready as", client.user.tag);

// https://docs.oceanic.ws/classes/ClientApplication.ClientApplication.html#createGlobalCommand
// https://docs.oceanic.ws/classes/ClientApplication.html#createGlobalCommand
// Create a single command
await client.application.createGlobalCommand({
type: ApplicationCommandTypes.CHAT_INPUT, // CHAT_INPUT = slash commands - full list: https://docs.oceanic.ws/latest/enums/Constants.ApplicationCommandTypes.html
Expand Down Expand Up @@ -52,7 +52,7 @@ client.on("ready", async() => {
defaultMemberPermissions: "8" // The bitfield of the default permissions required to use this command (8 = Administrator)
});

// https://docs.oceanic.ws/latest/classes/ClientApplication.ClientApplication.html#bulkEditGlobalCommands
// https://docs.oceanic.ws/latest/classes/ClientApplication.html#bulkEditGlobalCommands
// Instead of deleting individual commands or creating commands one at a time, you can create them in bulk.
await client.application.bulkEditGlobalCommands([
{
Expand All @@ -73,17 +73,17 @@ client.on("ready", async() => {
}
]);

// https://docs.oceanic.ws/latest/classes/ClientApplication.ClientApplication.html#getGlobalCommands
// https://docs.oceanic.ws/latest/classes/ClientApplication.html#getGlobalCommands
// if you need to fetch your commands
const commands = await client.application.getGlobalCommands();
console.log(commands); // An array of ApplicationCommand classes

for (const command of commands) {
// https://docs.oceanic.ws/latest/classes/ApplicationCommand.ApplicationCommand.html#delete
// https://docs.oceanic.ws/latest/classes/ApplicationCommand.html#delete
await command.delete(); // DON'T DO THIS! This is just an example. Use `bulkEdit` with an empty array if you want to delete all commands
}

// https://docs.oceanic.ws/latest/classes/ClientApplication.ClientApplication.html#createGuildCommand
// https://docs.oceanic.ws/latest/classes/ClientApplication.html#createGuildCommand
// Guilds commands are exactly the same thing, but with a guild ID included
await client.application.createGuildCommand("1005489770278953112", {
type: ApplicationCommandTypes.CHAT_INPUT,
Expand Down
2 changes: 1 addition & 1 deletion examples/embeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ client.on("messageCreate", async (msg) => {
// An image url, or attachment://filename.ext
url: "https://i.furry.cool/DonPride.png"
},
// https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedThumbnailOptions.html
// https://docs.oceanic.ws/latest/interfaces/Types_Channels.EmbedImageOptions.html
thumbnail: {
// An image url, or attachment://filename.ext
url: "https://i.furry.cool/DonPride.png"
Expand Down
8 changes: 4 additions & 4 deletions examples/intents.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const client = new Client({
gateway: {
// List of intents: https://discord.com/developers/docs/topics/gateway#list-of-intents
// They change what events our client receives to lower the amount of computer power needed to run it
// Most events also list if they require an intent: https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html
// Most events also list if they require an intent: https://docs.oceanic.ws/latest/interfaces/ClientEvents.html
intents: ["GUILDS", "GUILD_MESSAGES", "MESSAGE_CONTENT"]
// 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
}
Expand All @@ -19,19 +19,19 @@ client.on("error", (error) => {
});

// New Guild Joined
// https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html#guildCreate
// https://docs.oceanic.ws/latest/interfaces/ClientEvents.html#guildCreate
client.on("guildCreate", (guild) => {
console.log("Guild Joined:", guild.name);
});

// Message Sent
// https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html#messageCreate
// https://docs.oceanic.ws/latest/interfaces/ClientEvents.html#messageCreate
client.on("messageCreate", (msg) => {
console.log(`New message: ${msg.content}`);
});

// This event will never be seen as neither `GUILD_MESSAGE_TYPING` or `DIRECT_MESSAGE_TYPING` were included in the intents
// https://docs.oceanic.ws/latest/interfaces/Events.ClientEvents.html#typingStart
// https://docs.oceanic.ws/latest/interfaces/ClientEvents.html#typingStart
client.on("typingStart", (channel, user) => { // When a user starts typing
console.log(`${user.id} is typing in ${channel.id}`); // User or channel are not necessarily complete (Uncached) to retrieve names
});
Expand Down
10 changes: 5 additions & 5 deletions examples/interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ client.on("ready", async() => {

client.on("interactionCreate", async(interaction) => {
switch(interaction.type) {
// https://docs.oceanic.ws/latest/classes/CommandInteraction.CommandInteraction.html
// https://docs.oceanic.ws/latest/classes/CommandInteraction.html
case InteractionTypes.APPLICATION_COMMAND: {
// defer interactions as soon as possible, you have three seconds to send any initial response
// if you wait too long, the interaction may be invalidated
Expand All @@ -29,7 +29,7 @@ client.on("interactionCreate", async(interaction) => {
if(interaction.data.name === "greet") {
// assume we have two options, user (called user) then string (called greeting) - first is required, second is not

// Get an option named `user` with the type USER - https://docs.oceanic.ws/dev/classes/InteractionOptionsWrapper.InteractionOptionsWrapper.html#getUser
// Get an option named `user` with the type USER - https://docs.oceanic.ws/latest/classes/InteractionOptionsWrapper.html#getUser
// Setting the second parameter to true will throw an error if the option is not present
const user = interaction.data.options.getUser("user", true);
const greeting = interaction.data.options.getString("greeting", false) || "Hello, ";
Expand Down Expand Up @@ -83,7 +83,7 @@ client.on("interactionCreate", async(interaction) => {
break;
}

// https://docs.oceanic.ws/latest/classes/ComponentInteraction.ComponentInteraction.html
// https://docs.oceanic.ws/latest/classes/ComponentInteraction.html
case InteractionTypes.MESSAGE_COMPONENT: {
// same spiel as above
await interaction.defer();
Expand Down Expand Up @@ -111,7 +111,7 @@ client.on("interactionCreate", async(interaction) => {
break;
}

// https://docs.oceanic.ws/latest/classes/AutocompleteInteraction.AutocompleteInteraction.html
// https://docs.oceanic.ws/latest/classes/AutocompleteInteraction.html
case InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE: {
// Autocomplete Interactions cannot be deferred
switch(interaction.data.name) {
Expand Down Expand Up @@ -146,7 +146,7 @@ client.on("interactionCreate", async(interaction) => {
break;
}

// https://docs.oceanic.ws/latest/classes/ModalSubmitInteraction.ModalSubmitInteraction.html
// https://docs.oceanic.ws/latest/classes/ModalSubmitInteraction.html
case InteractionTypes.MODAL_SUBMIT: {
// this will correspond with the customID you provided when creating the modal
switch(interaction.data.customID) {
Expand Down
98 changes: 49 additions & 49 deletions lib/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,55 +449,55 @@ export enum IntegrationExpireBehaviors {
// values won't be statically typed if we use bit shifting, and enums can't use bigints
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace Permissions {
export const CREATE_INSTANT_INVITE = 1n; // 1 << 0
export const KICK_MEMBERS = 2n; // 1 << 1
export const BAN_MEMBERS = 4n; // 1 << 2
export const ADMINISTRATOR = 8n; // 1 << 3
export const MANAGE_CHANNELS = 16n; // 1 << 4
export const MANAGE_GUILD = 32n; // 1 << 5
export const ADD_REACTIONS = 64n; // 1 << 6
export const VIEW_AUDIT_LOG = 128n; // 1 << 7
export const PRIORITY_SPEAKER = 256n; // 1 << 8
export const STREAM = 512n; // 1 << 9
export const VIEW_CHANNEL = 1024n; // 1 << 10
export const SEND_MESSAGES = 2048n; // 1 << 11
export const SEND_TTS_MESSAGES = 4096n; // 1 << 12
export const MANAGE_MESSAGES = 8192n; // 1 << 13
export const EMBED_LINKS = 16384n; // 1 << 14
export const ATTACH_FILES = 32768n; // 1 << 15
export const READ_MESSAGE_HISTORY = 65536n; // 1 << 16
export const MENTION_EVERYONE = 131072n; // 1 << 17
export const USE_EXTERNAL_EMOJIS = 262144n; // 1 << 18
export const VIEW_GUILD_INSIGHTS = 524288n; // 1 << 19
export const CONNECT = 1048576n; // 1 << 20
export const SPEAK = 2097152n; // 1 << 21
export const MUTE_MEMBERS = 4194304n; // 1 << 22
export const DEAFEN_MEMBERS = 8388608n; // 1 << 23
export const MOVE_MEMBERS = 16777216n; // 1 << 24
export const USE_VAD = 33554432n; // 1 << 25
export const CHANGE_NICKNAME = 67108864n; // 1 << 26
export const MANAGE_NICKNAMES = 134217728n; // 1 << 27
export const MANAGE_ROLES = 268435456n; // 1 << 28
export const MANAGE_WEBHOOKS = 536870912n; // 1 << 29
export const MANAGE_GUILD_EXPRESSIONS = 1073741824n; // 1 << 30
export const USE_APPLICATION_COMMANDS = 2147483648n; // 1 << 31
export const REQUEST_TO_SPEAK = 4294967296n; // 1 << 32
export const MANAGE_EVENTS = 8589934592n; // 1 << 33
export const MANAGE_THREADS = 17179869184n; // 1 << 34
export const CREATE_PUBLIC_THREADS = 34359738368n; // 1 << 35
export const CREATE_PRIVATE_THREADS = 68719476736n; // 1 << 36
export const USE_EXTERNAL_STICKERS = 137438953472n; // 1 << 37
export const SEND_MESSAGES_IN_THREADS = 274877906944n; // 1 << 38
export const USE_EMBEDDED_ACTIVITIES = 549755813888n; // 1 << 39
export const MODERATE_MEMBERS = 1099511627776n; // 1 << 40
export const VIEW_CREATOR_MONETIZATION_ANALYTICS = 2199023255552n; // 1 << 41
export const USE_SOUNDBOARD = 4398046511104n; // 1 << 42
export const CREATE_GUILD_EXPRESSIONS = 8796093022208n; // 1 << 43
export const CREATE_EVENTS = 17592186044416n; // 1 << 44
export const USE_EXTERNAL_SOUNDS = 35184372088832n; // 1 << 45
export const SEND_VOICE_MESSAGES = 70368744177664n; // 1 << 46
export const USE_CLYDE_AI = 140737488355328n;// 1 << 47
export const SET_VOICE_CHANNEL_STATUS = 281474976710656n;// 1 << 48
export const CREATE_INSTANT_INVITE = 1n; // 1 << 0
export const KICK_MEMBERS = 2n; // 1 << 1
export const BAN_MEMBERS = 4n; // 1 << 2
export const ADMINISTRATOR = 8n; // 1 << 3
export const MANAGE_CHANNELS = 16n; // 1 << 4
export const MANAGE_GUILD = 32n; // 1 << 5
export const ADD_REACTIONS = 64n; // 1 << 6
export const VIEW_AUDIT_LOG = 128n; // 1 << 7
export const PRIORITY_SPEAKER = 256n; // 1 << 8
export const STREAM = 512n; // 1 << 9
export const VIEW_CHANNEL = 1024n; // 1 << 10
export const SEND_MESSAGES = 2048n; // 1 << 11
export const SEND_TTS_MESSAGES = 4096n; // 1 << 12
export const MANAGE_MESSAGES = 8192n; // 1 << 13
export const EMBED_LINKS = 16384n; // 1 << 14
export const ATTACH_FILES = 32768n; // 1 << 15
export const READ_MESSAGE_HISTORY = 65536n; // 1 << 16
export const MENTION_EVERYONE = 131072n; // 1 << 17
export const USE_EXTERNAL_EMOJIS = 262144n; // 1 << 18
export const VIEW_GUILD_INSIGHTS = 524288n; // 1 << 19
export const CONNECT = 1048576n; // 1 << 20
export const SPEAK = 2097152n; // 1 << 21
export const MUTE_MEMBERS = 4194304n; // 1 << 22
export const DEAFEN_MEMBERS = 8388608n; // 1 << 23
export const MOVE_MEMBERS = 16777216n; // 1 << 24
export const USE_VAD = 33554432n; // 1 << 25
export const CHANGE_NICKNAME = 67108864n; // 1 << 26
export const MANAGE_NICKNAMES = 134217728n; // 1 << 27
export const MANAGE_ROLES = 268435456n; // 1 << 28
export const MANAGE_WEBHOOKS = 536870912n; // 1 << 29
export const MANAGE_GUILD_EXPRESSIONS = 1073741824n; // 1 << 30
export const USE_APPLICATION_COMMANDS = 2147483648n; // 1 << 31
export const REQUEST_TO_SPEAK = 4294967296n; // 1 << 32
export const MANAGE_EVENTS = 8589934592n; // 1 << 33
export const MANAGE_THREADS = 17179869184n; // 1 << 34
export const CREATE_PUBLIC_THREADS = 34359738368n; // 1 << 35
export const CREATE_PRIVATE_THREADS = 68719476736n; // 1 << 36
export const USE_EXTERNAL_STICKERS = 137438953472n; // 1 << 37
export const SEND_MESSAGES_IN_THREADS = 274877906944n; // 1 << 38
export const USE_EMBEDDED_ACTIVITIES = 549755813888n; // 1 << 39
export const MODERATE_MEMBERS = 1099511627776n; // 1 << 40
export const VIEW_CREATOR_MONETIZATION_ANALYTICS = 2199023255552n; // 1 << 41
export const USE_SOUNDBOARD = 4398046511104n; // 1 << 42
export const CREATE_GUILD_EXPRESSIONS = 8796093022208n; // 1 << 43
export const CREATE_EVENTS = 17592186044416n; // 1 << 44
export const USE_EXTERNAL_SOUNDS = 35184372088832n; // 1 << 45
export const SEND_VOICE_MESSAGES = 70368744177664n; // 1 << 46
export const USE_CLYDE_AI = 140737488355328n; // 1 << 47
export const SET_VOICE_CHANNEL_STATUS = 281474976710656n; // 1 << 48
}

// bigints can't be used as object keys, so we need to convert them to strings
Expand Down
4 changes: 2 additions & 2 deletions lib/types/channels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ export interface ActionRowBase<T extends Component> {
type: ComponentTypes.ACTION_ROW;
}

export type MessageActionRow = ActionRowBase<MessageComponent>;
export type ModalActionRow = ActionRowBase<ModalComponent>;
export interface MessageActionRow extends ActionRowBase<MessageComponent> {}
export interface ModalActionRow extends ActionRowBase<ModalComponent> {}

export interface ButtonBase {
disabled?: boolean;
Expand Down

0 comments on commit 9721e1d

Please sign in to comment.