The unofficial Strauss Prime League Bot for sending push notifications via discord and telegram.
The bot is not intended to be self-hosted! The server IP of the PrimeBot has been exclusively whitelisted by the Prime League.
Requirements:
pip install virtualenvgit clone https://github.com/random-rip/primebot_backend.gitcd primebot_backend and checkout branch develop git checkout developvirtualenv venvsource venv/Scripts/activate.\venv\Scripts\activatepip install -r requirements.txt.env file from .env.example at the root folder and set variables according to your setup
DJANGO_SECRET_KEYDJANGO_DEBUGDJANGO_ALLOWED_HOSTSDISCORD_API_KEY from Discord DeveloperportalDISCORD_APP_CLIENT_ID from Discord DeveloperportalTELEGRAM_BOT_API_KEY from Telegram BotfatherFILES_FROM_STORAGELOGGING_DIRFERNET_SECRET_KEYSITE_ID.envpython manage.py migrateFor further information have a look at Contributing section at the end of the README.
app_prime_league contains models, commands and model communications (for example register_team)
Match: Relevant information about a matchPlayer: Relevant information about a player (e.g. UserID, summoner_name)Team: Relevant information about a team and registered communication platform(e.g. name, tag, picture,ScoutingWebsite: Holds all possible scouting websites (currently: op.gg, u.gg, xdx.gg,Suggestion: Suggestions of matchesSetting: settings of teams for notifications, language, etc.Comment: comments on matchesbots contains all relevant Discord and Telegram scripts, Language files, and the MessageDispatchercore contains the Prime League communication, parsing, comparing and updating
comparers: These classes take over the comparison between the database, TeamDataProcessorTemporaryMatchData.parsing (legacy): The classes take over the parsing of logs passed by the APIprocessors: The classes take over the interface between the data processing in python andprovider classes.providers: The classes take over the communication with the filesystem, the Prime League API (and theupdater: The classes take over updating matches and teams. In production, the updates take place inapi.py: The class provides a low level Prime League apitemporary_match_data.py: The class provides methods for converting the API data into Comparerstorage holds the API data as JSON files for developmentpython manage.py discord_bot - start Discordbotpython manage.py telegram_bot - start Telegrambotpython manage.py update_teams - synchronize teamspython manage.py update_matches - synchronize matchespython manage.py weekly_notifications - start weekly notificationspython manage.py runscript feedback - start feedbackpython manage.py runscript season_messages - start season notificationpython manage.py runscript debug - start debug./restart_bots.sh./run_bots.sh./update_matches.sh./update_teams.sh./weekly_notifications.sh./feedback.shAll shell scripts can be found under shell_scripts.
python manage.py test
Some tests refer to I18n and T10n and require compiled django.mo files. These must be created
with python manage.py compilemessages. This requires the external program gettext:
After that python manage.py test can be executed.
We have been working on a solution to reduce API requests in development from the very beginning. For this reason each
response of an API request is stored locally in a JSON file. Due to IP whitelisting it is not possible that
the API can be accessed for development. Under storage/ there are sample teams and matches. To use them, in
the .env you have to add
FILES_FROM_STORAGE="True"
After that the providers use the filesystem.
The files can have dependencies among each other (for example: in team_*.json there is a list of match_ids pointing to
calibration matches or matches from the starter div). For this reason, teams cannot be arbitrarily selected from
the storage completely (a team will still be registered incomplete).
Teams that can be fully registered from storage:
/start 183281 DEMACIA FOR WIN (BTZ) Swiss Starter/start 114250 eWolves Div 4.7/start 90935 404-multigaming Div 4.7Feel free to implement new features and create pull requests. Also feel free to create tickets for new features or bugs
even if you cannot implement or fix them. Also, it is not only about programming! We need feedback for features from
teams. Don’t hesitate to start a discussion below feature requests.
If you create a pull request, make sure that
develop andpython manage.py test does not fail.Join us on Discord if you have questions. :)
This project is licensed under the terms of the MIT license.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.