How do I Link A JS File From A Discord Bot to my Website on a Separate Project?


#1

I’m working on a discord bot, and I want to create a page displaying realtime info on the bot such as CPU, uptime, and memory.
How do I link the javascript to my HTML on the other project?


#2

On your bot’s web server you need to create a listener to listen for a request to send the CPU results etc. Then in your HTML code make an Ajax request to the endpoint on your bot’s server to get the CPU etc.


#3

Or you simply make them on the same server to simplify this.


#4

You could make it on the same server but it would make it easier to send the readings. On the downside if you have a big website then you will probably run out of storage.


#5

Well, I made a api that runs on the js file.
Makes everything easier

It is still really messy but it works.