Asleep
Asleep
Explore posts from servers
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
issue fixed ✅
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I must've been doing something wrong the first, time turbopack appears to fix it now
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I have time, gonna try again
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I can try that again.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I created a post in the Next support server.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I can't access the base class by itself either.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
Okay. It seems to appear when I initialize the Client.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I'm currently experimenting to see where exactly it's erroring. I don't think it's at import anymore. I've gotten it to import in an API route.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
Next.js 14.2.11. I am not using turbopack.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
Yeah, that’s what’s weird about it. I’ve tried reinstalling the package to no avail.
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
I'm trying to make a bot builder using Carbon. This is my interactions endpoint, and where it errors upon import.
import type { NextApiRequest, NextApiResponse } from "next";
import { db } from "~/server/db";
import { Client, ClientMode } from "@buape/carbon"
import CommandHandler from "~/server/discord/handler";

export async function POST(req: NextApiRequest, res: NextApiResponse) {
if (!req.body.data) return res.status(400);
const bot = await db.bot.findFirst({
where: {
"clientId": req.body.application_id
}
})
console.log(bot)
if (!bot) return res.status(401);
const client = new Client({
clientId: bot.clientId,
publicKey: bot.publicKey,
token: bot.token,
mode: ClientMode.Web
}, [
new CommandHandler()
])

await client.router.fetch(req.body)
}
import type { NextApiRequest, NextApiResponse } from "next";
import { db } from "~/server/db";
import { Client, ClientMode } from "@buape/carbon"
import CommandHandler from "~/server/discord/handler";

export async function POST(req: NextApiRequest, res: NextApiResponse) {
if (!req.body.data) return res.status(400);
const bot = await db.bot.findFirst({
where: {
"clientId": req.body.application_id
}
})
console.log(bot)
if (!bot) return res.status(401);
const client = new Client({
clientId: bot.clientId,
publicKey: bot.publicKey,
token: bot.token,
mode: ClientMode.Web
}, [
new CommandHandler()
])

await client.router.fetch(req.body)
}
23 replies
CCarbon
Created by Asleep on 9/17/2024 in #📌support
TypeError when importing any command or Client
23 replies