Laravel-Redis-Telegram Confession Bot. Receives "confessions" from Laravel, queues in Redis, and posts to Telegram.
Automated Confession poster for Telegram. Anonymous users can send their rants through the webpage, and it is queued. Every 5 minutes, 5 messages from the queue will be sent to the configured channel. Queueing is done in Redis, while frontend/backend is in Laravel. The API is yet to be utilized, but its in planning.
- PHP8.0 or later
- Redis (any ver i guess)
- Composer
- Nodejs 14 & NPM
- Telegram Bot Token (Get it from Botfather)
-
Clone the repository.
- For hosting purposes, copy ConfessWebnAPI to
/var/www/html/
- For hosting purposes, copy ConfessWebnAPI to
-
Initialize App
- copy .env.example to .env
- edit the parameters if needed, usually
APP_URL
andAPP_ENV
- run the following commands
composer update composer install npm install npm run build # Install packages php artisan key:generate php artisan migrate:fresh # yes if prompted to create database php artisan db:seed # creates a default user with an API Token
-
Setup Telegram Channel
- Create a new (or use existing) channel on Telegram.
- Enable discussions on the channel.
- Invite the bot as an Admin in the Channel.
- Retrieve the channelID by sending a request to
https://api.telegram.org/bot{botToken}/getUpdates
-
Connect Telegram Bot to backend
- Ensure redis is running.
- use
php artisan serve
OR properly host a webserver using nginx - open the root webpage, and use the webconfigurator to test connection for the Bot.
- API Token has no use yet. Ignore and finish setup.
-
Turn on Laravel Scheduler
- Edit cron using
crontab -e
- add a new entry as follows
* * * * * /path/to/php path/to/phpartisan schedule:run 1>> /dev/null 2>&1 # example * * * * * /usr/bin/php /var/www/html/ConfessWebnAPI/artisan schedule:run >> /dev/null 2>&1
- press ESC and :wq to exit out of vi
- Edit cron using
- Ensure docker is installed
- run
docker run -d -p 80:80 ghcr.io/arffsaad/confessionbot:main
- Go to
http://localhost
- Perform steps 3 & 4 as stated in normal setup. Step 5 is omitted since scheduler is automatically enabled.
For hosting purposes, use a reverse proxy such as nginx
- Users will be invited to the channel, Admins are set properly in the channel as well.
- Admins will be invited to the discussion group.
- Users submit confession through web interface
- 5 Confessions are sent every 5 minutes.