refactor: misc. changes

This commit is contained in:
ryan-0324 2024-07-31 21:04:57 -04:00
parent 2cf37bd616
commit 9e9d465714
20 changed files with 244 additions and 211 deletions

View file

@ -44,7 +44,7 @@
"nanoid": "^5.0.7"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^2.4.0",
"@stylistic/eslint-plugin": "^2.6.0",
"@stylistic/stylelint-config": "^2.0.0",
"@stylistic/stylelint-plugin": "^3.0.0",
"@types/chrome": "^0.0.269",
@ -67,22 +67,22 @@
"highlight.js": "11.8.0",
"html-minifier-terser": "^7.2.0",
"moment": "2.22.2",
"puppeteer-core": "^22.13.1",
"puppeteer-core": "^22.15.0",
"standalone-electron-types": "^1.0.0",
"stylelint": "^16.8.1",
"stylelint-config-standard": "^36.0.1",
"ts-patch": "^3.2.1",
"tsx": "^4.16.2",
"tsx": "^4.16.3",
"type-fest": "^4.23.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0-alpha.60",
"typescript-eslint": "^8.0.0",
"typescript-transform-paths": "^3.4.7",
"zip-local": "^0.3.5"
},
"packageManager": "pnpm@9.6.0",
"pnpm": {
"patchedDependencies": {
"@stylistic/eslint-plugin-js@2.4.0": "patches/@stylistic__eslint-plugin-js@2.4.0.patch",
"@stylistic/eslint-plugin-js@2.6.0": "patches/@stylistic__eslint-plugin-js@2.6.0.patch",
"eslint-plugin-path-alias@2.1.0": "patches/eslint-plugin-path-alias@2.1.0.patch",
"eslint@9.8.0": "patches/eslint@9.8.0.patch",
"standalone-electron-types@1.0.0": "patches/standalone-electron-types@1.0.0.patch"

View file

@ -30,10 +30,10 @@
"type-fest": "^4.23.0"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^2.4.0",
"@stylistic/eslint-plugin": "^2.6.0",
"@types/node": "^20.14.13",
"@types/semver": "^7.5.8",
"@typescript-eslint/typescript-estree": "^8.0.0-alpha.60",
"@typescript-eslint/typescript-estree": "^8.0.0",
"eslint": "^9.8.0",
"eslint-plugin-check-file": "^2.8.0",
"eslint-plugin-import-x": "^3.1.0",
@ -41,10 +41,10 @@
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unicorn": "^55.0.0",
"eslint-plugin-unused-imports": "^4.0.1",
"puppeteer-core": "^22.13.1",
"puppeteer-core": "^22.15.0",
"semver": "^7.6.3",
"tsx": "^4.16.2",
"tsx": "^4.16.3",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0-alpha.60"
"typescript-eslint": "^8.0.0"
}
}

View file

@ -7,7 +7,7 @@
import type { DepGraph } from "dependency-graph";
import type { UnionToIntersection } from "type-fest";
import type { Nullish } from "../internal";
import type { IsAny, Nullish } from "../internal";
import type { ExtractAction, FluxAction, FluxActionHandler, FluxActionType } from "./fluxActions";
import type { FluxDispatchBand } from "./FluxDispatcher";
@ -55,7 +55,7 @@ export type FluxActionHandlerMap<Action extends FluxAction = FluxAction>
= UnionToIntersection<
Action extends unknown
? PropertyKey extends keyof Action
? 0 extends 1 & Action[PropertyKey]
? IsAny<Action[string]> & IsAny<Action[number]> & IsAny<Action[symbol]> extends unknown
? { [ActionType in Action["type"]]: (action: any) => void; }
: { [ActionType in Action["type"]]: (action: Action & { type: ActionType; }) => void; }
: { [ActionType in Action["type"]]: (action: Action & { type: ActionType; }) => void; }

View file

@ -4,10 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import type { IsAny } from "../internal";
export type FluxActionHandler<Action extends FluxAction = FluxAction, Return = void>
= Action extends unknown
? PropertyKey extends keyof Action
? 0 extends 1 & Action[PropertyKey]
? IsAny<Action[string]> & IsAny<Action[number]> & IsAny<Action[symbol]> extends unknown
? (action: any) => Return
: (action: Action) => Return
: (action: Action) => Return

View file

@ -164,6 +164,13 @@ export interface MessageReference {
channel_id: string;
guild_id?: string;
message_id?: string;
type: MessageReferenceType;
}
// Original name: MessageReferenceTypes
export enum MessageReferenceType {
DEFAULT = 0,
FORWARD = 1,
}
export interface MessagePoll {

View file

@ -15,6 +15,9 @@ export type Defined<T> = Exclude<T, undefined>;
/** @internal */
export type GenericConstructor = new (...args: any[]) => unknown;
/** @internal */
export type IsAny<T> = 0 extends 1 & T ? unknown : never;
/** @internal */
export type Nullish = null | undefined;

View file

@ -28,7 +28,7 @@
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"fs-extra": "^11.2.0",
"tsx": "^4.16.2",
"tsx": "^4.16.3",
"typescript": "^5.5.4"
}
}

View file

@ -5,9 +5,9 @@ settings:
excludeLinksFromLockfile: false
patchedDependencies:
'@stylistic/eslint-plugin-js@2.4.0':
'@stylistic/eslint-plugin-js@2.6.0':
hash: svxcf2j6uikn7di5a4erf5bw5y
path: patches/@stylistic__eslint-plugin-js@2.4.0.patch
path: patches/@stylistic__eslint-plugin-js@2.6.0.patch
eslint-plugin-path-alias@2.1.0:
hash: japuwsqfkulviwgkm4kd2oi3ky
path: patches/eslint-plugin-path-alias@2.1.0.patch
@ -45,8 +45,8 @@ importers:
version: 5.0.7
devDependencies:
'@stylistic/eslint-plugin':
specifier: ^2.4.0
version: 2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
specifier: ^2.6.0
version: 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@stylistic/stylelint-config':
specifier: ^2.0.0
version: 2.0.0(stylelint@16.8.1(typescript@5.5.4))
@ -103,7 +103,7 @@ importers:
version: 12.1.1(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
eslint-plugin-unused-imports:
specifier: ^4.0.1
version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
highlight.js:
specifier: 11.8.0
version: 11.8.0
@ -114,8 +114,8 @@ importers:
specifier: 2.22.2
version: 2.22.2
puppeteer-core:
specifier: ^22.13.1
version: 22.13.1
specifier: ^22.15.0
version: 22.15.0
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0(patch_hash=cvychuhjtbzvtowhc2efrgpqjq)
@ -129,8 +129,8 @@ importers:
specifier: ^3.2.1
version: 3.2.1
tsx:
specifier: ^4.16.2
version: 4.16.2
specifier: ^4.16.3
version: 4.16.3
type-fest:
specifier: ^4.23.0
version: 4.23.0
@ -138,8 +138,8 @@ importers:
specifier: ^5.5.4
version: 5.5.4
typescript-eslint:
specifier: ^8.0.0-alpha.60
version: 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
specifier: ^8.0.0
version: 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
typescript-transform-paths:
specifier: ^3.4.7
version: 3.4.7(typescript@5.5.4)
@ -175,8 +175,8 @@ importers:
version: 4.23.0
devDependencies:
'@stylistic/eslint-plugin':
specifier: ^2.4.0
version: 2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
specifier: ^2.6.0
version: 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@types/node':
specifier: ^20.14.13
version: 20.14.13
@ -184,8 +184,8 @@ importers:
specifier: ^7.5.8
version: 7.5.8
'@typescript-eslint/typescript-estree':
specifier: ^8.0.0-alpha.60
version: 8.0.0-alpha.60(typescript@5.5.4)
specifier: ^8.0.0
version: 8.0.0(typescript@5.5.4)
eslint:
specifier: ^9.8.0
version: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
@ -206,22 +206,22 @@ importers:
version: 55.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
eslint-plugin-unused-imports:
specifier: ^4.0.1
version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
version: 4.0.1(@typescript-eslint/eslint-plugin@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
puppeteer-core:
specifier: ^22.13.1
version: 22.13.1
specifier: ^22.15.0
version: 22.15.0
semver:
specifier: ^7.6.3
version: 7.6.3
tsx:
specifier: ^4.16.2
version: 4.16.2
specifier: ^4.16.3
version: 4.16.3
typescript:
specifier: ^5.5.4
version: 5.5.4
typescript-eslint:
specifier: ^8.0.0-alpha.60
version: 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
specifier: ^8.0.0
version: 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
packages/vencord-types:
dependencies:
@ -257,8 +257,8 @@ importers:
specifier: ^11.2.0
version: 11.2.0
tsx:
specifier: ^4.16.2
version: 4.16.2
specifier: ^4.16.3
version: 4.16.3
typescript:
specifier: ^5.5.4
version: 5.5.4
@ -656,39 +656,39 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@puppeteer/browsers@2.2.4':
resolution: {integrity: sha512-BdG2qiI1dn89OTUUsx2GZSpUzW+DRffR1wlMJyKxVHYrhnKoELSDxDd+2XImUkuWPEKk76H5FcM/gPFrEK1Tfw==}
'@puppeteer/browsers@2.3.0':
resolution: {integrity: sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==}
engines: {node: '>=18'}
hasBin: true
'@sapphi-red/web-noise-suppressor@0.3.5':
resolution: {integrity: sha512-jh3+V9yM+zxLriQexoGm0GatoPaJWjs6ypFIbFYwQp+AoUb55eUXrjKtKQyuC5zShzzeAQUl0M5JzqB7SSrsRA==}
'@stylistic/eslint-plugin-js@2.4.0':
resolution: {integrity: sha512-ScIYDFAwNz+ELr3KfAZMuYMCUq7Q6TdEEIq4RBRR77EHucpDrwi5Kx2d0VdYxb4s4o6nOtSkJmY9MCZupDYJow==}
'@stylistic/eslint-plugin-js@2.6.0':
resolution: {integrity: sha512-6oN0Djdy8gTRhx2qS1m4P+CeDKqmZZwc4ibgzzJS+8iBW3Ts1c2mAvi+OH6TN4bt0AHm0FnDv2+KtTqqueMATw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: '>=8.40.0'
'@stylistic/eslint-plugin-jsx@2.4.0':
resolution: {integrity: sha512-yaZXaRj9lOwrQd1YA1d1Ssz58IrDKDYTvLzlKcKED4NlpjDdMbj//Y4DlNhlW9M9v0ZsRsmKNQl2p5OWFfmdEw==}
'@stylistic/eslint-plugin-jsx@2.6.0':
resolution: {integrity: sha512-Hm7YODwBwAsYtacY9hR5ONiBS7K9og4YZFjBr8mfqsmlCYVFje1HsOKG+tylePkwcu0Qhi+lY86cP3rlV4PhAA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: '>=8.40.0'
'@stylistic/eslint-plugin-plus@2.4.0':
resolution: {integrity: sha512-yqVZ2ps3lSzT3Atcx/jSbzTaRJfxtWeuPk1WvINUod1fRVxNlgKLDwiM+63Hq3Q7H4aM0lS5ccAbFlEGINNg0Q==}
'@stylistic/eslint-plugin-plus@2.6.0':
resolution: {integrity: sha512-9GfLF08zx/pNFpQQlNMz6f4IixoS8zdSBFdJLWLTorMilNUjd4dDuA5ej4Z32+mTZf4u6lduzQcUrAYiGKTLTg==}
peerDependencies:
eslint: '*'
'@stylistic/eslint-plugin-ts@2.4.0':
resolution: {integrity: sha512-0zi3hHrrqaXPGZESTfPNUm4YMvxq+aqPGCUiZfEnn7l5VNC19oKaPonZ6LmKzoksebzpJ7w6nieZLVeQm4o7tg==}
'@stylistic/eslint-plugin-ts@2.6.0':
resolution: {integrity: sha512-9ooVm+BRNqdyI/p10eKGAdbdLKU5lllc7mX4Xqp76hKDsh5cCxmZM6zMgK3CLKkYrW0RUunFORkg8dAnmc1qIA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: '>=8.40.0'
'@stylistic/eslint-plugin@2.4.0':
resolution: {integrity: sha512-GJ86m60wpKPm0m8sSuApOITjCvKUbyzhVO/BTQb7BNYXVUJMS3ql+uAro0V+4yoHwyBVXTB4EDy3UGkOqtEyyw==}
'@stylistic/eslint-plugin@2.6.0':
resolution: {integrity: sha512-BYzdgwz/4WgDTGmkPMKXFLRBKnYNVnmgD4NDsDCGJulqLFLF6sW1gr6gAJSFnkxwsdhEg+GApF4m5e3OMDpd6g==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: '>=8.40.0'
@ -780,8 +780,8 @@ packages:
'@types/yazl@2.4.5':
resolution: {integrity: sha512-qpmPfx32HS7vlGJf7EsoM9qJnLZhXJBf1KH0hzfdc+D794rljQWh4H0I/UrZy+6Nhqn0l2jdBZXBGZtR1vnHqw==}
'@typescript-eslint/eslint-plugin@8.0.0-alpha.60':
resolution: {integrity: sha512-v/tFZrKwljflSlkUAVOCdwoIKObnS0JlxNgVDkRoUsJU896g4Uexz5/SWEAfNqJKB7AX6TjfmEHrzvPiJhUYMg==}
'@typescript-eslint/eslint-plugin@8.0.0':
resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
'@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
@ -791,8 +791,8 @@ packages:
typescript:
optional: true
'@typescript-eslint/parser@8.0.0-alpha.60':
resolution: {integrity: sha512-DPBVEb8742M9OgzRmtJxLC8FIhMqhYvJFjM+anUhSfqlAoRcpnvGOJU7F+mkLh1In8aIX4P8iarRHZ6r8NF2Ug==}
'@typescript-eslint/parser@8.0.0':
resolution: {integrity: sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
@ -805,12 +805,12 @@ packages:
resolution: {integrity: sha512-0P2jTTqyxWp9HiKLu/Vemr2Rg1Xb5B7uHItdVZ6iAenXmPo4SZ86yOPCJwMqpCyaMiEHTNqizHfsbmCFT1x9SA==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/scope-manager@8.0.0-alpha.60':
resolution: {integrity: sha512-r33PjZ7ypfza6hddc/Qg/0GVw4IAd5La+aTnQzOI1wM4f+tIK8umO5Z75+gevxcYfYVl4JLuwITGCQeEagNGNg==}
'@typescript-eslint/scope-manager@8.0.0':
resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/type-utils@8.0.0-alpha.60':
resolution: {integrity: sha512-Gg4zIEitCGHwMpc1nUIKhxS7735Em5AuBdl23eMupJcpWhOTlLiurvwIBBOX0tyh4nyjpE2BjbDDACEVR0Pl2g==}
'@typescript-eslint/type-utils@8.0.0':
resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '*'
@ -822,8 +822,8 @@ packages:
resolution: {integrity: sha512-a29Ir0EbyKTKHnZWbNsrc/gqfIBqYPwj3F2M+jWE/9bqfEHg0AMtXzkbUkOG6QgEScxh2+Pz9OXe11jHDnHR7A==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/types@8.0.0-alpha.60':
resolution: {integrity: sha512-u38oNlelUVr7a8P0H3uyjNT36wLhmHVSVKcuCXYqMrm3AInz1/iY24YSR72M9AXL4lW+GDSUJAT8UfzHz6MzIg==}
'@typescript-eslint/types@8.0.0':
resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/typescript-estree@7.17.0':
@ -835,8 +835,8 @@ packages:
typescript:
optional: true
'@typescript-eslint/typescript-estree@8.0.0-alpha.60':
resolution: {integrity: sha512-+vYrFh7YFYv1M0l5fUZoqB4RlERfjC17NeO/enEJojmJuFKjJ/0c0FVUCdEelA9NGGdxxxf4SxJ76/sqceoXpg==}
'@typescript-eslint/typescript-estree@8.0.0':
resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '*'
@ -850,8 +850,8 @@ packages:
peerDependencies:
eslint: ^8.56.0
'@typescript-eslint/utils@8.0.0-alpha.60':
resolution: {integrity: sha512-2C2yDiyqx5VTasCcUmUB3AYRia8+oodCfungd8MJtIqTVa4XYB81rNhe1rtOtv8mwFFDjupKhXMC3pUJKWRtYw==}
'@typescript-eslint/utils@8.0.0':
resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
@ -860,8 +860,8 @@ packages:
resolution: {integrity: sha512-RVGC9UhPOCsfCdI9pU++K4nD7to+jTcMIbXTSOcrLqUEW6gF2pU1UUbYJKc9cvcRSK1UDeMJ7pdMxf4bhMpV/A==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/visitor-keys@8.0.0-alpha.60':
resolution: {integrity: sha512-2OdSvXlL5aabYl2VUrGzdYi/KTFm+tCkA0KusOpNO8vAqeRbfb/8V0qdr4SHxIaDju9cseoJWothUH8nP+g6Og==}
'@typescript-eslint/visitor-keys@8.0.0':
resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@vap/core@0.0.12':
@ -1030,8 +1030,8 @@ packages:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
chromium-bidi@0.6.1:
resolution: {integrity: sha512-kSxJRj0VgtUKz6nmzc2JPfyfJGzwzt65u7PqhPHtgGQUZLF5oG+ST6l6e5ONfStUMAlhSutFCjaGKllXZa16jA==}
chromium-bidi@0.6.3:
resolution: {integrity: sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A==}
peerDependencies:
devtools-protocol: '*'
@ -1180,8 +1180,8 @@ packages:
resolution: {integrity: sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w==}
engines: {node: '>= 0.6.0'}
devtools-protocol@0.0.1299070:
resolution: {integrity: sha512-+qtL3eX50qsJ7c+qVyagqi7AWMoQCBGNfoyJZMwm/NSXVqLYbuitrWEEIzxfUmTNy7//Xe8yhMmQ+elj3uAqSg==}
devtools-protocol@0.0.1312386:
resolution: {integrity: sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==}
diff@5.2.0:
resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==}
@ -2035,8 +2035,8 @@ packages:
resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==}
engines: {node: '>=6'}
puppeteer-core@22.13.1:
resolution: {integrity: sha512-NmhnASYp51QPRCAf9n0OPxuPMmzkKd8+2sB9Q+BjwwCG25gz6iuNc3LQDWa+cH2tyivmJppLhNNFt6Q3HmoOpw==}
puppeteer-core@22.15.0:
resolution: {integrity: sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA==}
engines: {node: '>=18'}
q@1.5.1:
@ -2337,8 +2337,8 @@ packages:
tslib@2.6.2:
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
tsx@4.16.2:
resolution: {integrity: sha512-C1uWweJDgdtX2x600HjaFaucXTilT7tgUZHbOE4+ypskZ1OP8CRCSDkCxG6Vya9EwaFIVagWwpaVAn5wzypaqQ==}
tsx@4.16.3:
resolution: {integrity: sha512-MP8AEUxVnboD2rCC6kDLxnpDBNWN9k3BSVU/0/nNxgm70bPBnfn+yCKcnOsIVPQwdkbKYoFOlKjjWZWJ2XCXUg==}
engines: {node: '>=18.0.0'}
hasBin: true
@ -2358,8 +2358,8 @@ packages:
resolution: {integrity: sha512-ZiBujro2ohr5+Z/hZWHESLz3g08BBdrdLMieYFULJO+tWc437sn8kQsWLJoZErY8alNhxre9K4p3GURAG11n+w==}
engines: {node: '>=16'}
typescript-eslint@8.0.0-alpha.60:
resolution: {integrity: sha512-5R6YrUeK9gBAX7O0iYhClGqXYM1SWoZOeTii1gdN3b55WhOWSyyu44o09cgn2BmqRUQKBrw+FzjHbQIk9vHWHA==}
typescript-eslint@8.0.0:
resolution: {integrity: sha512-yQWBJutWL1PmpmDddIOl9/Mi6vZjqNCjqSGBMQ4vsc2Aiodk0SnbQQWPXbSy0HNuKCuGkw1+u4aQ2mO40TdhDQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '*'
@ -2729,7 +2729,7 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.13.0
'@puppeteer/browsers@2.2.4':
'@puppeteer/browsers@2.3.0':
dependencies:
debug: 4.3.6
extract-zip: 2.0.1
@ -2744,7 +2744,7 @@ snapshots:
'@sapphi-red/web-noise-suppressor@0.3.5': {}
'@stylistic/eslint-plugin-js@2.4.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))':
'@stylistic/eslint-plugin-js@2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))':
dependencies:
'@types/eslint': 9.6.0
acorn: 8.12.1
@ -2752,39 +2752,39 @@ snapshots:
eslint-visitor-keys: 4.0.0
espree: 10.1.0
'@stylistic/eslint-plugin-jsx@2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))':
'@stylistic/eslint-plugin-jsx@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))':
dependencies:
'@stylistic/eslint-plugin-js': 2.4.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@stylistic/eslint-plugin-js': 2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@types/eslint': 9.6.0
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
estraverse: 5.3.0
picomatch: 4.0.2
'@stylistic/eslint-plugin-plus@2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@stylistic/eslint-plugin-plus@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@types/eslint': 9.6.0
'@typescript-eslint/utils': 7.17.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
transitivePeerDependencies:
- supports-color
- typescript
'@stylistic/eslint-plugin-ts@2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@stylistic/eslint-plugin-ts@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@stylistic/eslint-plugin-js': 2.4.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@stylistic/eslint-plugin-js': 2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@types/eslint': 9.6.0
'@typescript-eslint/utils': 7.17.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
transitivePeerDependencies:
- supports-color
- typescript
'@stylistic/eslint-plugin@2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@stylistic/eslint-plugin@2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@stylistic/eslint-plugin-js': 2.4.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@stylistic/eslint-plugin-jsx': 2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@stylistic/eslint-plugin-plus': 2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@stylistic/eslint-plugin-ts': 2.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@stylistic/eslint-plugin-js': 2.6.0(patch_hash=svxcf2j6uikn7di5a4erf5bw5y)(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@stylistic/eslint-plugin-jsx': 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@stylistic/eslint-plugin-plus': 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@stylistic/eslint-plugin-ts': 2.6.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@types/eslint': 9.6.0
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
transitivePeerDependencies:
@ -2887,14 +2887,14 @@ snapshots:
dependencies:
'@types/node': 20.14.13
'@typescript-eslint/eslint-plugin@8.0.0-alpha.60(@typescript-eslint/parser@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@eslint-community/regexpp': 4.11.0
'@typescript-eslint/parser': 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/scope-manager': 8.0.0-alpha.60
'@typescript-eslint/type-utils': 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 8.0.0-alpha.60
'@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/scope-manager': 8.0.0
'@typescript-eslint/type-utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 8.0.0
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
graphemer: 1.4.0
ignore: 5.3.1
@ -2905,12 +2905,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@typescript-eslint/scope-manager': 8.0.0-alpha.60
'@typescript-eslint/types': 8.0.0-alpha.60
'@typescript-eslint/typescript-estree': 8.0.0-alpha.60(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 8.0.0-alpha.60
'@typescript-eslint/scope-manager': 8.0.0
'@typescript-eslint/types': 8.0.0
'@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 8.0.0
debug: 4.3.6
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
optionalDependencies:
@ -2923,15 +2923,15 @@ snapshots:
'@typescript-eslint/types': 7.17.0
'@typescript-eslint/visitor-keys': 7.17.0
'@typescript-eslint/scope-manager@8.0.0-alpha.60':
'@typescript-eslint/scope-manager@8.0.0':
dependencies:
'@typescript-eslint/types': 8.0.0-alpha.60
'@typescript-eslint/visitor-keys': 8.0.0-alpha.60
'@typescript-eslint/types': 8.0.0
'@typescript-eslint/visitor-keys': 8.0.0
'@typescript-eslint/type-utils@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@typescript-eslint/type-utils@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@typescript-eslint/typescript-estree': 8.0.0-alpha.60(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
debug: 4.3.6
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
@ -2942,7 +2942,7 @@ snapshots:
'@typescript-eslint/types@7.17.0': {}
'@typescript-eslint/types@8.0.0-alpha.60': {}
'@typescript-eslint/types@8.0.0': {}
'@typescript-eslint/typescript-estree@7.17.0(typescript@5.5.4)':
dependencies:
@ -2959,10 +2959,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/typescript-estree@8.0.0-alpha.60(typescript@5.5.4)':
'@typescript-eslint/typescript-estree@8.0.0(typescript@5.5.4)':
dependencies:
'@typescript-eslint/types': 8.0.0-alpha.60
'@typescript-eslint/visitor-keys': 8.0.0-alpha.60
'@typescript-eslint/types': 8.0.0
'@typescript-eslint/visitor-keys': 8.0.0
debug: 4.3.6
globby: 11.1.0
is-glob: 4.0.3
@ -2985,12 +2985,12 @@ snapshots:
- supports-color
- typescript
'@typescript-eslint/utils@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
'@typescript-eslint/utils@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)':
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
'@typescript-eslint/scope-manager': 8.0.0-alpha.60
'@typescript-eslint/types': 8.0.0-alpha.60
'@typescript-eslint/typescript-estree': 8.0.0-alpha.60(typescript@5.5.4)
'@typescript-eslint/scope-manager': 8.0.0
'@typescript-eslint/types': 8.0.0
'@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4)
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
transitivePeerDependencies:
- supports-color
@ -3001,9 +3001,9 @@ snapshots:
'@typescript-eslint/types': 7.17.0
eslint-visitor-keys: 3.4.3
'@typescript-eslint/visitor-keys@8.0.0-alpha.60':
'@typescript-eslint/visitor-keys@8.0.0':
dependencies:
'@typescript-eslint/types': 8.0.0-alpha.60
'@typescript-eslint/types': 8.0.0
eslint-visitor-keys: 3.4.3
'@vap/core@0.0.12':
@ -3182,9 +3182,9 @@ snapshots:
ansi-styles: 4.3.0
supports-color: 7.2.0
chromium-bidi@0.6.1(devtools-protocol@0.0.1299070):
chromium-bidi@0.6.3(devtools-protocol@0.0.1312386):
dependencies:
devtools-protocol: 0.0.1299070
devtools-protocol: 0.0.1312386
mitt: 3.0.1
urlpattern-polyfill: 10.0.0
zod: 3.23.8
@ -3310,7 +3310,7 @@ snapshots:
dependency-graph@0.9.0: {}
devtools-protocol@0.0.1299070: {}
devtools-protocol@0.0.1312386: {}
diff@5.2.0: {}
@ -3481,12 +3481,12 @@ snapshots:
semver: 7.6.3
strip-indent: 3.0.0
eslint-plugin-unused-imports@4.0.1(@typescript-eslint/eslint-plugin@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)):
eslint-plugin-unused-imports@4.0.1(@typescript-eslint/eslint-plugin@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)):
dependencies:
eslint: 9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
eslint-rule-composer: 0.3.0
optionalDependencies:
'@typescript-eslint/eslint-plugin': 8.0.0-alpha.60(@typescript-eslint/parser@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
eslint-rule-composer@0.3.0: {}
@ -4225,12 +4225,12 @@ snapshots:
punycode@2.1.1: {}
puppeteer-core@22.13.1:
puppeteer-core@22.15.0:
dependencies:
'@puppeteer/browsers': 2.2.4
chromium-bidi: 0.6.1(devtools-protocol@0.0.1299070)
'@puppeteer/browsers': 2.3.0
chromium-bidi: 0.6.3(devtools-protocol@0.0.1312386)
debug: 4.3.6
devtools-protocol: 0.0.1299070
devtools-protocol: 0.0.1312386
ws: 8.18.0
transitivePeerDependencies:
- bufferutil
@ -4583,7 +4583,7 @@ snapshots:
tslib@2.6.2: {}
tsx@4.16.2:
tsx@4.16.3:
dependencies:
esbuild: 0.21.5
get-tsconfig: 4.7.5
@ -4600,11 +4600,11 @@ snapshots:
type-fest@4.23.0: {}
typescript-eslint@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4):
typescript-eslint@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4):
dependencies:
'@typescript-eslint/eslint-plugin': 8.0.0-alpha.60(@typescript-eslint/parser@8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/parser': 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0-alpha.60(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/eslint-plugin': 8.0.0(@typescript-eslint/parser@8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/parser': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.0(eslint@9.8.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:

View file

@ -17,10 +17,10 @@
*/
import { mergeDefaults } from "@utils/mergeDefaults";
import type { ChannelType, InteractionType, MessageActivity, MessageAttachment, MessageEmbedType, MessageFlags, MessageInteractionMetadata, MessagePoll, MessageRoleSubscriptionData, MessageType, Sticker, StickerItem, UserFlags, UserPremiumType } from "@vencord/discord-types";
import type { ChannelType, InteractionType, MessageActivity, MessageAttachment, MessageEmbedType, MessageFlags, MessageInteractionMetadata, MessagePoll, MessageReference, MessageRoleSubscriptionData, MessageType, Sticker, StickerItem, UserClanData, UserFlags, UserPremiumType } from "@vencord/discord-types";
import { findByCodeLazy } from "@webpack";
import { MessageActionCreators, SnowflakeUtils } from "@webpack/common";
import type { LiteralToPrimitive, PartialDeep } from "type-fest";
import type { LiteralToPrimitive, PartialDeep, SnakeCasedProperties } from "type-fest";
import type { Argument } from "./types";
@ -39,7 +39,7 @@ export const generateId = () => `-${SnowflakeUtils.fromTimestamp(Date.now())}`;
* @param channelId ID of the channel to send the message to
* @param message The message to send
*/
export function sendBotMessage(channelId: string, message: PartialDeep<MessageJSON, { recurseIntoArrays: true; }>) {
export function sendBotMessage(channelId: string, message: PartialDeep<MessageJSON>) {
const botMessage = createBotMessage({ channelId, content: "" });
MessageActionCreators.receiveMessage(channelId, mergeDefaults(message, botMessage));
@ -96,12 +96,7 @@ export interface MessageJSON {
mention_everyone: boolean;
mention_roles: string[];
mentions: UserJSON[];
message_reference?: {
channel_id?: string;
fail_if_not_exists?: boolean;
guild_id?: string;
message_id?: string;
};
message_reference?: MessageReference;
nonce?: string | number;
pinned: boolean;
poll?: Omit<MessagePoll, "expiry"> & { expiry: string | null; };
@ -150,6 +145,7 @@ export interface UserJSON {
};
banner?: string | null;
bot?: boolean;
clan: SnakeCasedProperties<UserClanData> | null;
discriminator: string;
email?: string | null;
flags?: UserFlags;

View file

@ -7,7 +7,6 @@
import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { isNonNullish } from "@utils/guards";
import definePlugin, { OptionType } from "@utils/types";
import type { MessageRecord } from "@vencord/discord-types";
import { findExportedComponentLazy } from "@webpack";
@ -77,7 +76,7 @@ export default definePlugin({
const s = str(k);
return prev + (
isNonNullish(s)
s !== null
? (prev !== ""
? (showMillis ? k === "milliseconds" : k === "seconds")
? " and "
@ -95,7 +94,7 @@ export default definePlugin({
const { id, nonce } = message;
// Message wasn't received through gateway
if (!isNonNullish(nonce)) return null;
if (nonce == null) return null;
// Bots basically never send a nonce, and if someone does do it then it's usually not a snowflake
if (message.bot) return null;
@ -143,7 +142,7 @@ export default definePlugin({
return ErrorBoundary.wrap(({ message }: { message: MessageRecord; }) => {
const d = this.latencyTooltipData(message);
if (!isNonNullish(d)) return null;
if (d == null) return null;
let text: string;
if (!d.delta) {

View file

@ -18,25 +18,28 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { isNonNullish } from "@utils/guards";
import definePlugin from "@utils/types";
import type { GroupDMChannelRecord, UserRecord } from "@vencord/discord-types";
import { findByPropsLazy } from "@webpack";
import { Avatar, ChannelStore, Clickable, IconUtils, RelationshipStore, ScrollerThin, UserStore } from "@webpack/common";
import { Avatar, ChannelStore, Clickable, IconUtils, RelationshipStore, ScrollerThin, UserStore, UserUtils } from "@webpack/common";
import type { ReactElement } from "react";
const SelectedChannelActionCreators = findByPropsLazy("selectPrivateChannel");
const UserUtils = findByPropsLazy("getGlobalName");
const ProfileListClasses: Record<string, string> = findByPropsLazy("emptyIconFriends", "emptyIconGuilds");
const GuildLabelClasses: Record<string, string> = findByPropsLazy("guildNick", "guildAvatarWithoutIcon");
function getGroupDMName(channel: GroupDMChannelRecord) {
return channel.name ||
channel.recipients
.map(UserStore.getUser)
.filter(isNonNullish)
.map(channel => RelationshipStore.getNickname(channel.id) || UserUtils.getName(channel))
.join(", ");
if (channel.name) return channel.name;
const names: string[] = [];
for (const userId of channel.recipients) {
const user = UserStore.getUser(userId);
if (user)
names.push(RelationshipStore.getNickname(userId) || UserUtils.getName(user));
}
return names.join(", ");
}
export default definePlugin({
@ -77,30 +80,28 @@ export default definePlugin({
isBotOrMe: (user: UserRecord) => user.bot || user.id === UserStore.getCurrentUser()!.id,
renderMutualGDMs: ErrorBoundary.wrap(({ user, onClose }: { user: UserRecord; onClose: () => void; }) => {
const entries = ChannelStore.getSortedPrivateChannels()
.filter((channel): channel is GroupDMChannelRecord =>
channel.isGroupDM()
&& channel.recipients.includes(user.id)
)
.map(channel => (
<Clickable
className={ProfileListClasses.listRow}
onClick={() => {
onClose();
SelectedChannelActionCreators.selectPrivateChannel(channel.id);
}}
>
<Avatar
src={IconUtils.getChannelIconURL({ id: channel.id, icon: channel.icon, size: 32 })}
size="SIZE_40"
className={ProfileListClasses.listAvatar}
/>
<div className={ProfileListClasses.listRowContent}>
<div className={ProfileListClasses.listName}>{getGroupDMName(channel)}</div>
<div className={GuildLabelClasses.guildNick}>{channel.recipients.length + 1} Members</div>
</div>
</Clickable>
));
const entries: ReactElement[] = [];
for (const channel of ChannelStore.getSortedPrivateChannels())
if (channel.isGroupDM() && channel.recipients.includes(user.id))
entries.push(
<Clickable
className={ProfileListClasses.listRow}
onClick={() => {
onClose();
SelectedChannelActionCreators.selectPrivateChannel(channel.id);
}}
>
<Avatar
src={IconUtils.getChannelIconURL({ id: channel.id, icon: channel.icon, size: 32 })}
size="SIZE_40"
className={ProfileListClasses.listAvatar}
/>
<div className={ProfileListClasses.listRowContent}>
<div className={ProfileListClasses.listName}>{getGroupDMName(channel)}</div>
<div className={GuildLabelClasses.guildNick}>{channel.recipients.length + 1} Members</div>
</div>
</Clickable>
);
return (
<ScrollerThin

View file

@ -20,6 +20,6 @@ export function isTruthy<T>(value: T): value is Exclude<T, "" | 0n | 0 | false |
return Boolean(value);
}
export function isNonNullish<T>(value: T): value is Exclude<T, null | undefined> {
export function isNonNullish<T>(value: T) {
return value != null;
}

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { isObject } from "./misc";
/**
* Recursively merges defaults into an object and returns the same object
* @param obj Object
@ -13,7 +15,7 @@
export function mergeDefaults<T>(obj: T, defaults: T): T {
for (const key in defaults) {
const v = defaults[key];
if (typeof v === "object" && v !== null && !Array.isArray(v)) {
if (isObject(v)) {
obj[key] ??= {} as any;
mergeDefaults(obj[key], v);
} else {

View file

@ -32,16 +32,20 @@ export const classes = (...classes: (string | false | null | undefined)[]) =>
*/
export const sleep = (ms: number) => new Promise<void>(r => { setTimeout(r, ms); });
export function copyWithToast(text: string, toastMessage = "Copied to clipboard!") {
export function copyWithToast(text: string, toastMessage?: string) {
let type: number;
if (ClipboardUtils.SUPPORTS_COPY) {
ClipboardUtils.copy(text);
toastMessage ??= "Copied to clipboard!";
type = Toasts.Type.SUCCESS;
} else {
toastMessage = "Your browser does not support copying to clipboard";
type = Toasts.Type.FAILURE;
}
Toasts.show({
message: toastMessage,
id: Toasts.genId(),
type: Toasts.Type.SUCCESS
type
});
}
@ -53,7 +57,7 @@ export function isObject(obj: unknown): obj is object {
}
/**
* Check if an object is empty or in other words has no own properties
* Checks if an object has no own enumerable non-symbol properties
*/
export function isObjectEmpty(obj: object) {
for (const k in obj)

View file

@ -31,10 +31,12 @@ function createStyle(id: string) {
async function initSystemValues() {
const values = await VencordNative.themes.getSystemValues();
const variables = Object.entries(values)
.filter(([, v]) => v !== "#")
.map(([k, v]) => `--${k}: ${v};`)
.join("");
let variables = "";
for (const k in values) {
const v = values[k];
if (v !== "#")
variables += `--${k}: ${v};`;
}
createStyle("vencord-os-theme-values").textContent = `:root{${variables}}`;
}

View file

@ -72,7 +72,7 @@ function toastSuccess() {
toast(Toasts.Type.SUCCESS, "Settings successfully imported. Restart to apply changes!");
}
function toastFailure(err: any) {
function toastFailure(err: unknown) {
toast(Toasts.Type.FAILURE, `Failed to import settings: ${String(err)}`);
}

View file

@ -42,7 +42,7 @@ export const Flux: {
export const useStateFromStores: Stores.UseStateFromStoresHook = findByCodeLazy("useStateFromStores");
// shallowEqual.tsx
const areArraysShallowEqual = (a: readonly unknown[], b?: readonly unknown[] | null | undefined) =>
const areArraysShallowEqual = (a: readonly unknown[], b?: readonly unknown[] | null) =>
b != null && a.length === b.length && a.every((x, i) => x === b[i]);
/** @see {@link useStateFromStores} */

View file

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import type { DisplayProfile, GuildMember, GuildRecord, UserProfileStore, UserRecord, UserStore } from "@vencord/discord-types";
import type { UserJSON } from "@api/Commands";
import type { ChannelRecord, DisplayProfile, DMChannelRecord, GuildMember, GuildRecord, StatusType, UserProfileStore, UserRecord, UserStore } from "@vencord/discord-types";
import type { ExpressionPickerViewType } from "@webpack/common";
import type { ReactNode } from "react";
import type { LiteralUnion } from "type-fest";
export type MarkupUtils = Record<
| "parse"
@ -102,7 +103,7 @@ export interface IconUtils {
getGuildIconURL: (data: { id: string; icon?: string; size?: number; canAnimate?: boolean; }) => string | undefined;
getGuildBannerURL: (guild: GuildRecord, canAnimate?: boolean) => string | null;
getChannelIconURL: (data: { id: string; icon?: string | null | undefined; applicationId?: string; size?: number; }) => string | undefined;
getChannelIconURL: (data: { id: string; icon?: string | null; applicationId?: string; size?: number; }) => string | undefined;
getEmojiURL: (data: { id: string; animated: boolean; size: number; forcePNG?: boolean; }) => string;
hasAnimatedGuildIcon: (guild: GuildRecord) => boolean;
@ -141,8 +142,11 @@ export interface Constants {
// zustand store
export interface ExpressionPickerStore {
closeExpressionPicker: (activeViewType?: any) => void;
openExpressionPicker: (activeView: LiteralUnion<"emoji" | "gif" | "sticker", string>, activeViewType?: any) => void;
closeExpressionPicker: (activeViewType?: Record<string, any> | null) => void;
openExpressionPicker: (
activeView: ExpressionPickerViewType | null,
activeViewType: Record<string, any> | null
) => void;
}
export interface BrowserWindowFeatures {
@ -178,34 +182,40 @@ export interface PopoutWindowActionCreators {
setAlwaysOnTop: (key: string, alwaysOnTop: boolean) => Promise<void>;
}
export type UserUtilsTagInclude = LiteralUnion<"auto" | "always" | "never", string>;
export type UserUtilsTagInclude = "always" | "auto" | "never";
export interface UserUtilsTagOptions {
forcePomelo?: boolean;
identifiable?: UserUtilsTagInclude;
decoration?: UserUtilsTagInclude;
mode?: "full" | "username";
decoration?: UserUtilsTagInclude | undefined;
forcePomelo?: boolean | undefined;
identifiable?: UserUtilsTagInclude | undefined;
mode?: "full" | "username" | undefined;
}
export interface UserUtils {
getGlobalName: (user: UserRecord) => string;
getFormattedName: (user: UserRecord, useTagInsteadOfUsername?: boolean) => string;
getName: (user: UserRecord) => string;
useName: (user: UserRecord) => string;
getUserTag: (user: UserRecord, options?: UserUtilsTagOptions) => string;
useUserTag: (user: UserRecord, options?: UserUtilsTagOptions) => string;
useDirectMessageRecipient: any;
humanizeStatus: any;
getFormattedName: (
user?: UserRecord | UserJSON | null,
useTagInsteadOfUsername?: boolean /* = false */
) => string;
getGlobalName: (user?: UserRecord | UserJSON | null) => string | undefined;
getName: <User extends UserRecord | UserJSON | null | undefined>(user: User) => User extends {} ? string : undefined;
getUserTag: (user?: UserRecord | UserJSON | null, options?: UserUtilsTagOptions) => string;
humanizeStatus: <Status extends string>(
status: Status,
mobile?: boolean /* = false */
) => Status extends Exclude<StatusType, StatusType.UNKNOWN> ? string : null;
useDirectMessageRecipient: <Channel extends ChannelRecord | null | undefined>(channel: Channel) => Channel extends {}
? Channel extends DMChannelRecord ? UserRecord | undefined : null : undefined;
useName: <User extends UserRecord | UserJSON | null | undefined>(user: User) => User extends {} ? string : undefined;
useUserTag: (user?: UserRecord | UserJSON | null, options?: UserUtilsTagOptions) => string;
}
export interface DisplayProfileUtils {
getDisplayProfile: (
userId: string,
guildId?: string | null | undefined,
guildId?: string | null,
stores?: [
Pick<UserStore, "getUser">,
Pick<UserProfileStore, "getUserProfile" | "getGuildMemberProfile">
] | undefined /* = [UserStore, UserProfileStore] */
Pick<UserProfileStore, "getGuildMemberProfile" | "getUserProfile">
] /* = [UserStore, UserProfileStore] */
) => DisplayProfile | null;
useDisplayProfile: (userId: string, guildId?: string | null | undefined) => DisplayProfile | null;
useDisplayProfile: (userId: string, guildId?: string | null) => DisplayProfile | null;
}

View file

@ -136,6 +136,13 @@ export const ExpressionPickerStore: t.ExpressionPickerStore = mapMangledModuleLa
openExpressionPicker: m => typeof m === "function" && openExpressionPickerMatcher.test(m.toString()),
});
export enum ExpressionPickerViewType {
EMOJI = "emoji",
GIF = "gif",
SOUNDBOARD = "soundboard",
STICKER = "sticker",
}
export const FormattedMessage: typeof $FormattedMessage = findByCodeLazy('(this,"intlMessage",');
export const hljs: typeof import("highlight.js").default = findByPropsLazy("highlight", "registerLanguage");