mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-12-22 12:11:06 +01:00
refactor: new structure
This commit is contained in:
parent
a5f1742918
commit
23a8fd94c4
28 changed files with 434 additions and 191 deletions
4
assets/github.toml
Normal file
4
assets/github.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
repositories = [
|
||||
"oven-sh/bun",
|
||||
"xHyroM/bun-discord-bot"
|
||||
]
|
10
assets/tags/bug.md
Normal file
10
assets/tags/bug.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
keywords:
|
||||
- bug
|
||||
- report
|
||||
- bugs
|
||||
---
|
||||
|
||||
Found a bug in bun?
|
||||
- If you are unsure, first discuss your bug in <#887787428973281300> or <#995247410794217553>
|
||||
- [Open an issue on GitHub](<https://github.com/oven-sh/bun/issues/new?template=1-bug-report.yml>) and fill out the given template
|
7
assets/tags/bun.md
Normal file
7
assets/tags/bun.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
keywords: [ bun, bun.sh ]
|
||||
---
|
||||
|
||||
Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.
|
||||
|
||||
Read more [here](<https://bun.sh/>)
|
10
assets/tags/feature-request.md
Normal file
10
assets/tags/feature-request.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
keywords:
|
||||
- feature-request
|
||||
- feature
|
||||
- request
|
||||
---
|
||||
|
||||
Any idea what to add to bun?
|
||||
- Please consider if this is a request for bun, not for other 3rd party packages
|
||||
- [Open an issue on GitHub](<https://github.com/oven-sh/bun/issues/new?template=2-feature-request.yml>) and fill out the given template
|
17
assets/tags/illegal-instruction.md
Normal file
17
assets/tags/illegal-instruction.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
keywords:
|
||||
- "illegal-instruction"
|
||||
- "core-dumped"
|
||||
- "dumped"
|
||||
- "core"
|
||||
- "illegal"
|
||||
---
|
||||
|
||||
**Illegal instruction - core dumped**
|
||||
|
||||
Update to latest version using:
|
||||
```sh
|
||||
curl https://bun.sh/install | bash
|
||||
```
|
||||
|
||||
or install latest *-baseline build from [GitHub Releases](<https://github.com/oven-sh/bun/releases>)
|
24
assets/tags/io-uring-is-not-supported.md
Normal file
24
assets/tags/io-uring-is-not-supported.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
keywords:
|
||||
- "io-uring-is-not-supported"
|
||||
- "io uring"
|
||||
- "kernel"
|
||||
- "update"
|
||||
- "linux"
|
||||
---
|
||||
|
||||
**error: Linux kernel version doesn't support io_uring, which Bun depends on**
|
||||
|
||||
To fix this error, you need to update Linux kernel.
|
||||
If you are using the Windows Subsystem for Linux, do:
|
||||
**1.** Open powershell as administrator
|
||||
**2.** Run:
|
||||
- wsl --set-version <disto name> 2
|
||||
- If it throws `Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.`, turn on Virtual Machine Platform in Windows Features and then rerun this command.
|
||||
- PS: You can get distro name from `wsl --list -v`
|
||||
- wsl --update
|
||||
- wsl --shutdown
|
||||
|
||||
If that doesn't work (and you're on a Windows machine), try this:
|
||||
**1.** Open Windows Update
|
||||
**2.** Download any updates to Windows Subsystem for Linux
|
13
assets/tags/nix.md
Normal file
13
assets/tags/nix.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
keywords:
|
||||
- "nix"
|
||||
- "nixos"
|
||||
---
|
||||
|
||||
To use Bun on NixOS, you must install it through the nix package manager using [the `bun` package in nixpkgs](<https://search.nixos.org/packages?channel=unstable&show=bun&from=0&size=1&sort=relevance&type=packages&query=bun>):
|
||||
|
||||
```sh
|
||||
nix-env -iA nixos.bun
|
||||
```
|
||||
|
||||
Using `bun upgrade` or the curl installer will not work because NixOS does not provide `ld.so` which means any non-nixos linux executables will not work (you'll see "File not found" when trying to run them, even though the binary is there).
|
7
assets/tags/tags.md
Normal file
7
assets/tags/tags.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
keywords:
|
||||
- tags
|
||||
- contributing
|
||||
---
|
||||
|
||||
To create or update tag, check [xHyroM/bun-discord-bot#contributing-tags](<https://github.com/xHyroM/bun-discord-bot/#contributing-tags>)
|
9
assets/tags/ts.md
Normal file
9
assets/tags/ts.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
keywords:
|
||||
- "ts"
|
||||
- "typescript"
|
||||
- "tsc"
|
||||
---
|
||||
|
||||
Bun supports TypeScript and JSX out of the box. They can be run directly with [`bun run`](<https://bun.sh/docs/cli/run>).
|
||||
For setting up IDE support, [documentation page on TypeScript](<https://bun.sh/docs/runtime/typescript>)
|
8
assets/tags/windows.md
Normal file
8
assets/tags/windows.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
keywords:
|
||||
- "windows"
|
||||
- "windows support"
|
||||
---
|
||||
|
||||
Bun does not currently have support for Windows, so you must use WSL (Windows Subsystem for Linux).
|
||||
To install WSL, check [microsoft documentation](<https://docs.microsoft.com/en-us/windows/wsl/install>)
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -1,4 +0,0 @@
|
|||
repositories = [
|
||||
"oven-sh/bun",
|
||||
"xHyroM/bun-discord-bot"
|
||||
]
|
|
@ -1,90 +0,0 @@
|
|||
[bun]
|
||||
keywords = ["bun", "bun.sh"]
|
||||
content = """
|
||||
Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.
|
||||
|
||||
Read more [here](<https://bun.sh/>)
|
||||
"""
|
||||
|
||||
[bug]
|
||||
keywords = ["bug", "report", "bugs"]
|
||||
content = """
|
||||
Found a bug in bun?
|
||||
- If you are unsure, first discuss your bug in <#887787428973281300> or <#995247410794217553>
|
||||
- [Open an issue on GitHub](<https://github.com/oven-sh/bun/issues/new?template=1-bug-report.yml>) and fill out the given template
|
||||
"""
|
||||
|
||||
[feature-request]
|
||||
keywords = ["feature-request", "feature", "request"]
|
||||
content = """
|
||||
Any idea what to add to bun?
|
||||
- Please consider if this is a request for bun, not for other 3rd party packages
|
||||
- [Open an issue on GitHub](<https://github.com/oven-sh/bun/issues/new?template=2-feature-request.yml>) and fill out the given template
|
||||
"""
|
||||
|
||||
[tags]
|
||||
keywords = ["tags", "contributing"]
|
||||
content = """
|
||||
To create or update tag, check [xHyroM/bun-discord-bot#contributing-tags](<https://github.com/xHyroM/bun-discord-bot/#contributing-tags>)
|
||||
"""
|
||||
|
||||
[windows]
|
||||
keywords = ["windows", "windows support"]
|
||||
content = """
|
||||
Bun does not currently have support for Windows, so you must use WSL (Windows Subsystem for Linux).
|
||||
To install WSL, check [microsoft documentation](<https://docs.microsoft.com/en-us/windows/wsl/install>)
|
||||
"""
|
||||
|
||||
[io-uring-is-not-supported]
|
||||
keywords = ["io-uring-is-not-supported", "io uring", "not supported", "support", "linux", "kernel", "update"]
|
||||
content = """
|
||||
**error: Linux kernel version doesn't support io_uring, which Bun depends on**
|
||||
|
||||
To fix this error, you need to update Linux kernel.
|
||||
If you are using the Windows Subsystem for Linux, do:
|
||||
**1.** Open powershell as administrator
|
||||
**2.** Run:
|
||||
- wsl --set-version <disto name> 2
|
||||
- If it throws `Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.`, turn on Virtual Machine Platform in Windows Features and then rerun this command.
|
||||
- PS: You can get distro name from `wsl --list -v`
|
||||
- wsl --update
|
||||
- wsl --shutdown
|
||||
|
||||
If that doesn't work (and you're on a Windows machine), try this:
|
||||
**1.** Open Windows Update
|
||||
**2.** Download any updates to Windows Subsystem for Linux
|
||||
"""
|
||||
|
||||
[illegal-instruction]
|
||||
keywords = ["illegal-instruction", "core-dumped", "dumped", "core", "illegal"]
|
||||
content = """
|
||||
**Illegal instruction - core dumped**
|
||||
|
||||
Update to latest version using:
|
||||
+++
|
||||
curl https://bun.sh/install | bash
|
||||
+++
|
||||
|
||||
or install latest *-baseline build from [GitHub Releases](<https://github.com/oven-sh/bun/releases>)
|
||||
"""
|
||||
|
||||
# common questions
|
||||
|
||||
[ts] # 'how do i use typescript or jsx?'
|
||||
keywords = ["ts", "typescript", "tsc"]
|
||||
content = """
|
||||
Bun supports TypeScript and JSX out of the box. They can be run directly with [`bun run`](<https://bun.sh/docs/cli/run>).
|
||||
For setting up IDE support, [documentation page on TypeScript](<https://bun.sh/docs/runtime/typescript>)
|
||||
"""
|
||||
|
||||
[nix] # 'it doesnt work on nixos'
|
||||
keywords = ["nix", "nixos"]
|
||||
content = """
|
||||
To use Bun on NixOS, you must install it through the nix package manager using [the `bun` package in nixpkgs](<https://search.nixos.org/packages?channel=unstable&show=bun&from=0&size=1&sort=relevance&type=packages&query=bun>):
|
||||
|
||||
+++
|
||||
nix-env -iA nixos.bun
|
||||
+++
|
||||
|
||||
Using `bun upgrade` or the curl installer will not work because NixOS does not provide `ld.so` which means any non-nixos linux executables will not work (you'll see "File not found" when trying to run them, even though the binary is there).
|
||||
"""
|
|
@ -10,6 +10,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@paperdave/logger": "^3.0.1",
|
||||
"discord.js": "^14.11.0"
|
||||
"discord.js": "^14.13.0",
|
||||
"zlib-sync": "^0.1.8"
|
||||
}
|
||||
}
|
||||
|
|
276
pnpm-lock.yaml
Normal file
276
pnpm-lock.yaml
Normal file
|
@ -0,0 +1,276 @@
|
|||
lockfileVersion: '6.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
'@paperdave/logger':
|
||||
specifier: ^3.0.1
|
||||
version: 3.0.1
|
||||
discord.js:
|
||||
specifier: ^14.13.0
|
||||
version: 14.13.0
|
||||
zlib-sync:
|
||||
specifier: ^0.1.8
|
||||
version: 0.1.8
|
||||
|
||||
devDependencies:
|
||||
bun-types:
|
||||
specifier: ^0.7.0
|
||||
version: 0.7.0
|
||||
|
||||
packages:
|
||||
|
||||
/@discordjs/builders@1.6.5:
|
||||
resolution: {integrity: sha512-SdweyCs/+mHj+PNhGLLle7RrRFX9ZAhzynHahMCLqp5Zeq7np7XC6/mgzHc79QoVlQ1zZtOkTTiJpOZu5V8Ufg==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dependencies:
|
||||
'@discordjs/formatters': 0.3.2
|
||||
'@discordjs/util': 1.0.1
|
||||
'@sapphire/shapeshift': 3.9.2
|
||||
discord-api-types: 0.37.50
|
||||
fast-deep-equal: 3.1.3
|
||||
ts-mixer: 6.0.3
|
||||
tslib: 2.6.2
|
||||
dev: false
|
||||
|
||||
/@discordjs/collection@1.5.3:
|
||||
resolution: {integrity: sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dev: false
|
||||
|
||||
/@discordjs/formatters@0.3.2:
|
||||
resolution: {integrity: sha512-lE++JZK8LSSDRM5nLjhuvWhGuKiXqu+JZ/DsOR89DVVia3z9fdCJVcHF2W/1Zxgq0re7kCzmAJlCMMX3tetKpA==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dependencies:
|
||||
discord-api-types: 0.37.50
|
||||
dev: false
|
||||
|
||||
/@discordjs/rest@2.0.1:
|
||||
resolution: {integrity: sha512-/eWAdDRvwX/rIE2tuQUmKaxmWeHmGealttIzGzlYfI4+a7y9b6ZoMp8BG/jaohs8D8iEnCNYaZiOFLVFLQb8Zg==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dependencies:
|
||||
'@discordjs/collection': 1.5.3
|
||||
'@discordjs/util': 1.0.1
|
||||
'@sapphire/async-queue': 1.5.0
|
||||
'@sapphire/snowflake': 3.5.1
|
||||
'@vladfrangu/async_event_emitter': 2.2.2
|
||||
discord-api-types: 0.37.50
|
||||
magic-bytes.js: 1.0.15
|
||||
tslib: 2.6.2
|
||||
undici: 5.22.1
|
||||
dev: false
|
||||
|
||||
/@discordjs/util@1.0.1:
|
||||
resolution: {integrity: sha512-d0N2yCxB8r4bn00/hvFZwM7goDcUhtViC5un4hPj73Ba4yrChLSJD8fy7Ps5jpTLg1fE9n4K0xBLc1y9WGwSsA==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dev: false
|
||||
|
||||
/@discordjs/ws@1.0.1:
|
||||
resolution: {integrity: sha512-avvAolBqN3yrSvdBPcJ/0j2g42ABzrv3PEL76e3YTp2WYMGH7cuspkjfSyNWaqYl1J+669dlLp+YFMxSVQyS5g==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dependencies:
|
||||
'@discordjs/collection': 1.5.3
|
||||
'@discordjs/rest': 2.0.1
|
||||
'@discordjs/util': 1.0.1
|
||||
'@sapphire/async-queue': 1.5.0
|
||||
'@types/ws': 8.5.5
|
||||
'@vladfrangu/async_event_emitter': 2.2.2
|
||||
discord-api-types: 0.37.50
|
||||
tslib: 2.6.2
|
||||
ws: 8.13.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@paperdave/logger@3.0.1:
|
||||
resolution: {integrity: sha512-sLl/oM6U5KUU1bLzjDzshsJnrlGEPT7J0BFMqYr6HzX0RJbsKgRf4XRJgXsusT+rFDfOSHrJAootuImlt8q/9A==}
|
||||
engines: {node: '>=16'}
|
||||
dependencies:
|
||||
'@paperdave/utils': 1.8.0
|
||||
ansi-escapes: 6.2.0
|
||||
chalk: 5.3.0
|
||||
strip-ansi: 7.1.0
|
||||
dev: false
|
||||
|
||||
/@paperdave/utils@1.8.0:
|
||||
resolution: {integrity: sha512-/1ckfqC0migr4GjtFhpqNUIgPibign4kRMmEzGsZ6hilvQ0cbL8Hu96ZzvM/matlOK4tOeEj9aH4f1Bip8AH1A==}
|
||||
engines: {node: '>=16'}
|
||||
dependencies:
|
||||
utility-types: 3.10.0
|
||||
yaml: 2.3.1
|
||||
dev: false
|
||||
|
||||
/@sapphire/async-queue@1.5.0:
|
||||
resolution: {integrity: sha512-JkLdIsP8fPAdh9ZZjrbHWR/+mZj0wvKS5ICibcLrRI1j84UmLMshx5n9QmL8b95d4onJ2xxiyugTgSAX7AalmA==}
|
||||
engines: {node: '>=v14.0.0', npm: '>=7.0.0'}
|
||||
dev: false
|
||||
|
||||
/@sapphire/shapeshift@3.9.2:
|
||||
resolution: {integrity: sha512-YRbCXWy969oGIdqR/wha62eX8GNHsvyYi0Rfd4rNW6tSVVa8p0ELiMEuOH/k8rgtvRoM+EMV7Csqz77YdwiDpA==}
|
||||
engines: {node: '>=v14.0.0', npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
lodash: 4.17.21
|
||||
dev: false
|
||||
|
||||
/@sapphire/snowflake@3.5.1:
|
||||
resolution: {integrity: sha512-BxcYGzgEsdlG0dKAyOm0ehLGm2CafIrfQTZGWgkfKYbj+pNNsorZ7EotuZukc2MT70E0UbppVbtpBrqpzVzjNA==}
|
||||
engines: {node: '>=v14.0.0', npm: '>=7.0.0'}
|
||||
dev: false
|
||||
|
||||
/@types/node@20.5.3:
|
||||
resolution: {integrity: sha512-ITI7rbWczR8a/S6qjAW7DMqxqFMjjTo61qZVWJ1ubPvbIQsL5D/TvwjYEalM8Kthpe3hTzOGrF2TGbAu2uyqeA==}
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
|
||||
/@types/ws@8.5.5:
|
||||
resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@types/node': 20.5.3
|
||||
dev: false
|
||||
|
||||
/@vladfrangu/async_event_emitter@2.2.2:
|
||||
resolution: {integrity: sha512-HIzRG7sy88UZjBJamssEczH5q7t5+axva19UbZLO6u0ySbYPrwzWiXBcC0WuHyhKKoeCyneH+FvYzKQq/zTtkQ==}
|
||||
engines: {node: '>=v14.0.0', npm: '>=7.0.0'}
|
||||
dev: false
|
||||
|
||||
/ansi-escapes@6.2.0:
|
||||
resolution: {integrity: sha512-kzRaCqXnpzWs+3z5ABPQiVke+iq0KXkHo8xiWV4RPTi5Yli0l97BEQuhXV1s7+aSU/fu1kUuxgS4MsQ0fRuygw==}
|
||||
engines: {node: '>=14.16'}
|
||||
dependencies:
|
||||
type-fest: 3.13.1
|
||||
dev: false
|
||||
|
||||
/ansi-regex@6.0.1:
|
||||
resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/bun-types@0.7.0:
|
||||
resolution: {integrity: sha512-jXFiYtwSUQtD/Y3LHRWeWNwhFaUYvcO96zI7y3gSPgTq+ozxXpuTGDxABLdIKmFc672Q7Qp/OgrfJFEjg4Mnkg==}
|
||||
dev: true
|
||||
|
||||
/busboy@1.6.0:
|
||||
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
|
||||
engines: {node: '>=10.16.0'}
|
||||
dependencies:
|
||||
streamsearch: 1.1.0
|
||||
dev: false
|
||||
|
||||
/chalk@5.3.0:
|
||||
resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==}
|
||||
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
|
||||
dev: false
|
||||
|
||||
/discord-api-types@0.37.50:
|
||||
resolution: {integrity: sha512-X4CDiMnDbA3s3RaUXWXmgAIbY1uxab3fqe3qwzg5XutR3wjqi7M3IkgQbsIBzpqBN2YWr/Qdv7JrFRqSgb4TFg==}
|
||||
dev: false
|
||||
|
||||
/discord.js@14.13.0:
|
||||
resolution: {integrity: sha512-Kufdvg7fpyTEwANGy9x7i4od4yu5c6gVddGi5CKm4Y5a6sF0VBODObI3o0Bh7TGCj0LfNT8Qp8z04wnLFzgnbA==}
|
||||
engines: {node: '>=16.11.0'}
|
||||
dependencies:
|
||||
'@discordjs/builders': 1.6.5
|
||||
'@discordjs/collection': 1.5.3
|
||||
'@discordjs/formatters': 0.3.2
|
||||
'@discordjs/rest': 2.0.1
|
||||
'@discordjs/util': 1.0.1
|
||||
'@discordjs/ws': 1.0.1
|
||||
'@sapphire/snowflake': 3.5.1
|
||||
'@types/ws': 8.5.5
|
||||
discord-api-types: 0.37.50
|
||||
fast-deep-equal: 3.1.3
|
||||
lodash.snakecase: 4.1.1
|
||||
tslib: 2.6.2
|
||||
undici: 5.22.1
|
||||
ws: 8.13.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/fast-deep-equal@3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
dev: false
|
||||
|
||||
/lodash.snakecase@4.1.1:
|
||||
resolution: {integrity: sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==}
|
||||
dev: false
|
||||
|
||||
/lodash@4.17.21:
|
||||
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
||||
dev: false
|
||||
|
||||
/magic-bytes.js@1.0.15:
|
||||
resolution: {integrity: sha512-bpRmwbRHqongRhA+mXzbLWjVy7ylqmfMBYaQkSs6pac0z6hBTvsgrH0r4FBYd/UYVJBmS6Rp/O+oCCQVLzKV1g==}
|
||||
dev: false
|
||||
|
||||
/nan@2.17.0:
|
||||
resolution: {integrity: sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==}
|
||||
dev: false
|
||||
|
||||
/streamsearch@1.1.0:
|
||||
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dev: false
|
||||
|
||||
/strip-ansi@7.1.0:
|
||||
resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
ansi-regex: 6.0.1
|
||||
dev: false
|
||||
|
||||
/ts-mixer@6.0.3:
|
||||
resolution: {integrity: sha512-k43M7uCG1AkTyxgnmI5MPwKoUvS/bRvLvUb7+Pgpdlmok8AoqmUaZxUUw8zKM5B1lqZrt41GjYgnvAi0fppqgQ==}
|
||||
dev: false
|
||||
|
||||
/tslib@2.6.2:
|
||||
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
|
||||
dev: false
|
||||
|
||||
/type-fest@3.13.1:
|
||||
resolution: {integrity: sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==}
|
||||
engines: {node: '>=14.16'}
|
||||
dev: false
|
||||
|
||||
/undici@5.22.1:
|
||||
resolution: {integrity: sha512-Ji2IJhFXZY0x/0tVBXeQwgPlLWw13GVzpsWPQ3rV50IFMMof2I55PZZxtm4P6iNq+L5znYN9nSTAq0ZyE6lSJw==}
|
||||
engines: {node: '>=14.0'}
|
||||
dependencies:
|
||||
busboy: 1.6.0
|
||||
dev: false
|
||||
|
||||
/utility-types@3.10.0:
|
||||
resolution: {integrity: sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg==}
|
||||
engines: {node: '>= 4'}
|
||||
dev: false
|
||||
|
||||
/ws@8.13.0:
|
||||
resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
peerDependencies:
|
||||
bufferutil: ^4.0.1
|
||||
utf-8-validate: '>=5.0.2'
|
||||
peerDependenciesMeta:
|
||||
bufferutil:
|
||||
optional: true
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
dev: false
|
||||
|
||||
/yaml@2.3.1:
|
||||
resolution: {integrity: sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==}
|
||||
engines: {node: '>= 14'}
|
||||
dev: false
|
||||
|
||||
/zlib-sync@0.1.8:
|
||||
resolution: {integrity: sha512-Xbu4odT5SbLsa1HFz8X/FvMgUbJYWxJYKB2+bqxJ6UOIIPaVGrqHEB3vyXDltSA6tTqBhSGYLgiVpzPQHYi3lA==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
nan: 2.17.0
|
||||
dev: false
|
39
src/Bient.ts
39
src/Bient.ts
|
@ -1,39 +0,0 @@
|
|||
import { info } from "@paperdave/logger";
|
||||
import { Client, ClientOptions } from "discord.js";
|
||||
import { redactToken } from "./utils";
|
||||
|
||||
export class Bient extends Client {
|
||||
public static instance: Bient;
|
||||
|
||||
constructor(options: ClientOptions) {
|
||||
super(options);
|
||||
|
||||
Bient.instance = this;
|
||||
}
|
||||
|
||||
public async load(): Promise<void> {
|
||||
info("Loading listeners and commands...");
|
||||
|
||||
const start = performance.now();
|
||||
|
||||
await this.loadListeners();
|
||||
await this.loadCommands();
|
||||
|
||||
const end = performance.now();
|
||||
|
||||
info(`Loaded listeners and commands in ${end - start}ms`);
|
||||
}
|
||||
|
||||
public async loadCommands(): Promise<void> {
|
||||
await import("./commands/Ping.ts");
|
||||
}
|
||||
|
||||
public async loadListeners(): Promise<void> {
|
||||
await import("./listeners/Ready.ts");
|
||||
}
|
||||
|
||||
public login(): Promise<string> {
|
||||
info(`Logging in using ${redactToken(process.env.BOT_TOKEN)}`);
|
||||
return super.login(process.env.BOT_TOKEN);
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
import { CommandInteraction } from "discord.js";
|
||||
import { Command } from "../decorators/Command";
|
||||
|
||||
@Command("ping")
|
||||
export class Ping {
|
||||
async run(context: CommandInteraction) {
|
||||
context.reply("Pong!");
|
||||
}
|
||||
}
|
1
src/commands/version.ts
Normal file
1
src/commands/version.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export default {};
|
|
@ -1,6 +0,0 @@
|
|||
import { ClientEvents } from "discord.js";
|
||||
import { Bient } from "../Bient";
|
||||
|
||||
export function Command(name: string) {
|
||||
return (constructor: Function, context: ClassDecoratorContext) => {};
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
import { ClientEvents } from "discord.js";
|
||||
import { Bient } from "../Bient";
|
||||
|
||||
export function Listener(event: keyof ClientEvents) {
|
||||
return (constructor: Function, context: ClassMethodDecoratorContext) => {
|
||||
const name = context as unknown as string;
|
||||
|
||||
Bient.instance.on.bind(Bient.instance)(event, (...args) =>
|
||||
constructor[name]([...args])
|
||||
);
|
||||
};
|
||||
}
|
13
src/index.ts
13
src/index.ts
|
@ -1,10 +1,9 @@
|
|||
import { GatewayIntentBits } from "discord.js";
|
||||
import { Bient } from "./Bient.ts";
|
||||
import "./loaders";
|
||||
|
||||
const client = new Bient({
|
||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
|
||||
});
|
||||
import { Bubu } from "./structs/Client.ts";
|
||||
|
||||
await client.load();
|
||||
// Make sure bubu will not crash
|
||||
process.on("unhandledRejection", console.error);
|
||||
process.on("uncaughtException", console.error);
|
||||
|
||||
client.login();
|
||||
Bubu.login(process.env.DISCORD_BOT_TOKEN).catch(console.error);
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
import { success } from "@paperdave/logger";
|
||||
import { Listener } from "../decorators/Listener";
|
||||
import { ArgsOf } from "../utils";
|
||||
|
||||
export class Ready {
|
||||
@Listener("ready")
|
||||
onReady([client]: ArgsOf<"ready">) {
|
||||
success(`Logged in as ${client.user?.tag}`);
|
||||
}
|
||||
}
|
9
src/listeners/ready.ts
Normal file
9
src/listeners/ready.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { defineListener } from "../loaders/listeners.ts";
|
||||
import { Events } from "discord.js";
|
||||
|
||||
defineListener({
|
||||
event: Events.ClientReady,
|
||||
run: (client) => {
|
||||
console.log("heeh");
|
||||
}
|
||||
})
|
2
src/loaders/commands.ts
Normal file
2
src/loaders/commands.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
import "../commands/version.ts";
|
||||
|
2
src/loaders/index.ts
Normal file
2
src/loaders/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
import "./commands.ts";
|
||||
import "./listeners.ts";
|
15
src/loaders/listeners.ts
Normal file
15
src/loaders/listeners.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { ClientEvents, Events } from "discord.js";
|
||||
import "../listeners/ready.ts";
|
||||
|
||||
interface Listener<E extends keyof ClientEvents> {
|
||||
event: E;
|
||||
run: (
|
||||
...args: ClientEvents[E]
|
||||
) => any;
|
||||
}
|
||||
|
||||
export const LISTENERS: Listener<keyof ClientEvents>[] = [];
|
||||
|
||||
export function defineListener<T extends Listener<keyof ClientEvents>>(listener: T) {
|
||||
LISTENERS.push(listener);
|
||||
}
|
12
src/structs/Client.ts
Normal file
12
src/structs/Client.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { Client, GatewayIntentBits, } from "discord.js";
|
||||
|
||||
export const Bubu = new Client({
|
||||
intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent
|
||||
//intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent | GatewayIntentBits.GuildMembers,
|
||||
//allowedMentions: {
|
||||
// parse: [],
|
||||
// repliedUser: false,
|
||||
//}
|
||||
});
|
||||
|
||||
Bubu.on("error", console.log);
|
13
src/utils.ts
13
src/utils.ts
|
@ -1,13 +0,0 @@
|
|||
import type { ClientEvents } from "discord.js";
|
||||
|
||||
export type ArgsOf<K extends keyof ClientEvents> = ClientEvents[K];
|
||||
|
||||
export const redactToken = (token: string): string => {
|
||||
return token
|
||||
.split(".")
|
||||
.map((part, index) => {
|
||||
if (index === 0) return part;
|
||||
return "*".repeat(part.length);
|
||||
})
|
||||
.join(".");
|
||||
};
|
Loading…
Reference in a new issue