This commit is contained in:
Brieuc Dubois 2023-05-19 21:36:12 +02:00
parent 45767dada9
commit 9f0bf8cf16
2 changed files with 10 additions and 6 deletions

View File

@ -2,11 +2,12 @@ FROM python:3
WORKDIR /tg2 WORKDIR /tg2
COPY main.py .
COPY config.py .
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir pip && \ RUN pip install --no-cache-dir pip && \
pip install --no-cache-dir -r requirements.txt pip install --no-cache-dir -r requirements.txt
COPY main.py .
COPY config.py .
CMD ["python", "main.py"] CMD ["python", "main.py"]

View File

@ -21,6 +21,10 @@ async def main():
client = TgtgClient(**credentials) client = TgtgClient(**credentials)
bot = telegram.Bot(config.telegram_token)
async with bot:
await bot.send_message(chat_id=config.telegram_id, text='tg² bot is watching!')
last = [] last = []
@ -38,7 +42,7 @@ async def main():
amount = item["items_available"] amount = item["items_available"]
name = item["item"]["name"] name = item["item"]["name"]
price = item["item"]["price_including_taxes"]["minor_units"]/(10**item["item"]["price_including_taxes"]["decimals"]) price = item["item"]["price_including_taxes"]["minor_units"]/(10**item["item"]["price_including_taxes"]["decimals"])
store = item["store"]["store_name"] store = item["store"]["store_name"] + ' (' + item["store"]["branch"] + ')'
if not name: if not name:
name = "Panier anti-gaspi" name = "Panier anti-gaspi"
@ -57,7 +61,6 @@ async def main():
if len(texts) > 1: if len(texts) > 1:
bot = telegram.Bot(config.telegram_token)
print(f'\n{datetime.datetime.now()}: {len(texts)-1} new items available') print(f'\n{datetime.datetime.now()}: {len(texts)-1} new items available')