New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sapphire/discord.js-utilities

Package Overview
Dependencies
Maintainers
3
Versions
1082
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sapphire/discord.js-utilities - npm Package Compare versions

Comparing version 1.5.10 to 1.6.0-next.0a80370.0

157

dist/index.js

@@ -199,2 +199,59 @@ 'use strict';

/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/CategoryChannel CategoryChannel}
* @param channel The channel to check
*/
function isCategoryChannel(channel) {
return channel.type === 'category';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/DMChannel DMChannel}
* @param channel The channel to check
*/
function isDMChannel(channel) {
return channel.type === 'dm';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/PartialGroupDMChannel PartialGroupDMChannel}
* @param channel The channel to check
*/
function isGroupChannel(channel) {
return channel.type === 'group';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/GuildChannel GuildChannel}
* @param channel The channel to check
*/
function isGuildBasedChannel(channel) {
return channel.type !== 'dm' && channel.type !== 'group' && channel.type !== 'unknown';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/NewsChannel NewsChannel}
* @param channel The channel to check
*/
function isNewsChannel(channel) {
return channel.type === 'news';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/StoreChannel StoreChannel}
* @param channel The channel to check
*/
function isStoreChannel(channel) {
return channel.type === 'store';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/TextChannel TextChannel}
* @param channel The channel to check
*/
function isTextChannel(channel) {
return channel.type === 'text';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/VoiceChannel VoiceChannel}
* @param channel The channel to check
*/
function isVoiceChannel(channel) {
return channel.type === 'voice';
}
/**
* This is a {@link PaginatedMessage}, a utility to paginate messages (usually embeds).

@@ -314,2 +371,6 @@ * You must either use this class directly or extend it.

}
setPromptMessage(message) {
PaginatedMessage.promptMessage = message;
return this;
}
/**

@@ -478,5 +539,7 @@ * Sets the handler's current page/message index.

async handleCollect(author, channel, reaction, user) {
var _a, _b;
await reaction.users.remove(user);
const action = ((_a = this.actions.get(reaction.emoji.identifier)) !== null && _a !== void 0 ? _a : this.actions.get(reaction.emoji.name));
var _a, _b, _c;
if (isGuildBasedChannel(channel) && channel.client.user && ((_a = channel.permissionsFor(channel.client.user.id)) === null || _a === void 0 ? void 0 : _a.has('MANAGE_MESSAGES'))) {
await reaction.users.remove(user);
}
const action = ((_b = this.actions.get(reaction.emoji.identifier)) !== null && _b !== void 0 ? _b : this.actions.get(reaction.emoji.name));
const previousIndex = this.index;

@@ -491,3 +554,3 @@ await action.run({

if (previousIndex !== this.index) {
await ((_b = this.response) === null || _b === void 0 ? void 0 : _b.edit(await this.resolvePage(channel, this.index)));
await ((_c = this.response) === null || _c === void 0 ? void 0 : _c.edit(await this.resolvePage(channel, this.index)));
}

@@ -499,4 +562,4 @@ }

*/
async handleEnd(reason) {
var _a;
async handleEnd(_, reason) {
var _a, _b;
// Remove all listeners from the collector:

@@ -506,3 +569,7 @@ (_a = this.collector) === null || _a === void 0 ? void 0 : _a.removeAllListeners();

if (this.response && !PaginatedMessage.deletionStopReasons.includes(reason)) {
await this.response.reactions.removeAll();
if (isGuildBasedChannel(this.response.channel) &&
this.response.client.user &&
((_b = this.response.channel.permissionsFor(this.response.client.user.id)) === null || _b === void 0 ? void 0 : _b.has('MANAGE_MESSAGES'))) {
await this.response.reactions.removeAll();
}
}

@@ -522,3 +589,3 @@ }

run: async ({ handler, author, channel }) => {
const questionMessage = await channel.send('What page would you like to jump to?');
const questionMessage = await channel.send(PaginatedMessage.promptMessage);
const collected = await channel

@@ -570,3 +637,8 @@ .awaitMessages((message) => message.author.id === author.id, { max: 1, idle: 15 * 1000 })

run: async ({ response, collector }) => {
await response.reactions.removeAll();
var _a;
if (isGuildBasedChannel(response.channel) &&
response.client.user &&
((_a = response.channel.permissionsFor(response.client.user.id)) === null || _a === void 0 ? void 0 : _a.has('MANAGE_MESSAGES'))) {
await response.reactions.removeAll();
}
collector.stop();

@@ -587,2 +659,12 @@ }

});
/**
* Custom prompt message when a user wants to jump to a certain page number.
* @default "What page would you like to jump to?"
*/
Object.defineProperty(PaginatedMessage, "promptMessage", {
enumerable: true,
configurable: true,
writable: true,
value: 'What page would you like to jump to?'
});

@@ -1067,59 +1149,2 @@ /**

/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/CategoryChannel CategoryChannel}
* @param channel The channel to check
*/
function isCategoryChannel(channel) {
return channel.type === 'category';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/DMChannel DMChannel}
* @param channel The channel to check
*/
function isDMChannel(channel) {
return channel.type === 'dm';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/PartialGroupDMChannel PartialGroupDMChannel}
* @param channel The channel to check
*/
function isGroupChannel(channel) {
return channel.type === 'group';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/GuildChannel GuildChannel}
* @param channel The channel to check
*/
function isGuildBasedChannel(channel) {
return channel.type !== 'dm' && channel.type !== 'group' && channel.type !== 'unknown';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/NewsChannel NewsChannel}
* @param channel The channel to check
*/
function isNewsChannel(channel) {
return channel.type === 'news';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/StoreChannel StoreChannel}
* @param channel The channel to check
*/
function isStoreChannel(channel) {
return channel.type === 'store';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/TextChannel TextChannel}
* @param channel The channel to check
*/
function isTextChannel(channel) {
return channel.type === 'text';
}
/**
* Checks whether a given channel is a {@linkplain https://discord.js.org/#/docs/main/stable/class/VoiceChannel VoiceChannel}
* @param channel The channel to check
*/
function isVoiceChannel(channel) {
return channel.type === 'voice';
}
exports.LazyPaginatedMessage = LazyPaginatedMessage;

@@ -1126,0 +1151,0 @@ exports.MessageBuilder = MessageBuilder;

@@ -1,2 +0,2 @@

import { APIMessage, Message, MessageOptions, MessageReaction, NewsChannel, ReactionCollector, TextChannel, User } from 'discord.js';
import { APIMessage, Collection, Message, MessageOptions, MessageReaction, NewsChannel, ReactionCollector, Snowflake, TextChannel, User } from 'discord.js';
/**

@@ -76,2 +76,3 @@ * This is a {@link PaginatedMessage}, a utility to paginate messages (usually embeds).

constructor({ pages, actions }?: PaginatedMessageOptions);
setPromptMessage(message: string): this;
/**

@@ -173,3 +174,3 @@ * Sets the handler's current page/message index.

*/
protected handleEnd(reason: string): Promise<void>;
protected handleEnd(_: Collection<Snowflake, MessageReaction>, reason: string): Promise<void>;
/**

@@ -184,2 +185,7 @@ * The default actions of this handler.

static deletionStopReasons: string[];
/**
* Custom prompt message when a user wants to jump to a certain page number.
* @default "What page would you like to jump to?"
*/
static promptMessage: string;
}

@@ -186,0 +192,0 @@ export interface PaginatedMessage {

{
"name": "@sapphire/discord.js-utilities",
"version": "1.5.10",
"version": "1.6.0-next.0a80370.0",
"description": "Discord.js specific utilities for your JavaScript/TypeScript bots",

@@ -55,3 +55,3 @@ "author": "@sapphire",

},
"gitHead": "20ced0b9207d4615a77e4af8c272ec7e37dcfb36"
"gitHead": "0a80370593ed7032a255898c24755c0696e51401"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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