From 653516e53b555d14b2cbbb24cb0491d99f33bbd1 Mon Sep 17 00:00:00 2001 From: Igor <80823011+igorwastaken@users.noreply.github.com> Date: Sun, 4 Jan 2026 22:49:57 +0000 Subject: [PATCH 1/2] feat: add endpoint: `/v1/projects/@me/commands` --- .husky/post-checkout | 3 +++ .husky/post-commit | 3 +++ .husky/post-merge | 3 +++ .husky/pre-push | 3 +++ package.json | 1 + src/structs/Api.ts | 11 ++++++++++- 6 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 .husky/post-checkout create mode 100755 .husky/post-commit create mode 100755 .husky/post-merge create mode 100755 .husky/pre-push diff --git a/.husky/post-checkout b/.husky/post-checkout new file mode 100755 index 0000000..5abf8ed --- /dev/null +++ b/.husky/post-checkout @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs post-checkout "$@" diff --git a/.husky/post-commit b/.husky/post-commit new file mode 100755 index 0000000..b8b76c2 --- /dev/null +++ b/.husky/post-commit @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs post-commit "$@" diff --git a/.husky/post-merge b/.husky/post-merge new file mode 100755 index 0000000..726f909 --- /dev/null +++ b/.husky/post-merge @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs post-merge "$@" diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..5f26dc4 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs pre-push "$@" diff --git a/package.json b/package.json index 94c010e..246b620 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@types/node": "^20.5.9", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", + "discord-api-types": "^0.38.37", "eslint": "^8.48.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-jest": "^27.2.3", diff --git a/src/structs/Api.ts b/src/structs/Api.ts index 74aaf73..0090294 100644 --- a/src/structs/Api.ts +++ b/src/structs/Api.ts @@ -12,8 +12,9 @@ import { UserInfo, BotsResponse, ShortUser, - BotsQuery, + BotsQuery } from "../typings"; +import { type APIApplicationCommand } from 'discord-api-types/v10'; /** * Top.gg API Client for Posting stats or Fetching data @@ -130,6 +131,14 @@ export class Api extends EventEmitter { return stats; } + public async postCommands(commands: APIApplicationCommand[]) { + if (commands.length <= 0) throw new Error('Your application has no commands'); + + await this._request("POST", "/v1/projects/@me/commands", commands); + + return commands; + } + /** * Get your bot's stats * From 8ca748f81ae3663f994032af29d52ed260e7980d Mon Sep 17 00:00:00 2001 From: Igor <80823011+igorwastaken@users.noreply.github.com> Date: Mon, 5 Jan 2026 02:10:49 +0000 Subject: [PATCH 2/2] deleted husky generated files --- .husky/post-checkout | 3 --- .husky/post-commit | 3 --- .husky/post-merge | 3 --- .husky/pre-commit | 4 ---- .husky/pre-push | 3 --- src/structs/Api.ts | 4 ++-- 6 files changed, 2 insertions(+), 18 deletions(-) delete mode 100755 .husky/post-checkout delete mode 100755 .husky/post-commit delete mode 100755 .husky/post-merge delete mode 100755 .husky/pre-commit delete mode 100755 .husky/pre-push diff --git a/.husky/post-checkout b/.husky/post-checkout deleted file mode 100755 index 5abf8ed..0000000 --- a/.husky/post-checkout +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } -git lfs post-checkout "$@" diff --git a/.husky/post-commit b/.husky/post-commit deleted file mode 100755 index b8b76c2..0000000 --- a/.husky/post-commit +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } -git lfs post-commit "$@" diff --git a/.husky/post-merge b/.husky/post-merge deleted file mode 100755 index 726f909..0000000 --- a/.husky/post-merge +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } -git lfs post-merge "$@" diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 20d0d06..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npm run lint diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100755 index 5f26dc4..0000000 --- a/.husky/pre-push +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } -git lfs pre-push "$@" diff --git a/src/structs/Api.ts b/src/structs/Api.ts index 0090294..ddc583a 100644 --- a/src/structs/Api.ts +++ b/src/structs/Api.ts @@ -134,9 +134,9 @@ export class Api extends EventEmitter { public async postCommands(commands: APIApplicationCommand[]) { if (commands.length <= 0) throw new Error('Your application has no commands'); - await this._request("POST", "/v1/projects/@me/commands", commands); + const response = await this._request("POST", "/v1/projects/@me/commands", commands); - return commands; + return response; } /**