From 79144799f03b0d178d0b9a64d093ff6def99b199 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Sat, 13 Jan 2024 17:31:03 +0100 Subject: [PATCH] prepare template --- README.md | 4 +--- commands/generic/get.js | 26 -------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 commands/generic/get.js diff --git a/README.md b/README.md index fe2aabb..adb62e9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1 @@ -# L Pa So Discord-Bot - -Discord invite link [here](https://discord.com/api/oauth2/authorize?client_id=1184493544698810450&permissions=8&scope=bot%20applications.commands). +# A DiscordJS Template diff --git a/commands/generic/get.js b/commands/generic/get.js deleted file mode 100644 index f302ca5..0000000 --- a/commands/generic/get.js +++ /dev/null @@ -1,26 +0,0 @@ -import { SlashCommandBuilder } from 'discord.js'; - -export const data = new SlashCommandBuilder() - .setName('get') - .setDescription('Google GET Request.') - .addStringOption((option) => - option - .setName('api') - .setRequired(true) - .setAutocomplete(true) - .setDescription('Specify API to call GET.') - ); -export async function autocomplete(interaction) { - const APIs = ['serverlist', 'read-tournament', 'announcements']; - - const focused = interaction.options.getString('api'); - const filtered = APIs.filter((choice) => choice.startsWith(focused)); - - await interaction.respond(filtered.map((choice) => ({ name: choice, value: choice }))); -} -export async function execute(interaction) { - const endpoint = interaction.options.getString('api'); - const response = await fetch(`http://localhost:5173/api/${endpoint}`); - const text = await response.text(); - await interaction.reply({ content: text, ephemeral: true }); -}