mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-10 01:08:07 +01:00
feat: load tags into cache
This commit is contained in:
parent
16fa2fc3e3
commit
97638dc032
16 changed files with 53 additions and 22 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
|
question: Found a bug in bun?
|
||||||
keywords:
|
keywords:
|
||||||
- bug
|
- "bug"
|
||||||
- report
|
- "report"
|
||||||
- bugs
|
- "bugs"
|
||||||
---
|
---
|
||||||
|
|
||||||
Found a bug in bun?
|
|
||||||
- If you are unsure, first discuss your bug in <#887787428973281300> or <#995247410794217553>
|
- 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
|
- [Open an issue on GitHub](<https://github.com/oven-sh/bun/issues/new?template=1-bug-report.yml>) and fill out the given template
|
|
@ -1,5 +1,8 @@
|
||||||
---
|
---
|
||||||
keywords: [ bun, bun.sh ]
|
question: What is bun?
|
||||||
|
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.
|
Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
|
question: Any idea what to add to bun?
|
||||||
keywords:
|
keywords:
|
||||||
- feature-request
|
- "feature-request"
|
||||||
- feature
|
- "feature"
|
||||||
- request
|
- "request"
|
||||||
---
|
---
|
||||||
|
|
||||||
Any idea what to add to bun?
|
|
||||||
- Please consider if this is a request for bun, not for other 3rd party packages
|
- 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
|
- [Open an issue on GitHub](<https://github.com/oven-sh/bun/issues/new?template=2-feature-request.yml>) and fill out the given template
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
question: "How to solve illegal instruction (core dumped) error?"
|
||||||
keywords:
|
keywords:
|
||||||
- "illegal-instruction"
|
- "illegal-instruction"
|
||||||
- "core-dumped"
|
- "core-dumped"
|
||||||
|
@ -6,9 +7,6 @@ keywords:
|
||||||
- "core"
|
- "core"
|
||||||
- "illegal"
|
- "illegal"
|
||||||
---
|
---
|
||||||
|
|
||||||
**Illegal instruction - core dumped**
|
|
||||||
|
|
||||||
Update to latest version using:
|
Update to latest version using:
|
||||||
```sh
|
```sh
|
||||||
curl https://bun.sh/install | bash
|
curl https://bun.sh/install | bash
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
question: How to upgrade linux kernel?
|
||||||
keywords:
|
keywords:
|
||||||
- "io-uring-is-not-supported"
|
- "io-uring-is-not-supported"
|
||||||
- "io uring"
|
- "io uring"
|
||||||
|
@ -6,9 +7,6 @@ keywords:
|
||||||
- "update"
|
- "update"
|
||||||
- "linux"
|
- "linux"
|
||||||
---
|
---
|
||||||
|
|
||||||
**error: Linux kernel version doesn't support io_uring, which Bun depends on**
|
|
||||||
|
|
||||||
To fix this error, you need to update Linux kernel.
|
To fix this error, you need to update Linux kernel.
|
||||||
If you are using the Windows Subsystem for Linux, do:
|
If you are using the Windows Subsystem for Linux, do:
|
||||||
**1.** Open powershell as administrator
|
**1.** Open powershell as administrator
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
question: "How to use bun on NixOS?"
|
||||||
keywords:
|
keywords:
|
||||||
- "nix"
|
- "nix"
|
||||||
- "nixos"
|
- "nixos"
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
|
question: "Where can i add new tag to bot?"
|
||||||
keywords:
|
keywords:
|
||||||
- tags
|
- "tags"
|
||||||
- contributing
|
- "contributing"
|
||||||
---
|
---
|
||||||
|
|
||||||
To create or update tag, check [xHyroM/bun-discord-bot#contributing-tags](<https://github.com/xHyroM/bun-discord-bot/#contributing-tags>)
|
To create or update tag, check [xHyroM/bun-discord-bot#contributing-tags](<https://github.com/xHyroM/bun-discord-bot/#contributing-tags>)
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
question: "Do i need compiler for typescript?"
|
||||||
keywords:
|
keywords:
|
||||||
- "ts"
|
- "ts"
|
||||||
- "typescript"
|
- "typescript"
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
|
question: "Where can i found windows version of bun?"
|
||||||
keywords:
|
keywords:
|
||||||
- "windows"
|
- "windows"
|
||||||
- "windows support"
|
- "windows support"
|
||||||
---
|
---
|
||||||
|
|
||||||
Bun does not currently have support for Windows, so you must use WSL (Windows Subsystem for Linux).
|
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>)
|
To install WSL, check [microsoft documentation](<https://docs.microsoft.com/en-us/windows/wsl/install>)
|
|
@ -11,6 +11,8 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@paperdave/logger": "^3.0.1",
|
"@paperdave/logger": "^3.0.1",
|
||||||
"discord.js": "^14.13.0",
|
"discord.js": "^14.13.0",
|
||||||
|
"glob": "^10.3.3",
|
||||||
|
"gray-matter": "^4.0.3",
|
||||||
"zlib-sync": "^0.1.8"
|
"zlib-sync": "^0.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import "./commands"
|
import "./loaders/tags.ts";
|
||||||
|
import "./commands";
|
||||||
import "./listeners";
|
import "./listeners";
|
||||||
|
|
||||||
import { Bubu } from "./structs/Client.ts";
|
import { Bubu } from "./structs/Client.ts";
|
||||||
|
|
22
src/loaders/tags.ts
Normal file
22
src/loaders/tags.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import matter from "gray-matter";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
import { globSync as glob } from "glob";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { Tag } from "../structs/Tag";
|
||||||
|
|
||||||
|
const tags = glob(join(__dirname, "..", "..", "data", "tags", "*.md"));
|
||||||
|
|
||||||
|
export const TAGS: Tag[] = [];
|
||||||
|
|
||||||
|
for (const tag of tags) {
|
||||||
|
const content = readFileSync(tag);
|
||||||
|
const frontMatter = matter(content);
|
||||||
|
|
||||||
|
TAGS.push({
|
||||||
|
question: frontMatter.data.question,
|
||||||
|
keywords: frontMatter.data.keywords,
|
||||||
|
answer: frontMatter.content
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(TAGS);
|
6
src/structs/Tag.ts
Normal file
6
src/structs/Tag.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export interface Tag {
|
||||||
|
question: string;
|
||||||
|
answer: string;
|
||||||
|
keywords: string[];
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
// "bun-types" is the important part
|
// "bun-types" is the important part
|
||||||
"types": ["bun-types"]
|
"types": ["bun-types"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue