Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@duxcore/interactive-discord

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@duxcore/interactive-discord - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

13

example/src/index.ts

@@ -88,3 +88,2 @@ import Discord, { MessageEmbed } from 'discord.js';

interactiveClient.addSelectionListener(basicselection, (interaction) => {
interaction.respond({ content: `Selected: ${interaction.selections?.join(",")}`, isPrivate: true })

@@ -145,2 +144,14 @@ })

interactiveClient.on("buttonInteraction", (interaction) => {
if (!interaction.isHandled) interaction.respond({ isPrivate: true, content: 'This interaction is over' })
})
interactiveClient.on("selectionInteraction", (interaction) => {
if (!interaction.isHandled) interaction.respond({ isPrivate: true, content: 'This interaction is over' })
})
interactiveClient.on("commandInteraction", (interaction) => {
if (!interaction.isHandled) interaction.respond({ isPrivate: true, content: 'This interaction is over' })
})
bot.login(process.env.TOKEN);

2

package.json

@@ -5,3 +5,3 @@ {

"description": "A package that will allow you to seamlessly integrate discord interactions into your bot.",
"version": "1.1.4",
"version": "1.1.5",
"license": "GPL-3.0",

@@ -8,0 +8,0 @@ "main": "lib/index",

@@ -18,2 +18,3 @@ import axios from 'axios';

private _guildId: string;
private _isHandled: boolean;

@@ -30,2 +31,3 @@ constructor(raw: RawInteractionObject, client: InteractiveClient) {

this._guildId = raw.guild_id;
this._isHandled = false;
}

@@ -55,2 +57,9 @@

get isHandled(): boolean { return this._isHandled }
setisHandled(is_handled: boolean): this {
this._isHandled = is_handled
return this;
}
respond(response: InteractionResponseOptions): Promise<void> {

@@ -57,0 +66,0 @@ return new Promise((resolve, reject) => {

@@ -34,19 +34,34 @@ import { APIMessageContentResolvable, Client, Collection, DMChannel, MessageAdditions, MessageOptions, NewsChannel, TextChannel } from "discord.js";

if (interaction.type == InteractionType.MessageComponent) {
const btnController = new ButtonInteractionController(interaction, this)
const selController = new SelectionInteractionController(interaction, this)
this.emit("buttonInteraction", btnController);
this._buttonListeners.map((cb, key) => {
if (btnController.customId == key) return cb(btnController);
});
this._singleButtonListeners.map((cb, key) => {
if (btnController.customId == key) {
this._singleButtonListeners.delete(key);
return cb(btnController);
}
});
if (interaction.data.values) {
const selController = new SelectionInteractionController(interaction, this)
this._selectionListeners.map((cs, key) => {
if (selController.customId == key) return cs(selController);
});
this._selectionListeners.map((cs, key) => {
if (selController.customId == key) {
selController.setisHandled(true);
return cs(selController)
};
});
this.emit("selectionInteraction", selController);
} else {
const btnController = new ButtonInteractionController(interaction, this)
this._buttonListeners.map((cb, key) => {
if (btnController.customId == key) {
btnController.setisHandled(true);
return cb(btnController)
};
});
this._singleButtonListeners.map((cb, key) => {
if (btnController.customId == key) {
btnController.setisHandled(true);
this._singleButtonListeners.delete(key);
return cb(btnController);
}
});
this.emit("buttonInteraction", btnController);
}
}

@@ -53,0 +68,0 @@ })

import { ButtonInteractionController } from "../../controllers/ButtonInteractionController";
import { SelectionInteractionController } from "../../controllers/SelectionInteractionController";
export interface Events {
"buttonInteraction": (interaction: ButtonInteractionController) => void;
"selectionInteraction": (interaction: SelectionInteractionController) => void;
"commandInteraction": (interaction: SelectionInteractionController) => void;
}

@@ -16,2 +16,3 @@ import { MessageEmbed } from "discord.js";

}
export interface Message {

@@ -18,0 +19,0 @@ type: number;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc