Ask coding questions

← Back to all posts
How to see ram and cpu usage
[deleted]

I am making a discord.js bot, and I was wondering if I can see how much ram and cpu usage I am using. I am hosting this off of repl, with some files and such. I have tried doing

but that does not work. any help?

Answered by PattanAhmed [earned 5 cycles]
View Answer
Voters
gamersroyal042
DynamicSquid
Comments
hotnewtop
PattanAhmed

@JohnS4 Hi,
I think this website might help you a lot.
Click here
Thanks!

Hope this helps

PattanAhmed

@JohnS4
Happy to help you!

Thanks!

[deleted]

Quick question. it worked. But it says this.

Are those my stats combined with other peoples, or are those my individual project stats?
@PattanAhmed

PattanAhmed

@JohnS4 I think combined!
Thanks!

WilliamPenrod

Based on your example, you're not specifying the channel to send it to. You need to set the "channel" id or use the reply function.
Eg: message.author.send(("Memory used in GB", ((usedMemory/ Math.pow(1024, 3)).toFixed(2)));
Also don't forget to add those missing semicolons :)

[deleted]

I dont need to specify which channel, it is in a client.on('message', async message => {}. And here is the image of what u said.

@WilliamPenrod

Coder100

why doesn't it work?

[deleted]

it says the text, but it says nothing after that. No errors or anything, it just leaves it blank. It worked too when i hosted it on my [email protected]

AmazingMech2418

I am not familiar with Discord.js, but your code to get the percentage is correct. (besides using var instead of let or const, but that's not to big of a deal... Just best-practice to prevent memory vulnerabilities) Maybe check out the Discord.js documentation?