mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(PollAnswer)!: remove fetchVoters (#11059)
BREAKING CHANGE: The `PollAnswer#fetchVoters` method has been removed. Use `PollAnswer#voters#fetch` instead. Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -30,6 +30,14 @@ class PollAnswerVoterManager extends CachedManager {
|
||||
* @name PollAnswerVoterManager#cache
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options used for fetching voters of a poll answer.
|
||||
*
|
||||
* @typedef {Object} BaseFetchPollAnswerVotersOptions
|
||||
* @property {number} [limit] The maximum number of voters to fetch
|
||||
* @property {Snowflake} [after] The user id to fetch voters after
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches the users that voted on this poll answer. Resolves with a collection of users, mapped by their ids.
|
||||
*
|
||||
|
||||
@@ -93,25 +93,6 @@ class PollAnswer extends Base {
|
||||
get partial() {
|
||||
return this.poll.partial || (this.text === null && this.emoji === null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used for fetching voters of a poll answer.
|
||||
*
|
||||
* @typedef {Object} BaseFetchPollAnswerVotersOptions
|
||||
* @property {number} [limit] The maximum number of voters to fetch
|
||||
* @property {Snowflake} [after] The user id to fetch voters after
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches the users that voted for this answer.
|
||||
*
|
||||
* @param {BaseFetchPollAnswerVotersOptions} [options={}] The options for fetching voters
|
||||
* @returns {Promise<Collection<Snowflake, User>>}
|
||||
* @deprecated Use {@link PollAnswerVoterManager#fetch} instead
|
||||
*/
|
||||
async fetchVoters({ after, limit } = {}) {
|
||||
return this.voters.fetch({ after, limit });
|
||||
}
|
||||
}
|
||||
|
||||
exports.PollAnswer = PollAnswer;
|
||||
|
||||
@@ -16,7 +16,7 @@ client.on(Events.ClientReady, async () => {
|
||||
// console.dir(message.poll, { depth: Infinity });
|
||||
|
||||
// const answer = message.poll.answers.first();
|
||||
// const voters = await answer.fetchVoters();
|
||||
// const voters = await answer.voters.fetch();
|
||||
// console.dir(voters);
|
||||
|
||||
const message = await channel.send({
|
||||
|
||||
14
packages/discord.js/typings/index.d.ts
vendored
14
packages/discord.js/typings/index.d.ts
vendored
@@ -2753,6 +2753,11 @@ export interface PollQuestionMedia {
|
||||
text: string | null;
|
||||
}
|
||||
|
||||
export interface BaseFetchPollAnswerVotersOptions {
|
||||
after?: Snowflake;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export class PollAnswerVoterManager extends CachedManager<Snowflake, User, UserResolvable> {
|
||||
private constructor(answer: PollAnswer);
|
||||
public answer: PollAnswer;
|
||||
@@ -2777,11 +2782,6 @@ export class Poll extends Base {
|
||||
public end(): Promise<Message>;
|
||||
}
|
||||
|
||||
export interface BaseFetchPollAnswerVotersOptions {
|
||||
after?: Snowflake;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export class PollAnswer extends Base {
|
||||
private constructor(client: Client<true>, data: APIPollAnswer & { count?: number }, poll: Poll);
|
||||
private readonly _emoji: APIPartialEmoji | null;
|
||||
@@ -2792,10 +2792,6 @@ export class PollAnswer extends Base {
|
||||
public voters: PollAnswerVoterManager;
|
||||
public get emoji(): Emoji | GuildEmoji | null;
|
||||
public get partial(): false;
|
||||
/**
|
||||
* @deprecated Use {@link PollAnswerVoterManager.fetch} instead
|
||||
*/
|
||||
public fetchVoters(options?: BaseFetchPollAnswerVotersOptions): Promise<Collection<Snowflake, User>>;
|
||||
}
|
||||
|
||||
export interface ReactionCollectorEventTypes extends CollectorEventTypes<Snowflake | string, MessageReaction, [User]> {
|
||||
|
||||
Reference in New Issue
Block a user