Code Monkey home page Code Monkey logo

Comments (8)

insertmike avatar insertmike commented on June 12, 2024

The reason the error is occurs even though the constant use_telegram is set to default is that the TeleBot object is being instantiated without check if it will be needed in trader.js:

const telBot = new TeleBot({
    token: telegramToken, // Required. Telegram Bot API token.
    polling: { // Optional. Use polling.
     ...

And inside the telebot.js, the constructor has the following check:

        if (!cfg.token || cfg.token.split(':').length !== 2) {
            throw Error('[bot.error] invalid bot token');
        }

The cfg.token default value fails because the default cfg_token value is not in the expected format.

Possible Solutions are:

  • Dirty Solution
    To add one single double point : character in the default value of cfg.token in telebot.js.
  • A Better Solution
    To move config constant preferences such as use_telegram and other on the top of trader.js and for the telegram bot case, to add checks if the value is true. This way is not only cleaner but provides a better performance as it does not call constructors which will then not be used through the lifetime of the application.

I would personally go for the better solution. I will issue a pull request shortly.

from node-binance-trader.

bitcoinvsalts avatar bitcoinvsalts commented on June 12, 2024

I reverted the last commit from the PR that caused the issue for now. Please feel free to try again.

from node-binance-trader.

bitcoinvsalts avatar bitcoinvsalts commented on June 12, 2024

@Plasto13 could you please take a look at this issue?

from node-binance-trader.

insertmike avatar insertmike commented on June 12, 2024

Hello @jsappme I contacted @Plasto13 in the Discord Channel stated in the README.md file about this issue. I also forked the repository and will introduce a pull request to fix the issue shortly.

from node-binance-trader.

bitcoinvsalts avatar bitcoinvsalts commented on June 12, 2024

Perfect. Thank you. @insertmike

from node-binance-trader.

insertmike avatar insertmike commented on June 12, 2024

Hello @jsappme the content I added has been successfully added, thanks for approving the request. However some part of the merging has not been successful, for example missing dependencies because of the revert of commit id 094e2f2f480fe180a33ed1e4117da2156dcc45e6. I am fixing it shortly and will create another pull request. Sorry!

from node-binance-trader.

bitcoinvsalts avatar bitcoinvsalts commented on June 12, 2024

from node-binance-trader.

insertmike avatar insertmike commented on June 12, 2024

Great! Now it is all up and running. I am closing this issue as its solution is commited in pull request #41 and #42.

from node-binance-trader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.