mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-22 06:31:06 +01:00
build: update deps
This commit is contained in:
parent
828a6eeb35
commit
e2aab980d5
3 changed files with 22 additions and 12 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -10,17 +10,17 @@
|
||||||
"format:apply": "prettier . --write"
|
"format:apply": "prettier . --write"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bun-types": "^1.1.21",
|
"bun-types": "^1.1.26",
|
||||||
"prettier": "3.3.3"
|
"prettier": "3.3.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lilybird/handlers": "^0.6.0-beta.18",
|
"@lilybird/handlers": "0.6.0-beta.20",
|
||||||
"@lilybird/jsx": "0.3.0",
|
"@lilybird/jsx": "0.3.0",
|
||||||
"@lilybird/transformers": "^0.4.1",
|
"@lilybird/transformers": "^0.4.1",
|
||||||
"@paperdave/logger": "^3.0.1",
|
"@paperdave/logger": "^3.0.1",
|
||||||
"@purplet/serialize": "^2.0.0",
|
"@purplet/serialize": "^2.0.0",
|
||||||
"@wolfram-alpha/wolfram-alpha-api": "^23.1004.144821-RELEASE",
|
"@wolfram-alpha/wolfram-alpha-api": "^23.1004.144821-RELEASE",
|
||||||
"algoliasearch": "^4.24.0",
|
"algoliasearch": "^5.2.3",
|
||||||
"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.7.3"
|
"lilybird": "^0.7.3"
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
import { AllowedMentionType, ApplicationCommandOptionType } from "lilybird";
|
import { AllowedMentionType, ApplicationCommandOptionType } from "lilybird";
|
||||||
import { $applicationCommand } from "../handler.ts";
|
import { $applicationCommand } from "../handler.ts";
|
||||||
import algoliasearch from "algoliasearch";
|
import { algoliasearch } from "algoliasearch";
|
||||||
import { safeSlice } from "../util.ts";
|
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(
|
const algoliaClient = algoliasearch(
|
||||||
"2527C13E0N",
|
"2527C13E0N",
|
||||||
"4efc87205e1fce4a1f267cadcab42cb2",
|
"4efc87205e1fce4a1f267cadcab42cb2",
|
||||||
);
|
);
|
||||||
const algoliaIndex = algoliaClient.initIndex("bun");
|
|
||||||
|
|
||||||
$applicationCommand({
|
$applicationCommand({
|
||||||
name: "docs",
|
name: "docs",
|
||||||
|
@ -29,12 +27,18 @@ $applicationCommand({
|
||||||
],
|
],
|
||||||
autocomplete: async (interaction) => {
|
autocomplete: async (interaction) => {
|
||||||
const query = interaction.data.getFocused<string>().value;
|
const query = interaction.data.getFocused<string>().value;
|
||||||
const result = await algoliaIndex.search(query, {
|
const { results } = await algoliaClient.search({
|
||||||
hitsPerPage: 25,
|
requests: [
|
||||||
|
{
|
||||||
|
indexName: "bun",
|
||||||
|
query: query,
|
||||||
|
hitsPerPage: 25,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
return interaction.showChoices(
|
return interaction.showChoices(
|
||||||
result.hits.map((hit: any) => {
|
results[0].hits.map((hit: any) => {
|
||||||
const name = getHitName(hit);
|
const name = getHitName(hit);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -50,11 +54,17 @@ $applicationCommand({
|
||||||
const query = interaction.data.getString("query");
|
const query = interaction.data.getString("query");
|
||||||
const target = interaction.data.getUser("target");
|
const target = interaction.data.getUser("target");
|
||||||
|
|
||||||
const result = await algoliaIndex.search(query, {
|
const { results } = await algoliaClient.search({
|
||||||
hitsPerPage: 1,
|
requests: [
|
||||||
|
{
|
||||||
|
indexName: "bun",
|
||||||
|
query: query,
|
||||||
|
hitsPerPage: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const hit = result.hits[0];
|
const hit = results[0].hits[0];
|
||||||
const url = hit.url;
|
const url = hit.url;
|
||||||
const name = getHitName(hit);
|
const name = getHitName(hit);
|
||||||
const snippetContent = hit._snippetResult?.content?.value?.replace(
|
const snippetContent = hit._snippetResult?.content?.value?.replace(
|
||||||
|
|
Loading…
Reference in a new issue