toogoodtogo-bot
toogoodtogo-bot copied to clipboard
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 purc...
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
- Update
-
Configuration
- Discord
- Telegram
- Desktop
- Console
- Run with Docker
- Run with PM2
- Change Log
- License
Installation
Prerequisites
- Node.js (>=20.x.x)
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
-
Create a new Discord server or use an existing one.
-
Create a new channel
-
Create a new webhook in the channel settings and copy the URL provided. See the Discord documentation for more information.
-
Open the
.env.local
file in a text editor and fill in theNOTIFICATIONS_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
-
Open a Telegram chat with BotFather and enter the /start command.
-
Select the /newbot command and follow the instructions to create a new bot. Take note of the token access provided.
-
Once your bot is created, multiple users can use it to receive notifications about their favorite stocks.
-
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.