ytrevor81/TradingView-Binance-Telegram-Bot

Chat is

Closed this issue · 2 comments

hello
i get this issue after i install requirements
where should i put chat id ?

  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
    Traceback (most recent call last):
    File "/usr/local/bin/flask", line 8, in
    sys.exit(main())
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 967, in main
    cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 848, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 305, in init
    self._load_unlocked()
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 330, in _load_unlocked
    self._app = rv = self.loader()
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 392, in load_app
    app = locate_app(self, import_name, None, raise_if_not_found=False)
    File "/usr/local/lib/python3.8/dist-packages/flask/cli.py", line 240, in locate_app
    import(module_name)
    File "/root/TradingView-Binance-Telegram-Bot/app.py", line 8, in
    bot = MainBot() #Handles all telegram communication
    File "/root/TradingView-Binance-Telegram-Bot/bot.py", line 22, in init
    self.initial_chat_id_check() #checks if chat_id is already in the DB
    File "/root/TradingView-Binance-Telegram-Bot/bot.py", line 30, in initial_chat_id_check
    chat_id = DB.chat_id_check()
    File "/root/TradingView-Binance-Telegram-Bot/db_functions.py", line 20, in chat_id_check
    chat_id_tuple = self.c.execute("SELECT chat_id FROM user_info")
    sqlite3.OperationalError: no such table: user_info

Sorry this is my mistake. In development I got too caught up in creating my own SQLite tables using DB Browser. I updated db_functions.py and bot.py to create a table once the Telegram bot is active.

Rather than downloading the project again, I can show you where I made those changes:

in db_functions.py , the Database object calls the method initialize_db() in init :

dbpic

in bot.py, I placed the 'username' variable as a parameter to db.save_username() :

dbpic2

Also double check that all of your API and Telegram bot keys are ready to go in your config.py file, and that your Telegram bot is active.

Also don't forget to send the command /start to your Telegram bot first. That should save your Chat Id and your username.