use adapter to make discord.js optional

This commit is contained in:
MapleLeaf
2021-12-25 20:05:35 -06:00
parent 4cf9049496
commit 6909336cac
18 changed files with 282 additions and 125 deletions

View File

@@ -1,6 +1,7 @@
import { Client } from "discord.js"
import "dotenv/config"
import React from "react"
import { DiscordJsAdapter } from "../src/discord-js-adapter"
import { Reacord } from "../src/main.js"
import { createCommandHandler } from "./command-handler.js"
import { Counter } from "./counter.js"
@@ -9,14 +10,17 @@ const client = new Client({
intents: ["GUILDS"],
})
const reacord = Reacord.create({ client, maxInstances: 2 })
const reacord = new Reacord({
adapter: new DiscordJsAdapter(client),
maxInstances: 2,
})
createCommandHandler(client, [
{
name: "counter",
description: "shows a counter button",
run: (interaction) => {
const reply = reacord.reply(interaction)
const reply = reacord.createCommandReply(interaction)
reply.render(<Counter onDeactivate={() => reply.deactivate()} />)
},
},