mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-10 01:08:07 +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",
|
||||
"bun-tracestrings": "github:oven-sh/bun.report",
|
||||
"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 { 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;
|
||||
|
||||
|
@ -53,22 +53,11 @@ export function sliceIfStartsWith(input: string, startsWith: string) {
|
|||
export async function getBunReportDetailsInMarkdown(
|
||||
url: 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", {
|
||||
method: "POST",
|
||||
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,
|
||||
let content = formatMarkdown(remap, {
|
||||
source: url,
|
||||
});
|
||||
|
||||
for (const match of content.matchAll(URL_REGEX)) {
|
||||
|
|
Loading…
Reference in a new issue