Skip to content

Commit

Permalink
v1.2.15
Browse files Browse the repository at this point in the history
+ reply with content null
  • Loading branch information
fb-sean committed Oct 31, 2023
1 parent 49a9cbf commit 5eb755b
Show file tree
Hide file tree
Showing 76 changed files with 327 additions and 332 deletions.
67 changes: 0 additions & 67 deletions docs/1.2.12/index.html

This file was deleted.

67 changes: 0 additions & 67 deletions docs/1.2.13/index.html

This file was deleted.

128 changes: 57 additions & 71 deletions docs/1.2.14/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/ActionRow.html → docs/1.2.15/ActionRow.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Button.html → docs/1.2.15/Button.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Embed.html → docs/1.2.15/Embed.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Guild.html → docs/1.2.15/Guild.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Member.html → docs/1.2.15/Member.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Message.html → docs/1.2.15/Message.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Modal.html → docs/1.2.15/Modal.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Rest.html → docs/1.2.15/Rest.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/TextInput.html → docs/1.2.15/TextInput.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/User.html → docs/1.2.15/User.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.2.14/Utils.html → docs/1.2.15/Utils.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/1.2.14/api_api.js.html → docs/1.2.15/api_api.js.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/1.2.14/global.html → docs/1.2.15/global.html

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions docs/1.2.15/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
<div class="message">
<i class="fas fa-circle-notch fa-spin"></i> Redirecting...
</div>
<a class="redirect-link" href="https://interactionsjs.com/1.2.14">If you are not redirected automatically, click here!</a>
<a class="redirect-link" href="https://interactionsjs.com/1.2.15">If you are not redirected automatically, click here!</a>
</div>

<script>
setTimeout(function () {
window.location.href = "https://interactionsjs.com/1.2.14";
window.location.href = "https://interactionsjs.com/1.2.15";
}, 1000);
</script>
<script defer data-domain="interactionsjs.com" src="https://stats.sattler.dev/js/script.js" ></script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interactions.js",
"version": "1.2.14",
"version": "1.2.15",
"description": "A powerful Javascript library to work with discords interactions",
"main": "./src/index.js",
"typings": "./typings/index.d.ts",
Expand Down
76 changes: 54 additions & 22 deletions src/structures/Interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ class Interaction {
return this._res.send({
type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
data: {
content,
embeds,
components,
files,
content: content,
embeds: embeds,
components: components,
files: files,
flags: ephemeral ? InteractionResponseFlags.EPHEMERAL : null,
},
});
Expand Down Expand Up @@ -288,23 +288,39 @@ class Interaction {
/**
* Edit the Reply
* @param options The message payload (embeds, components, content, files, ephemeral)
* @param {string} options.content The content of the message
* @param {array} options.embeds The embeds of the message
* @param {array} options.components The components of the message
* @param {array} options.files The files of the message
* @example
* const response = await interaction.editReply({ content: "Hello World" });
* console.log(response);
*/
editReply({embeds = [], components = [], content = null, files = []}) {
if (embeds?.length <= 0 && components?.length <= 0 && !files?.length <= 0 && !content) throw new Error("[Interactions.js => <Interaction>.editReply] You need to provide a MessagePayload (Content or Embeds or Components or files)");
editReply(options = {}) {
if (
!options.hasOwnProperty('content') &&
!options.hasOwnProperty('embeds') &&
!options.hasOwnProperty('components') &&
!options.hasOwnProperty('files')
) throw new Error("[Interactions.js => <Interaction>.editReply] You need to provide a MessagePayload (Content or Embeds or Components or files)");

this.client.emit('debug', "[DEBUG] Sending a edit");

let payload = {};
if (embeds?.length > 0) payload.embeds = embeds;
if (components?.length > 0) payload.components = components;
if (content) payload.content = content;
if (files?.length > 0) payload.files = files;
if (options.hasOwnProperty('content')) {
payload.content = options.content;
}
if (options.hasOwnProperty('embeds')) {
payload.embeds = options.embeds;
}
if (options.hasOwnProperty('components')) {
payload.components = options.components;
}
if (options.hasOwnProperty('files')) {
payload.files = options.files;
}

const rest = Rest.getRest();

return rest.patch(
`/webhooks/${this.client.applicationId}/${this.token}/messages/@original?wait=true`,
{
Expand All @@ -317,23 +333,39 @@ class Interaction {
/**
* Send a simple follow-up message
* @param options The message payload (embeds, components, content, files, ephemeral)
* @param {string} options.content The content of the message
* @param {array} options.embeds The embeds of the message
* @param {array} options.components The components of the message
* @param {array} options.files The files of the message
* @example
* const response = await interaction.followUp({ content: "Hello World" });
* console.log(response);
*/
followUp({embeds = [], components = [], content = null, files = []}) {
if (embeds?.length <= 0 && components?.length <= 0 && !files?.length <= 0 && !content) throw new Error("[Interactions.js => <Interaction>.followUp] You need to provide a MessagePayload (Content or Embeds or Components or files)");
followUp(options) {
if (
!options.hasOwnProperty('content') &&
!options.hasOwnProperty('embeds') &&
!options.hasOwnProperty('components') &&
!options.hasOwnProperty('files')
) throw new Error("[Interactions.js => <Interaction>.followUp] You need to provide a MessagePayload (Content or Embeds or Components or files)");

this.client.emit('debug', "[DEBUG] Sending a follow up");

let payload = {};
if (embeds?.length > 0) payload.embeds = embeds;
if (components?.length > 0) payload.components = components;
if (content) payload.content = content;
if (files?.length > 0) payload.files = files;
if (options.hasOwnProperty('content')) {
payload.content = options.content;
}
if (options.hasOwnProperty('embeds')) {
payload.embeds = options.embeds;
}
if (options.hasOwnProperty('components')) {
payload.components = options.components;
}
if (options.hasOwnProperty('files')) {
payload.files = options.files;
}

const rest = Rest.getRest();

return rest.post(
`/webhooks/${this.client.applicationId}/${this.token}?wait=true`,
{
Expand All @@ -358,10 +390,10 @@ class Interaction {
return this._res.send({
type: InteractionResponseType.UPDATE_MESSAGE,
data: {
content,
embeds,
components,
files,
content: content,
embeds: embeds,
components: components,
files: files,
},
});
}
Expand Down
22 changes: 10 additions & 12 deletions typings/structures/Interaction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,29 +176,27 @@ declare class Interaction {
/**
* Edit the Reply
* @param options The message payload (embeds, components, content, files, ephemeral)
* @param {string} options.content The content of the message
* @param {array} options.embeds The embeds of the message
* @param {array} options.components The components of the message
* @param {array} options.files The files of the message
* @example
* const response = await interaction.editReply({ content: "Hello World" });
* console.log(response);
*/
editReply({ embeds, components, content, files }: {
embeds?: any[];
components?: any[];
content?: any;
files?: any[];
}): Promise<unknown>;
editReply(options?: {}): Promise<unknown>;
/**
* Send a simple follow-up message
* @param options The message payload (embeds, components, content, files, ephemeral)
* @param {string} options.content The content of the message
* @param {array} options.embeds The embeds of the message
* @param {array} options.components The components of the message
* @param {array} options.files The files of the message
* @example
* const response = await interaction.followUp({ content: "Hello World" });
* console.log(response);
*/
followUp({ embeds, components, content, files }: {
embeds?: any[];
components?: any[];
content?: any;
files?: any[];
}): Promise<unknown>;
followUp(options: any): Promise<unknown>;
/**
* Update an Interaction
* @param options The message payload (embeds, components, content, files)
Expand Down
2 changes: 1 addition & 1 deletion typings/structures/Interaction.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5eb755b

Please sign in to comment.