From 5626f0bf489cbc0fca5d92f66e8a8560cf430617 Mon Sep 17 00:00:00 2001 From: Toastie Date: Thu, 12 Sep 2024 17:51:40 +1200 Subject: [PATCH] Added core files --- .eslintignore | 2 + .eslintrc.json | 10 + .gitignore | 67 + .npmrc | 6 + .prettierignore | 3 + .prettierrc.json | 8 + .vscode/settings.json | 12 + globals.ts | 97 + package.json | 153 ++ pnpm-lock.yaml | 4919 +++++++++++++++++++++++++++++++++++++++++ tsconfig.eslint.json | 19 + tsconfig.json | 33 + v9.ts | 7 + 13 files changed, 5336 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 .vscode/settings.json create mode 100644 globals.ts create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 tsconfig.eslint.json create mode 100644 tsconfig.json create mode 100644 v9.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..107e418 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +CHANGELOG.md +*.d.ts \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..76a546e --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "extends": "marine/prettier/node", + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.eslint.json", + "extraFileExtensions": [ + ".mjs" + ] + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2aa26f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,67 @@ +node_modules/ + +# Custom ESLint rules +.eslintplugin/* +!.eslintplugin/index.ts +!.eslintplugin/tsconfig.json + +# Don't commit build outputs +globals.js +globals.*map +globals.d.ts +globals.mjs + +v*.js +v*.*map +v*.d.ts +v*.mjs + +deno/**/*.js +deno/**/*.map +deno/**/*.d.ts +deno/**/*.mjs + +gateway/**/*.js +gateway/**/*.map +gateway/**/*.d.ts +gateway/**/*.mjs + +payloads/**/*.js +payloads/**/*.map +payloads/**/*.d.ts +payloads/**/*.mjs + +rest/**/*.js +rest/**/*.map +rest/**/*.d.ts +rest/**/*.mjs + +rpc/**/*.js +rpc/**/*.map +rpc/**/*.d.ts +rpc/**/*.mjs + +shortcuts/**/*.js +shortcuts/**/*.map +shortcuts/**/*.d.ts +shortcuts/**/*.mjs + +utils/**/*.js +utils/**/*.map +utils/**/*.d.ts +utils/**/*.mjs + +voice/**/*.js +voice/**/*.map +voice/**/*.d.ts +voice/**/*.mjs + +valkyriechat/**/*.js +valkyriechat/**/*.map +valkyriechat/**/*.d.ts +valkyriechat/**/*.mjs + +!scripts/versions.mjs + +# macOS files +.DS_Store \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..ca1551c --- /dev/null +++ b/.npmrc @@ -0,0 +1,6 @@ +audit=false +fund=false +legacy-peer-deps=true +tag-version-prefix="" +git-tag-version=false +message="chore(release): %s 🎉" \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5040617 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +# Node modules +node_modules/ +CHANGELOG.md \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..5e50f5f --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "printWidth": 120, + "useTabs": true, + "singleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "all", + "endOfLine": "lf" +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0a01c8a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "files.eol": "\n", + "typescript.tsdk": "node_modules/typescript/lib", + "editor.codeActionsOnSave": { + "source.organizeImports": "never", + "source.fixAll": "explicit", + "source.fixAll.eslint": "explicit" + }, + "cSpell.enableFiletypes": [ + "mdx" + ] +} \ No newline at end of file diff --git a/globals.ts b/globals.ts new file mode 100644 index 0000000..f283b7c --- /dev/null +++ b/globals.ts @@ -0,0 +1,97 @@ +/** + * https://discord.com/developers/docs/reference#snowflakes + */ +export type Snowflake = string; + +/** + * https://discord.com/developers/docs/topics/permissions + * @internal + */ +export type Permissions = string; + +/** + * https://discord.com/developers/docs/reference#message-formatting-formats + */ +export const FormattingPatterns = { + /** + * Regular expression for matching a user mention, strictly without a nickname + * + * The `id` group property is present on the `exec` result of this expression + */ + User: /<@(?\d{17,20})>/, + /** + * Regular expression for matching a user mention, strictly with a nickname + * + * The `id` group property is present on the `exec` result of this expression + * @deprecated Passing `!` in user mentions is no longer necessary / supported, and future message contents won't have it + */ + UserWithNickname: /<@!(?\d{17,20})>/, + /** + * Regular expression for matching a user mention, with or without a nickname + * + * The `id` group property is present on the `exec` result of this expression + * @deprecated Passing `!` in user mentions is no longer necessary / supported, and future message contents won't have it + */ + UserWithOptionalNickname: /<@!?(?\d{17,20})>/, + /** + * Regular expression for matching a channel mention + * + * The `id` group property is present on the `exec` result of this expression + */ + Channel: /<#(?\d*)>/, + /** + * Regular expression for matching a role mention + * + * The `id` group property is present on the `exec` result of this expression + */ + Role: /<@&(?\d{17,20})>/, + /** + * Regular expression for matching a application command mention + * + * The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression + */ + SlashCommand: + /<\/(?(?[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?\d{17,20})>/u, + /** + * Regular expression for matching a custom emoji, either static or animated + * + * The `animated`, `name` and `id` group properties are present on the `exec` result of this expression + */ + Emoji: /<(?a)?:(?\w{2,32}):(?\d{17,20})>/, + /** + * Regular expression for matching strictly an animated custom emoji + * + * The `animated`, `name` and `id` group properties are present on the `exec` result of this expression + */ + AnimatedEmoji: /<(?a):(?\w{2,32}):(?\d{17,20})>/, + /** + * Regular expression for matching strictly a static custom emoji + * + * The `name` and `id` group properties are present on the `exec` result of this expression + */ + StaticEmoji: /<:(?\w{2,32}):(?\d{17,20})>/, + /** + * Regular expression for matching a timestamp, either default or custom styled + * + * The `timestamp` and `style` group properties are present on the `exec` result of this expression + */ + Timestamp: /-?\d{1,13})(:(?