Reputation: 18
I want to make a command for a bot to evaluate a string (run it as code). Is there a way to run a string as code in discord.js? Not rly having a code sample here, I just want to know of a function to do so.
Upvotes: 0
Views: 91
Reputation: 637
discord.js is using Node which uses Javascript, so your solution to evalute a code from a string should be with the eval()
method.
Eval on developer.mozilla.org
However, as soon as you implement eval()
, you'll soon find out that they have access to basically your whole computer. I would not recommend you to use this.
Upvotes: 1