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",
"version": "1.2.5",
"version": "1.2.6",
"description": "Client for interacting with discord webhooks",
"author": "Navy.gif",
"license": "MIT",
@ -17,12 +17,15 @@
}
},
"files": [
"build/**/*"
"build/**/*",
"README.md"
],
"scripts": {
"build": "tsc --build --force && tsc --project tsconfig.cjs.json && node ./scripts/declareTypes.js",
"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"
},
"devDependencies": {

View File

@ -21,6 +21,25 @@ type WebhookData = {
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 = {
title?: string,
type?: string,
@ -28,9 +47,9 @@ type Embed = {
url?: string,
timestamp?: string,
color?: number,
// TODO: Finish types
// footer?: EmbedFooter,
footer?: EmbedFooter,
fields?: EmbedField[]
author?: EmbedAuthor,
}
type File = {
@ -53,4 +72,4 @@ type Payload = {
}
}
export { WebhookData, WebhookClientOptions, WebhookType, Payload };
export { WebhookData, WebhookClientOptions, WebhookType, Payload, Embed, EmbedFooter, EmbedField, EmbedAuthor };