#Help linking my bot to the planet scale db
1 messages ยท Page 1 of 1 (latest)
Do you have a GH repo that you can share?
I'm so sorry, what's a gh repo?
Oh ok github. I don't think I do
What have you tried so far?
I've just read up on how I should go about moving it and gotten super confused and frustrated
What programming language are you using for your bot? And what are you trying to achieve with it?
I'm using JavaScript I do believe. I'm pretty sure autocode doesn't use it's own language. It's a discord bot that moderates and alot of other things. I think that was what you were asking
I know I'ma sound hella stupid rn but idk alot about coding and tech. I just learned the basics to build what I wanted to build and parroted it w/o truly understanding how it works
I don't have the needed in depth understanding of how code speaks to my bot to tell it what to do
I can understand the very basics like calling a dep that tells the bot to "do this" or "retrieve that" but that's about as deep as it goes
ok, so there is some ground to cover if you want to get this working. First, have you found any documentation on how to connect your bot to a database AND which database is recommended?
I've not really. I thought I had but turns out planet scale isn't what I need bc it's just a db and not a hosting server
It's technically a hosted DB. However it looks like autocode is more or less a hosting server, and you could connect to planetscale with a DB connector and the connection string Planetscale would provide. DO NOT hardcode that connection string though, you need to use secrets and environment variables to keep it secure.
Ok so I could link my bot and they would host it?
Planetscale can host your data. Autocode is hosting our bot.
I couldn't hard code something to something with a gun to my head.
Ok right so yeah I need a new host bc aurocodes a rip off since the last price change/hike
hard coding means putting the connection string directly in the javascript code.
Oh I think I get it. Pretty sure that's what they wanted me to do using this invite and inserting it into my bots .env file
yes
Ah, yeah I don't want that then
That is how you would do it. ??
Oh. So I could still use secrets and env ver ?
yeah, you get your connection string from Planetscale, and that will go in the .env file. Then inside the bot you use the secrets API to access that connection string. That makes the string a) secure - the app only sees it when it's running, and b) flexible - you can change the connection string in .env at any time, restart the app, and it's pointed to a new database or using an updated password, etc. --- WITHOUT having to change any application code.
If you aren't familiar with this, I highly recommend getting acquainted with the concepts behind all of this. It will give you a foundation to understand exactly what's going one.
This sounds like exactly what I want to do but you lost me towards the end.
When I try to put that string into the .env file it says the files read only
And everything after that just scrambled my eggs
This is the link they provide for environment variables https://docs.autocode.com/projects/environment-variables/
Autocode Documentation: Environment Variables
AND it's not helpful.
Nah, that wasn't helpful lol. I appreciate your help but this is just getting me more and more confused and I feel like I'm starting to be a nuisance so I'll just lay it down for now and eventually I'll get it figured out. I'm sorry for wasting your time but I did get one step closer by confirming that I will want to use that string to do what I'm trying to do. ๐๐