mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-22 06:31:06 +01:00
build: bump deps
This commit is contained in:
parent
45b9a027d5
commit
4136d52f67
3 changed files with 6 additions and 17 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -18,6 +18,6 @@
|
||||||
"algoliasearch": "^4.23.2",
|
"algoliasearch": "^4.23.2",
|
||||||
"bun-tracestrings": "github:oven-sh/bun.report",
|
"bun-tracestrings": "github:oven-sh/bun.report",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"lilybird": "^0.6.0"
|
"lilybird": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
21
src/util.ts
21
src/util.ts
|
@ -1,6 +1,6 @@
|
||||||
import { GuildMember } from "@lilybird/transformers";
|
import { GuildMember } from "@lilybird/transformers";
|
||||||
import { BUN_EMOJIS } from "./constants.ts";
|
import { BUN_EMOJIS } from "./constants.ts";
|
||||||
import { parse, formatMarkdown } from "bun-tracestrings";
|
import { parseAndRemap, formatMarkdown } from "bun-tracestrings";
|
||||||
|
|
||||||
const URL_REGEX = /\(\s*(https?:\/\/[^\s\[\]]+)\s*\)/gi;
|
const URL_REGEX = /\(\s*(https?:\/\/[^\s\[\]]+)\s*\)/gi;
|
||||||
|
|
||||||
|
@ -53,22 +53,11 @@ export function sliceIfStartsWith(input: string, startsWith: string) {
|
||||||
export async function getBunReportDetailsInMarkdown(
|
export async function getBunReportDetailsInMarkdown(
|
||||||
url: string
|
url: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const parsed = await parse(url);
|
const remap = await parseAndRemap(url);
|
||||||
|
if (!Array.isArray(remap.features)) remap.features = []; // temporary fix
|
||||||
|
|
||||||
const res = await fetch("https://bun.report/remap", {
|
let content = formatMarkdown(remap, {
|
||||||
method: "POST",
|
source: url,
|
||||||
body: url,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!res.ok) {
|
|
||||||
return `Failed to get details from bun.report: ${res.statusText}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const json = await res.json();
|
|
||||||
|
|
||||||
let content = formatMarkdown({
|
|
||||||
...parsed,
|
|
||||||
...json,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const match of content.matchAll(URL_REGEX)) {
|
for (const match of content.matchAll(URL_REGEX)) {
|
||||||
|
|
Loading…
Reference in a new issue