mirror of
https://github.com/Balshgit/mosgortrans.git
synced 2025-09-11 13:00:40 +03:00
Compare commits
5 Commits
8280e02aed
...
5053ed9d70
Author | SHA1 | Date | |
---|---|---|---|
5053ed9d70 | |||
c0f0124776 | |||
7506832fe6 | |||
672211695f | |||
c9e69b72cc |
4
.github/workflows/check-lint.yml
vendored
4
.github/workflows/check-lint.yml
vendored
@ -23,13 +23,13 @@ jobs:
|
||||
id: setup-python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.10.6'
|
||||
#----------------------------------------------
|
||||
# ----- install & configure poetry -----
|
||||
#----------------------------------------------
|
||||
- name: Install poetry
|
||||
env: # Keep in sync with `POETRY_VERSION` in `Dockerfile`
|
||||
POETRY_VERSION: "1.1.14"
|
||||
POETRY_VERSION: "1.2.0"
|
||||
run: |
|
||||
curl -sSL "https://install.python-poetry.org" | python -
|
||||
# Adding `poetry` to `$PATH`:
|
||||
|
4
.github/workflows/poetry-test.yml
vendored
4
.github/workflows/poetry-test.yml
vendored
@ -23,13 +23,13 @@ jobs:
|
||||
id: setup-python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.10.6'
|
||||
#----------------------------------------------
|
||||
# ----- install & configure poetry -----
|
||||
#----------------------------------------------
|
||||
- name: Install poetry
|
||||
env: # Keep in sync with `POETRY_VERSION` in `Dockerfile`
|
||||
POETRY_VERSION: "1.1.14"
|
||||
POETRY_VERSION: "1.2.0"
|
||||
run: |
|
||||
curl -sSL "https://install.python-poetry.org" | python -
|
||||
# Adding `poetry` to `$PATH`:
|
||||
|
@ -90,7 +90,9 @@ class TransportBot:
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
async def morning_bus_mailing(chat_ids: list[int] | None) -> None:
|
||||
async def morning_bus_mailing(
|
||||
chat_ids: list[int] | None, show_keyboard: bool = False
|
||||
) -> None:
|
||||
if not chat_ids:
|
||||
return None
|
||||
|
||||
@ -104,10 +106,15 @@ class TransportBot:
|
||||
'т19',
|
||||
],
|
||||
)
|
||||
kwargs = {'reply_markup': TransportBot.get_keyboard()} if show_keyboard else {}
|
||||
|
||||
await asyncio.gather(
|
||||
*[
|
||||
TransportBot.bot.send_message(
|
||||
chat_id=chat_id, text=text, parse_mode=types.ParseMode.HTML
|
||||
chat_id=chat_id,
|
||||
text=text,
|
||||
parse_mode=types.ParseMode.HTML,
|
||||
**kwargs
|
||||
)
|
||||
for chat_id in chat_ids
|
||||
]
|
||||
|
@ -9,25 +9,32 @@ bot_cron_jobs = {
|
||||
'job': TransportBot.morning_bus_mailing,
|
||||
'cron': [
|
||||
{
|
||||
'trigger': 'cron',
|
||||
'day_of_week': 'mon-fri',
|
||||
'hour': 8,
|
||||
'minute': 59,
|
||||
'second': 0,
|
||||
'time': {
|
||||
'trigger': 'cron',
|
||||
'day_of_week': 'mon-fri',
|
||||
'hour': 8,
|
||||
'minute': 59,
|
||||
'second': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
'trigger': 'cron',
|
||||
'day_of_week': 'mon-fri',
|
||||
'hour': 9,
|
||||
'minute': 4,
|
||||
'second': 0,
|
||||
'time': {
|
||||
'trigger': 'cron',
|
||||
'day_of_week': 'mon-fri',
|
||||
'hour': 9,
|
||||
'minute': 4,
|
||||
'second': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
'trigger': 'cron',
|
||||
'day_of_week': 'mon-fri',
|
||||
'hour': 9,
|
||||
'minute': 9,
|
||||
'second': 0,
|
||||
'time': {
|
||||
'trigger': 'cron',
|
||||
'day_of_week': 'mon-fri',
|
||||
'hour': 9,
|
||||
'minute': 9,
|
||||
'second': 0,
|
||||
},
|
||||
'kwargs_per_job': {'show_keyboard': True},
|
||||
},
|
||||
],
|
||||
'func_kwargs': {
|
||||
@ -54,7 +61,11 @@ class BotScheduler:
|
||||
return None
|
||||
for cron in cron_jobs['cron']:
|
||||
self.scheduler.add_job(
|
||||
cron_jobs['job'], kwargs=cron_jobs.get('func_kwargs'), **cron
|
||||
cron_jobs['job'],
|
||||
kwargs=dict(
|
||||
**cron_jobs.get('func_kwargs'), **cron.get('kwargs_per_job', {})
|
||||
),
|
||||
**cron['time'],
|
||||
)
|
||||
logger.info(f'Added scheduled job: {cron_jobs["job"].__name__} {cron}')
|
||||
|
||||
|
@ -30,7 +30,7 @@ RUN printf "================\n\nStart build app. USER is: "${USER}"\n\n=========
|
||||
sshpass \
|
||||
&& pip install --upgrade pip \
|
||||
# Installing `poetry` package manager:
|
||||
&& pip install poetry \
|
||||
&& pip install poetry wheel\
|
||||
# Cleaning cache:
|
||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
||||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
||||
@ -47,7 +47,7 @@ RUN if [ "$USER" != "root" ]; then \
|
||||
COPY --chown="$USER":"$USER" ./poetry.lock ./pyproject.toml /app/
|
||||
|
||||
# Installing requirements
|
||||
RUN poetry version \
|
||||
RUN poetry --version \
|
||||
&& poetry run pip install -U pip \
|
||||
&& poetry install \
|
||||
$(if [ "$USER" != 'root' ]; then echo '--no-dev'; fi) \
|
||||
|
734
poetry.lock
generated
734
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user