build: update deps

This commit is contained in:
Jozef Steinhübl 2024-08-31 12:38:40 +02:00
parent 828a6eeb35
commit e2aab980d5
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
3 changed files with 22 additions and 12 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -10,17 +10,17 @@
"format:apply": "prettier . --write"
},
"devDependencies": {
"bun-types": "^1.1.21",
"bun-types": "^1.1.26",
"prettier": "3.3.3"
},
"dependencies": {
"@lilybird/handlers": "^0.6.0-beta.18",
"@lilybird/handlers": "0.6.0-beta.20",
"@lilybird/jsx": "0.3.0",
"@lilybird/transformers": "^0.4.1",
"@paperdave/logger": "^3.0.1",
"@purplet/serialize": "^2.0.0",
"@wolfram-alpha/wolfram-alpha-api": "^23.1004.144821-RELEASE",
"algoliasearch": "^4.24.0",
"algoliasearch": "^5.2.3",
"bun-tracestrings": "github:oven-sh/bun.report",
"gray-matter": "^4.0.3",
"lilybird": "^0.7.3"

View file

@ -1,14 +1,12 @@
import { AllowedMentionType, ApplicationCommandOptionType } from "lilybird";
import { $applicationCommand } from "../handler.ts";
import algoliasearch from "algoliasearch";
import { algoliasearch } from "algoliasearch";
import { safeSlice } from "../util.ts";
// @ts-expect-error It is callable, but algolia for some reason has a namespace with the same name
const algoliaClient = algoliasearch(
"2527C13E0N",
"4efc87205e1fce4a1f267cadcab42cb2",
);
const algoliaIndex = algoliaClient.initIndex("bun");
$applicationCommand({
name: "docs",
@ -29,12 +27,18 @@ $applicationCommand({
],
autocomplete: async (interaction) => {
const query = interaction.data.getFocused<string>().value;
const result = await algoliaIndex.search(query, {
hitsPerPage: 25,
const { results } = await algoliaClient.search({
requests: [
{
indexName: "bun",
query: query,
hitsPerPage: 25,
},
],
});
return interaction.showChoices(
result.hits.map((hit: any) => {
results[0].hits.map((hit: any) => {
const name = getHitName(hit);
return {
@ -50,11 +54,17 @@ $applicationCommand({
const query = interaction.data.getString("query");
const target = interaction.data.getUser("target");
const result = await algoliaIndex.search(query, {
hitsPerPage: 1,
const { results } = await algoliaClient.search({
requests: [
{
indexName: "bun",
query: query,
hitsPerPage: 1,
},
],
});
const hit = result.hits[0];
const hit = results[0].hits[0];
const url = hit.url;
const name = getHitName(hit);
const snippetContent = hit._snippetResult?.content?.value?.replace(