Giter Club home page Giter Club logo

toogoodtogo-telegrambot's People

Contributors

torbenstriegel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

carleslc

toogoodtogo-telegrambot's Issues

Reduce API query if not needed

I had another idea to reduce the API access to the tgtg server side and not to provoke the 403 error (capture).

Currently the tgtg api is queried every 60 seconds (default) regardless of the settings in Telegram (/settings).
Before you start the loop, you could query the settings whether information is desired. If no information is required, the API is not queried and tgtg does not notice the bot.

Here is an untested draft:

def get_available_items_per_user(self):
    while True:
        try:
            if any(val == 1 for user_settings in self.users_settings_data.values() for val in user_settings.values()):
                # Führe die Abfragen nur aus, wenn mindestens eine Einstellung aktiviert ist
                temp_available_items = {}
                for key in self.users_login_data.keys():
                    self.connect(key)
                    time.sleep(1)
                    available_items = self.get_favourite_items()
                    for item in available_items:
                        status = "null"
                        item_id = item['item']['item_id']
                        # ... (Code davor)
                        if not status == "null":
                            temp_available_items[item_id] = status
                        self.available_items_favorites[item_id] = item
                        if item_id in temp_available_items and \
                                self.users_settings_data[key][temp_available_items[item_id]] == 1:
                            # ... (Code davor)
                            self.send_message_with_link(key, text, item_id)
                self.save_available_items_favorites_to_txt()
            time.sleep(60)
        except Exception as err:
            print(f"Unexpected {err=}, {type(err)=}")```

404 : Unsuccessful request to the Telegram API

Hello, thank you for having shared your project with the community ^^
But I'm facing an issue when trying to run the project.

Description

I've follow all the steps of installation and setup my telegram's access token bot in the config.ini file but an error is throw when I'm running the `python3 Telegram.py. Here is the error's detail :

telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 404. Description: Not Found

Screenshots

image

To Reproduce

  1. Create a virtual environment with an interpreter Python3.11
  2. Install the external libraries with the command pip install -r requirements.txt
  3. Fill the config.ini file with a telegram's bot token at the format 7XXXXXXXX6:AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-M
  4. Run the project with the command python3 Telegram.py

Login not possible

I installed the script on an RPi Buster.
At first it wasn't clear to me where I should enter the /start command.
You could add the reference to Telegram in the readme.

I can register my email address in TGTG via Telegram and also receive a verification email. Unfortunately it takes some time for the email from tgtg to arrive. Before the email arrives, a time of 120 seconds has expired in the script.
The script reports
"Exception ignored"
grafik

After I clicked the button in the email, TGTG wrote that I was logged in and that I should go back to the app.
grafik

With all further commands in Telegram I get the message that I should log in first
grafik

Where is the problem? Why can't I log in?

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.