From 50e0f8d27d3afedf34905c5b2a0c22244bb328fd Mon Sep 17 00:00:00 2001 From: cirroskais Date: Mon, 4 Mar 2024 21:05:04 -0500 Subject: [PATCH] Initial commit --- .dockerignore | 6 ++ .env.example | 3 + .github/workflows/image.yml | 62 +++++++++++++ .gitignore | 175 ++++++++++++++++++++++++++++++++++++ .prettierrc | 4 + Dockerfile | 9 ++ LICENSE | 21 +++++ README.md | 7 ++ bun.lockb | Bin 0 -> 6438 bytes package.json | 17 ++++ src/index.ts | 1 + tsconfig.json | 27 ++++++ 12 files changed, 332 insertions(+) create mode 100644 .dockerignore create mode 100644 .env.example create mode 100644 .github/workflows/image.yml create mode 100644 .gitignore create mode 100644 .prettierrc create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100755 bun.lockb create mode 100644 package.json create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ed2432f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.gitignore +LICENSE +README.md +data +bin \ No newline at end of file diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..2298efa --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +DISCORD_ID= +DISCORD_TOKEN= +DISCORD_SECRET= \ No newline at end of file diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..9880a52 --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,62 @@ +name: Build Docker image + +on: + push: + branches: ["master"] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 + with: + cosign-release: "v2.1.1" + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b1ee42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,175 @@ +# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore + +# Logs + +logs +_.log +npm-debug.log_ +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Caches + +.cache + +# Diagnostic reports (https://nodejs.org/api/report.html) + +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# Runtime data + +pids +_.pid +_.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover + +lib-cov + +# Coverage directory used by tools like istanbul + +coverage +*.lcov + +# nyc test coverage + +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +.grunt + +# Bower dependency directory (https://bower.io/) + +bower_components + +# node-waf configuration + +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +build/Release + +# Dependency directories + +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) + +web_modules/ + +# TypeScript cache + +*.tsbuildinfo + +# Optional npm cache directory + +.npm + +# Optional eslint cache + +.eslintcache + +# Optional stylelint cache + +.stylelintcache + +# Microbundle cache + +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history + +.node_repl_history + +# Output of 'npm pack' + +*.tgz + +# Yarn Integrity file + +.yarn-integrity + +# dotenv environment variable files + +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) + +.parcel-cache + +# Next.js build output + +.next +out + +# Nuxt.js build / generate output + +.nuxt +dist + +# Gatsby files + +# Comment in the public line in if your project uses Gatsby and not Next.js + +# https://nextjs.org/blog/next-9-1#public-directory-support + +# public + +# vuepress build output + +.vuepress/dist + +# vuepress v2.x temp and cache directory + +.temp + +# Docusaurus cache and generated files + +.docusaurus + +# Serverless directories + +.serverless/ + +# FuseBox cache + +.fusebox/ + +# DynamoDB Local files + +.dynamodb/ + +# TernJS port file + +.tern-port + +# Stores VSCode versions used for testing VSCode extensions + +.vscode-test + +# yarn v2 + +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..222861c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b2875ce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM oven/bun:1 AS base + +WORKDIR /usr/src/app + +COPY . . + +RUN bun install --production + +ENTRYPOINT [ "bun", "run", "src/index.ts" ] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ec6fbe7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 MadHouse Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ad2e048 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# bot-template + +A Discord bot template made in [Bun](https://bun.sh/), using [Discordeno](https://discordeno.js.org) + +## Usage + +lmao diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..7655fa052286accc9f080304b57b09591a16062a GIT binary patch literal 6438 zcmeHLd010d7JrFR5fl)qBGnPp(z+xeVKE>e?hD8#iY$VRge-(5fxMR>GGb6^Q7a5O zE(~rcIBso0lxi8#&x%w)5VrwbfOaY>i&{`xu{h@@x$vxlOr7uR{Nc@abKZUT{(kqI z^Ul5RzBA66t0I+Lp-j#d%hgswmD~_2J5muEA(2Ij*%E~^DuiOIZ4H?OK}_^_o#bRY za^vzRmW1Th=h0MSK5l5hjcRH%l~9@bBX7wV-SNF%sk4HC@* zRXZ-f%qwN?z12G!cA5B8om}d8$;)8uxe`;0B8D*Bv#>cjy@+VYs9;Wu&kf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~7MOCaBIxk>=ubL_I6_p0|07PvI{yW5lz?7*?**g_5i zdQheTf9V@Akp18n4bCCpZ+Zh}WC$fDsqU-;&H^yIFg}0<^)xtN(A^`_&x11z%&sHp zZ#7^tF2h)q&8Pzjp48xM1d|cW1Fh{|*SZ_?+B{usIA?-$7>Lc0W5?kUID3M#8QpBJ z+km{BMev{@cqfef^5t`rqcU?wuswK(M-W$_2O?2( z#lhSs;C9h=Yw#5hRHw<_;2QnVV4(E<=E(dx990v~1 z_6-1kS_>v7s<#_g;FGzE4bQ`?%IDYq!Z~~KuB*YVSUltDoPef(rLpeDw=fWa+PAK zjHHxt9C>t9ILT2crQFwWTsBvWXTL!`4kcanhTBxESWL-7LL+;br)v!GcU`l!3lp*S zf~0Gx^9C>=FZQHiAGwg%Kp7-{2a|4J0KD#k4V!{J#CP9KfoBM46dG^vDB_{pErrO5 z4TPZC1bX#C(jC3X zR7i=V=Pl5Y$=TY6*b5o~@B{C<)>81Dv<}jB$`vB9exg{i7rL%7*f6vkA)dEm&=i0| zg00)%`1S~?l8a=avbP#S9|kn^CR@9~Y2!w>3+Z;AUR2T=t=&L?s=EP1cJKqGbbHhP H-~WFA#^WIz literal 0 HcmV?d00001 diff --git a/package.json b/package.json new file mode 100644 index 0000000..6486979 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "bot-template", + "module": "src/index.ts", + "devDependencies": { + "@discordeno/types": "^19.0.0-next.d81b28a", + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "type": "module", + "dependencies": { + "@discordeno/bot": "^19.0.0-next.d81b28a", + "@discordeno/rest": "^19.0.0-next.d81b28a", + "@discordeno/utils": "^19.0.0-next.d81b28a" + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..2a5e4b8 --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +console.log("Hello via Bun!"); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..0fef23a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +}