Typing fixes

* More complete embed types
This commit is contained in:
Erik 2024-11-23 15:20:28 +02:00
parent 34afc658e7
commit c41de6474e
2 changed files with 29 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@navy.gif/discord-webhook", "name": "@navy.gif/discord-webhook",
"version": "1.2.5", "version": "1.2.6",
"description": "Client for interacting with discord webhooks", "description": "Client for interacting with discord webhooks",
"author": "Navy.gif", "author": "Navy.gif",
"license": "MIT", "license": "MIT",
@ -17,12 +17,15 @@
} }
}, },
"files": [ "files": [
"build/**/*" "build/**/*",
"README.md"
], ],
"scripts": { "scripts": {
"build": "tsc --build --force && tsc --project tsconfig.cjs.json && node ./scripts/declareTypes.js", "build": "tsc --build --force && tsc --project tsconfig.cjs.json && node ./scripts/declareTypes.js",
"test": "tsc && jest", "test": "tsc && jest",
"release": "yarn build && yarn publish", "release:patch": "yarn build && yarn version patch && yarn npm publish",
"release:minor": "yarn build && yarn version minor && yarn npm publish",
"release:major": "yarn build && yarn version major && yarn npm publish",
"lint": "eslint --fix" "lint": "eslint --fix"
}, },
"devDependencies": { "devDependencies": {

View File

@ -21,6 +21,25 @@ type WebhookData = {
url: string url: string
} }
type EmbedFooter = {
text: string,
icon_url?: string,
proxy_icon_url?: string
}
type EmbedField = {
name: string,
value: string,
inline?: boolean
}
type EmbedAuthor = {
name: string,
url?: string,
icon_url?: string,
proxy_icon_url?: string,
}
type Embed = { type Embed = {
title?: string, title?: string,
type?: string, type?: string,
@ -28,9 +47,9 @@ type Embed = {
url?: string, url?: string,
timestamp?: string, timestamp?: string,
color?: number, color?: number,
// TODO: Finish types footer?: EmbedFooter,
// footer?: EmbedFooter, fields?: EmbedField[]
author?: EmbedAuthor,
} }
type File = { type File = {
@ -53,4 +72,4 @@ type Payload = {
} }
} }
export { WebhookData, WebhookClientOptions, WebhookType, Payload }; export { WebhookData, WebhookClientOptions, WebhookType, Payload, Embed, EmbedFooter, EmbedField, EmbedAuthor };