Skip to content

Commit

Permalink
fix: base message options type
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Sep 23, 2022
1 parent 82b0003 commit 1ed5617
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 411 deletions.
211 changes: 103 additions & 108 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

6 changes: 2 additions & 4 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
spec: '@yarnpkg/plugin-typescript'
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
spec: '@yarnpkg/plugin-interactive-tools'

yarnPath: .yarn/releases/yarn-3.2.3.cjs
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"@favware/npm-deprecate": "^1.0.5",
"@sapphire/eslint-config": "^4.3.8",
"@sapphire/prettier-config": "^1.4.4",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"cz-conventional-changelog": "^3.3.0",
"discord.js": "^14.3.0",
"discord.js": "^14.4.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
Expand All @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"tsup": "^6.2.3",
"typedoc": "^0.23.14",
"typedoc": "^0.23.15",
"typescript": "^4.8.3"
},
"peerDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/pagination/PaginationEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,8 @@ export abstract class PaginationEmbed extends EmbedBuilder {
if (this.images.length) {
this.setImage(this.images[pageNumber - 1]);
}
this.payload.content = Array.isArray(this.contents) ? this.contents[this.currentPage - 1] ?? null : this.contents;
// TODO: remove null from content in a next major version. Djs changed the typings in a minor version.
this.payload.content = (Array.isArray(this.contents) ? this.contents[this.currentPage - 1] : this.contents) ?? undefined;
if (this.descriptions.length) {
this.setDescription(
`${this.prevDescription}\n` +
Expand Down Expand Up @@ -971,7 +972,7 @@ export abstract class PaginationEmbed extends EmbedBuilder {
this._readyActionRows();
this.payload.ephemeral = this.ephemeral;
this.payload.components = this.actionRows;
this.payload.content = Array.isArray(this.contents) ? this.contents[0] ?? null : this.contents;
this.payload.content = (Array.isArray(this.contents) ? this.contents[0] : this.contents) ?? undefined;
const embed = this.embeds.length ? EmbedBuilder.from(this.embeds[0]) : this;
this.payload.embeds = [embed];
this.payload.files = this.attachments;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/types/Options.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MessageOptions } from 'discord.js';
import type { BaseMessageOptions } from 'discord.js';
import type { PButtonStyle } from './ButtonsOptions';
import type { EmojiOptions } from './EmojiOptions';

export type PEmbeds = Required<MessageOptions>['embeds'];
export type PAttachments = Required<MessageOptions>['files'];
export type PEmbeds = Required<BaseMessageOptions>['embeds'];
export type PAttachments = Required<BaseMessageOptions>['files'];

export enum ExtraRowPosition {
Above,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/types/Payload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MessageOptions } from 'discord.js';
import type { BaseMessageOptions } from 'discord.js';

export type Payload = Pick<MessageOptions, 'content' | 'embeds' | 'files' | 'components'> & {
export type Payload = BaseMessageOptions & {
ephemeral?: boolean;
};
Loading

0 comments on commit 1ed5617

Please sign in to comment.