Bit.dev API Plugin not working

Ok, so I'm having a issue with my bot and I'm really struggling to figure out where I've gone wrong. So I started with the template using sapphire new and chose the typescript variation and full template, which has the api's. I then converted this bot template to work with Bit.dev as can be found here: https://bit.cloud/eventiva/bots/discord/helper/~code/helper.ts https://bit.cloud/eventiva/bots/discord/helper/~code/helper.app-root.ts It works fine to run the command, but it doesn't seem to be working for the plugins, and I'm really unsure what I should be doing differently. I'm importing the import '@sapphire/plugin-api/register'; and the server is listening true when I do a console.log(client.server.server.listening); Yet when I go to localhost:4000 or 127.0.0.1:4000 I can't seem to connect and I'm really dumbfounded. Any chance one of you can see something stupid I'm missing?
16 Replies
Favna
Favna•6mo ago
you set the prefix to v0/ so the main.ts will be 127.0.0.1:4000/v0. if that isnt it then it's probably bit.dev, many of such websites don't support discord bots outright. You're much better off developing on your own machine and then deploying to a VPS.
TGTGamer
TGTGamer•6mo ago
Runnning on Local Machine, Bit.Dev is just a build pipeline tool Will double check that isn't my problem 🙂
Favna
Favna•6mo ago
Oh ok. I've never heard of it. Why not stick to tsc or use one of the more common tools like tsup or swc?
TGTGamer
TGTGamer•6mo ago
Bit.Dev utilises TSC. It's component first build pipelines, so it is designed to handle components. Think of Lerna and your mono-repo tools and add a load of extra utilities on top 🙂
Favna
Favna•6mo ago
ig
TGTGamer
TGTGamer•6mo ago
Yeah going to v0/ didn't work for me Any suggestions, Is there an easy way to check the ports and such it's listening on?
Favna
Favna•6mo ago
im not sure then. I can assure you that the template in and of itself does work so if you really only changed it to bit.dev then there lies your problem. port usage depends on your OS so just consult google "how to check if a port is in use <os here>"
TGTGamer
TGTGamer•6mo ago
Yeah, that's why I was hoping for someone with a brain to help me because mines apparently not functioning hahahaha
Favna
Favna•6mo ago
Like I said I've never heard of bit.dev so I have no idea what they do in the background
TGTGamer
TGTGamer•6mo ago
Express works fine for me - so I'm really confused and wondering why express would work fine and sapphire would cause me issues
Favna
Favna•6mo ago
well first of all we do not use Express but node:http do commands and listeners work? where does bit.dev output JS files to? dist? something else? in memory?
TGTGamer
TGTGamer•6mo ago
Yeah commands and listeners work fine compiled to a dist and run from within the node_modules folder as a packaged app
Favna
Favna•6mo ago
so if commands and listeners work it's not a mistmatching directory that it reads from yeah I got no idea tbh
TGTGamer
TGTGamer•6mo ago
No worries. Worth a shot. I think it must be bit.dev causing an issue somewhere as the server.server.listening is returning true and it's showing a result when I check the server.server.routes so the routes are registering. Is there any way to check what port sapphire is trying to use?
Favna
Favna•6mo ago
4000 by default unless otherwise configured and you configured it to be 4000
TGTGamer
TGTGamer•6mo ago
Ta thank you 🙂