I have problem. I have discord bot which will return info to specific file when user will use command. I have website too but its another app. can i return bot file content to my website any way?? ask if you dont understand what i mean because its hard to explain
Welcome to the community! It is possible to link a bot to a website, though ideally you use the same Repl for both. You can have the bot send data to a file or db, and the website then read that file or db and host it. Could you provide the Repl links please?
here is bot code: https://replit.com/@nipatsuyt/friend-link-bot
here is website code: https://replit.com/@nipatsuyt/fr-website
i want that links.json file content will be shown in website
Just add an API to the repl with the website, and have a POST endpoint that you can attach a file too, and use aiohttp (assuming python) to post the file to your website.
I think i did something wrong but i can,t see content in website. Sat Apr 8 15:51:27 2023] 172.31.128.1:57536 [404]: GET /links.json - No such file or directory
I meant on the website host the file, not on the bot. And does links.json exist? Honestly you shouldn’t even need a website on the bot repl if you have another repl for a website.
i dont have website in bot repl
and yes, links.json exist
Which repl is this error coming from then?
in website repl. Bot not erroring
Well there is no links.json in the website repl, so of course it would error.
bruh, but its in bot repl. and i want to return information of it to website. You understand??
Yes, that is what we are trying to help you do, but you are taking none of our suggestions and instead giving us an obvious error…
Sorry bro, but im very noob at this because i just started about half year ago.
This is what should i do??
You can, or just put everything in a shared DB, which is json style anyway, and just don’t use files. (Although php has no replit module to make db interactions easy, like python does)
Okay, I will try it.
Update your Discord bot to create an API endpoint that exposes the contents of the file as JSON. You can use a library like Express.js to create the API endpoint.
I applied the same method one my website crackshere and get success.
thanks
Would be great except the bot is in python, if anything they should use flask, or stick with php.