• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Hash functions in js

Technision

Active Member
Greetings dear sinusbot community. i have a question about encrypt strings and something else.

Have the integrated javascript support from sinusbot the ability to use the crypto function?

such like this?
JavaScript:
const crypto = require('crypto')

function encrypt(data) {
    return crypto.createhash('sha1').update(data).digest("hex")
}
 

Technision

Active Member
thank you but i have another solution always but i always have a other problem. I can't parse json keys that begins with numbers. How i can do it that i can get data in the key, that begins with numbers?
 

Multivitamin

Well-Known Member
Tier III
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
can you provide an example what you are trying to do and what you expect to come out?
 

Technision

Active Member
The key in the json response begins with 61 and i cant get the informations from the key object that begins with 61, there are a lot of information and i need these.
 

Lala Sabathil

Donor
is awesome!
Contributor
Insider
Tbh it would be nice if you share the solution.

Or might not seem like that, but it could help someone in the future
 

Technision

Active Member
The Solution is very simple but i have to search long in google.
Here is the solution:

If you want to use a variable in http request data you have to do the following:
In my Example of the script: https://pastebin.com/EcRnB8z1 on line 33
JavaScript:
engine.log("Script Test: " + data[`${keyPair}`].field.wtf)
 
Top