mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 14:06:07 +00:00
fix: poll typings
This commit is contained in:
parent
ef0786775c
commit
ff42213a13
@ -4,13 +4,11 @@ import { throwError } from '..';
|
|||||||
import { resolvePartialEmoji } from '../structures/extra/functions';
|
import { resolvePartialEmoji } from '../structures/extra/functions';
|
||||||
|
|
||||||
export class PollBuilder {
|
export class PollBuilder {
|
||||||
constructor(
|
constructor(public data: DeepPartial<RESTAPIPollCreate> = {}) {
|
||||||
public data: DeepPartial<Omit<RESTAPIPollCreate, 'answers'> & { answers: { poll_media: APIPollMedia }[] }> = {},
|
|
||||||
) {
|
|
||||||
this.data.layout_type = PollLayoutType.Default;
|
this.data.layout_type = PollLayoutType.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
addAnswers(...answers: RestOrArray<PollMedia>) {
|
addAnswers(...answers: RestOrArray<APIPollMedia>) {
|
||||||
this.data.answers = (this.data.answers ?? []).concat(
|
this.data.answers = (this.data.answers ?? []).concat(
|
||||||
answers.flat().map(x => ({ poll_media: this.resolvedPollMedia(x) })),
|
answers.flat().map(x => ({ poll_media: this.resolvedPollMedia(x) })),
|
||||||
);
|
);
|
||||||
@ -52,4 +50,4 @@ export class PollBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PollMedia = { text?: string; emoji?: EmojiResolvable };
|
export type PollMedia = Omit<APIPollMedia, 'emoji'> & { emoji?: EmojiResolvable };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user