TooGooToGo-Bot
TooGooToGo-Bot is a tool designed to help you stay informed about the availability of your favorite stores on the Too Good To Go platform. It sends notifications, allowing you to quickly find and purchase food products before they disappear.
Table of Contents
Installation
Prerequisites
Clone the Repository
git clone https://github.com/Achaak/toogoodtogo-bot.git
cd toogoodtogo-bot/
Configure Environment Variables
- Make a copy of the sample environment file and enter your parameters:
cp .env .env.local
- Open
.env.local
in a text editor and fill in the required information.
Install Dependencies
pnpm install
Build the Project
pnpm run build
Start the Application
pnpm start
Update
To update the application, follow these steps:
-
Get the latest files:
git pull
-
Install any new dependencies:
pnpm install
-
Rebuild the project:
pnpm run build
Configuration
Discord
### Discord
To set up Discord notifications, access the `.env.local` file in a text editor and provide the necessary value for the `NOTIFICATIONS_DISCORD_ENABLED` parameter.
#### Creating a Discord Webhook
1. Create a new Discord server or use an existing one.
2. Create a new channel
3. Create a new webhook in the channel settings and copy the URL provided. [See the Discord documentation for more information.](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks)
4. Open the `.env.local` file in a text editor and fill in the `NOTIFICATIONS_DISCORD_WEBHOOK_URL` parameter.
Telegram
### Telegram
To set up Telegram notifications, access the `.env.local` file in a text editor and provide the necessary value for the `NOTIFICATIONS_TELEGRAM_ENABLED` parameter.
To configure the bot, open the `.env.local` file in a text editor and specify the value for the `NOTIFICATIONS_TELEGRAM_BOT_TOKEN` parameter.
#### Creating a Telegram Bot
1. Open a Telegram chat with [BotFather](https://t.me/BotFather) and enter the **/start** command.
2. Select the **/newbot** command and follow the instructions to create a new bot. Take note of the token access provided.
3. Once your bot is created, multiple users can use it to receive notifications about their favorite stocks.
4. To start receiving notifications, send the **/start** command in your bot's conversation.
#### Commands
- **/start**: Starts Telegram notifications
- **/stop**: Stops Telegram notifications
- **/help**: Provides a list of usable commands
Desktop
### Desktop
To set up desktop notifications, access the `.env.local` file in a text editor and provide the necessary value for the `NOTIFICATIONS_DESKTOP_ENABLED` parameter.
Console
### Console
To set up console notifications, access the `.env.local` file in a text editor and provide the necessary value for the `NOTIFICATIONS_CONSOLE_ENABLED` parameter.
For clearing the console before each notification, open the `.env.local` file in a text editor and specify the value for the `NOTIFICATIONS_CONSOLE_CLEAR` parameter.
Run with Docker
You can also run the application using Docker. Follow these steps:
-
Build the Docker image:
docker build . -t <your desired username>/togoodtogobot
-
Run the Docker image:
docker run -p 3000:3000 -d <your desired username>/togoodtogobot
Run with PM2
PM2 allows you to install the bot on a server and receive notifications 24/7. Follow these steps:
-
Install PM2:
pnpm install pm2 -g
-
Start the server:
pm2 start start.sh
-
After logging in:
pm2 ls # to see the process_id
pm2 attach your_process_id
# Press Enter to submit your registration
Change Log
See the CHANGELOG.md file for the change log.
License
This project is licensed under the MIT License.