Skip to content
/ telebot-plugins Public template

Чат бот с подключаемыми новостными, поисковыми модулями, с админкой Django и возможностью администрировать группы. Chat bot project with plug-ins and application configuration via Dynaconf and Django. MSW

License

Notifications You must be signed in to change notification settings

SergeyMi37/telebot-plugins

Repository files navigation

telebot-plugins

Chat bot project with plug-ins and application configuration via Dynaconf

Документация

What's new

Currently supported plug-ins:

  • Interlocutor Giga Chat
  • Monitoring of IRIS servers
  • Reporter on issue from GitLab
  • Weather forecast /weather_list - list /weather_Moscow in Moscow for a day and 7 days based on the weather service https://open-meteo.com/en/docs#location_and_time and the reverse geocoding service https://nominatim.openstreetmap.org/reverse
  • Service for obtaining an article from Wikipedia. For example /wiki_Snow or /wiki_Снег or wiki_Снеговик
  • RSS news aggregation service. /news_list - list of feeds
  • Internet search service /inet /inet_ddg_ - so far only in the DuckDuckGo search engine
  • Administration module in groups deleting system information about entering and exiting groups, changing photos deleting a user from a group for writing prohibited words
  • Module for obtaining information from reference books of Russian regions codes and searching for a country by the beginning of the barcode

git clone https://github.com/SergeyMi37/telebot-plugins
cd telebot-plugins

Create virtual environment (optional)

python3 -m venv env-iin
source env-lin/bin/activate

# Create virtual environment for Windows
python -m venv env-win
source env-win/Scripts/activate

# Install all requirements:
pip install -r requirements.txt

Create .env file copy-paste this or just run cp doc/env_example .env Create dynaconf.yaml file copy-paste this or just run cp doc/dynaconf.example.yaml dynaconf.yaml, don't forget to change tokens:

Run migrations to setup SQLite database:

python manage.py makemigrations
python manage.py migrate

Create superuser to get access to admin panel:

python manage.py createsuperuser

or

# .env DJANGO_SUPERUSER_PASSWORD=demo
python manage.py createsuperuser --noinput --username adm --email [email protected] 

Run bot in polling mode:

python run_polling.py 

If you want to open Django admin panel which will be located on http://localhost:8000/tgadmin/:

python manage.py runserver

Утилиты командной строки

#  Статистика всех моделей Django:
python manage.py model_stats

#  Детальная информация о конкретной модели:
python manage.py check_model users.updates

#  Экспорт модели в файл json:
python manage.py model_import --model django_celery_beat.PeriodicTasks --file test.json --format json --import 0
# или
python manage.py model_import --model django_celery_beat.PeriodicTasks --file test.json --format json

#  Экспорт модели в файл csv (по умолчанию):
python manage.py model_import --model django_celery_beat.PeriodicTasks --file sysotiom.csv --format csv

#  Импорт модели из файла json в режиме --dry-run - сухой запуск, без реального импорта:
python manage.py model_import --model users.User --file users.json --format json --import 1 --dry-run

#  Импорт модели из файла json:
python manage.py model_import --model users.User --file users.json --format json --import 1

Run locally using docker-compose

If you want just to run all the things locally, you can use Docker-compose which will start all containers for you.

Docker-compose

To run all services (Django, Postgres, Redis, Celery) at once:

docker-compose up -d --build

Check status of the containers.

docker ps -a

To see all names of the container:

 docker-compose ps --services

Enter django shell:

docker exec -it dtb_bot bash

Create superuser for Django admin panel

python manage.py createsuperuser

or

python manage.py createsuperuser --noinput --username adm --email [email protected] # .env DJANGO_SUPERUSER_PASSWORD=demo

To see logs of the container:

docker logs -f

To see logs of the container bot:

 docker logs -f bot

Thanks to the author

https://github.com/ohld/django-telegram-bot

Check the example bot that uses the code from Main branch: t.me/djangotelegrambot

Features

Built-in Telegram bot methods:

  • /broadcast — send message to all users (admin command)
  • /export_users — bot sends you info about your users in .csv file (admin command)
  • /stats — show basic bot stats
  • /ask_for_location — log user location when received and reverse geocode it to get country, city, etc.

Content

About

Чат бот с подключаемыми новостными, поисковыми модулями, с админкой Django и возможностью администрировать группы. Chat bot project with plug-ins and application configuration via Dynaconf and Django. MSW

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages