diff --git a/packages/reacord/package.json b/packages/reacord/package.json index 1fe0b58..30f386b 100644 --- a/packages/reacord/package.json +++ b/packages/reacord/package.json @@ -39,8 +39,8 @@ "build-watch": "pnpm build -- --watch", "test": "vitest --coverage --no-watch", "test-dev": "vitest", + "test-manual": "nodemon --exec tsx --ext ts,tsx ./scripts/discordjs-manual-test.tsx", "typecheck": "tsc --noEmit", - "playground": "nodemon --exec esmo --ext ts,tsx --inspect=5858 --enable-source-maps ./playground/main.tsx", "release": "bash scripts/release.sh" }, "dependencies": { @@ -65,9 +65,6 @@ "c8": "^7.11.2", "discord.js": "^14.0.3", "dotenv": "^16.0.0", - "esbuild": "latest", - "esbuild-jest": "^0.5.0", - "esmo": "^0.14.1", "lodash-es": "^4.17.21", "nodemon": "^2.0.15", "prettier": "^2.6.2", @@ -75,6 +72,7 @@ "react": "^18.0.0", "release-it": "^14.14.2", "tsup": "^5.12.6", + "tsx": "^3.8.0", "type-fest": "^2.12.2", "typescript": "^4.6.3", "vite": "^2.9.5", diff --git a/packages/reacord/playground/command-handler.ts b/packages/reacord/playground/command-handler.ts deleted file mode 100644 index 795b0ae..0000000 --- a/packages/reacord/playground/command-handler.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { Client, CommandInteraction } from "discord.js" - -type Command = { - name: string - description: string - run: (interaction: CommandInteraction) => unknown -} - -export function createCommandHandler(client: Client, commands: Command[]) { - client.on("ready", async () => { - for (const command of commands) { - for (const guild of client.guilds.cache.values()) { - await client.application?.commands.create( - { - name: command.name, - description: command.description, - }, - guild.id, - ) - } - } - }) - - client.on("interactionCreate", async (interaction) => { - if (!interaction.isChatInputCommand()) return - - const command = commands.find( - (command) => command.name === interaction.commandName, - ) - if (command) { - try { - await command.run(interaction) - } catch (error) { - console.error(error) - } - } - }) -} diff --git a/packages/reacord/playground/counter.tsx b/packages/reacord/playground/counter.tsx deleted file mode 100644 index 562df12..0000000 --- a/packages/reacord/playground/counter.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import * as React from "react" -import { Button, Embed, EmbedField, EmbedTitle } from "../library/main" - -export function Counter(props: { onDeactivate: () => void }) { - const [count, setCount] = React.useState(0) - const [embedVisible, setEmbedVisible] = React.useState(false) - - return ( - <> - this button was clicked {count} times - {embedVisible && ( - - the counter - {count > 0 && ( - - {count % 2 === 0 ? "yes" : "no"} - - )} - - )} - {embedVisible && ( -