@sapphire/discord.js-utilities
Advanced tools
Comparing version 2.0.0 to 2.0.1-next.76b50e0b.0
@@ -1058,6 +1058,7 @@ 'use strict'; | ||
* Generally this will be the command message, but it can also be another message from your bot, i.e. to indicate a loading state. | ||
* @param target The user who will be able to interact with the reactions of this {@link PaginatedMessage}. Defaults to `message.author`. | ||
*/ | ||
async run(message) { | ||
async run(message, target = message.author) { | ||
// Try to get the previous PaginatedMessage for this user | ||
const paginatedMessage = PaginatedMessage.handlers.get(message.author.id); | ||
const paginatedMessage = PaginatedMessage.handlers.get(target.id); | ||
// If a PaginatedMessage was found then stop it | ||
@@ -1075,4 +1076,4 @@ if (paginatedMessage) | ||
throw new Error('There are no messages.'); | ||
await this.setUpMessage(message.channel, message.author); | ||
await this.setUpReactions(message.channel, message.author); | ||
await this.setUpMessage(message.channel, target); | ||
await this.setUpReactions(message.channel, target); | ||
const messageId = this.response.id; | ||
@@ -1082,6 +1083,6 @@ if (this.collector) { | ||
PaginatedMessage.messages.delete(messageId); | ||
PaginatedMessage.handlers.delete(message.author.id); | ||
PaginatedMessage.handlers.delete(target.id); | ||
}); | ||
PaginatedMessage.messages.set(messageId, this); | ||
PaginatedMessage.handlers.set(message.author.id, this); | ||
PaginatedMessage.handlers.set(target.id, this); | ||
} | ||
@@ -1088,0 +1089,0 @@ return this; |
@@ -261,4 +261,5 @@ import { Awaited } from '@sapphire/utilities'; | ||
* Generally this will be the command message, but it can also be another message from your bot, i.e. to indicate a loading state. | ||
* @param target The user who will be able to interact with the reactions of this {@link PaginatedMessage}. Defaults to `message.author`. | ||
*/ | ||
run(message: Message): Promise<this>; | ||
run(message: Message, target?: User): Promise<this>; | ||
/** | ||
@@ -265,0 +266,0 @@ * Executed whenever {@link PaginatedMessage.run} is called. |
{ | ||
"name": "@sapphire/discord.js-utilities", | ||
"version": "2.0.0", | ||
"version": "2.0.1-next.76b50e0b.0", | ||
"description": "Discord.js specific utilities for your JavaScript/TypeScript bots", | ||
@@ -57,3 +57,3 @@ "author": "@sapphire", | ||
}, | ||
"gitHead": "e073f47a0b8291412d9f4575af2d69242d494d0a" | ||
"gitHead": "76b50e0b05292ff57732117fbf91d41ee281c7ad" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
350041
3746
1