items part 1

This commit is contained in:
stjet
2024-08-06 08:06:31 +00:00
parent 9226debee2
commit 38c2700c2f
16 changed files with 429 additions and 26 deletions

View File

@@ -0,0 +1,12 @@
import type { AutocompleteInteraction } from "discord.js";
import { get_all_items } from "../../db";
export async function item_name_autocomplete(interaction: AutocompleteInteraction) {
return await interaction.respond((await get_all_items()).filter(
(item) => item.name.startsWith(interaction.options.getFocused(true).value)
).map(
(item) => ({ name: item.name, value: item.name })
));
}

2
commands/common/error.ts Normal file
View File

@@ -0,0 +1,2 @@
export class BotError extends Error {};