Package does not run in browsers.
It happens for the next line, find in index.js file:
const majorVersion = parseInt(process.versions.node.split('.')[0], 10);
Because node is undefined in process, it throws an exception and does not start.
This package is not meant to run in browsers.
This is only for node.js, as it needs, e.g., to keep a server open for webhooks. It does not need a webpage to run.
Moreover this is not UMD package, but only CommonJS. This mean that in browsers many things will still miss. Like module.export.
Thank you for your answer.
With babel + webpack, it run perfect in a browser except for the issue I comment.
I suspected you were trying to use webpack and Babel to transpile it.
Anyway, the package was not born to run in browsers. Also, which is the sense to make it run there?
Moreover, if you run your app there, you are probably going to expose publicly your Bot token.
Yes, I know that is not the purpose of the package.
But I need it for that, and I found the method for do it.
Its for that I think it would be useful for another person.
I don't know if this would be right. I mean, the edit might also get accepted. And then? We can say we support browsers? I don't think this is suitable for this library. This should be more suitable for, likely, a fork of this project instead.
As I said, if say that this is suitable to be run in browsers, and people begin to run itthere which put knowing what this could mean, it might believe responsibility of the token gets exposed and stolen.
@kamikazechaser what do you think?
The package will run in the browser but is not really meant to, unless you can securely handle the token which is upto the user. Best case is that you can make a bot playground for testing methods with it.
Most helpful comment
I don't know if this would be right. I mean, the edit might also get accepted. And then? We can say we support browsers? I don't think this is suitable for this library. This should be more suitable for, likely, a fork of this project instead.
As I said, if say that this is suitable to be run in browsers, and people begin to run itthere which put knowing what this could mean, it might believe responsibility of the token gets exposed and stolen.
@kamikazechaser what do you think?