mirror of
https://github.com/Balshgit/mosgortrans.git
synced 2025-09-11 13:00:40 +03:00
Compare commits
No commits in common. "5053ed9d70318207a24fe0c89e5ef7db38c2a5a4" and "8280e02aed21b0f1e52c3fc4333fed00a11a1ade" have entirely different histories.
5053ed9d70
...
8280e02aed
4
.github/workflows/check-lint.yml
vendored
4
.github/workflows/check-lint.yml
vendored
@ -23,13 +23,13 @@ jobs:
|
|||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.10.6'
|
python-version: '3.10'
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# ----- install & configure poetry -----
|
# ----- install & configure poetry -----
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Install poetry
|
- name: Install poetry
|
||||||
env: # Keep in sync with `POETRY_VERSION` in `Dockerfile`
|
env: # Keep in sync with `POETRY_VERSION` in `Dockerfile`
|
||||||
POETRY_VERSION: "1.2.0"
|
POETRY_VERSION: "1.1.14"
|
||||||
run: |
|
run: |
|
||||||
curl -sSL "https://install.python-poetry.org" | python -
|
curl -sSL "https://install.python-poetry.org" | python -
|
||||||
# Adding `poetry` to `$PATH`:
|
# 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
|
id: setup-python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.10.6'
|
python-version: '3.10'
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
# ----- install & configure poetry -----
|
# ----- install & configure poetry -----
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
- name: Install poetry
|
- name: Install poetry
|
||||||
env: # Keep in sync with `POETRY_VERSION` in `Dockerfile`
|
env: # Keep in sync with `POETRY_VERSION` in `Dockerfile`
|
||||||
POETRY_VERSION: "1.2.0"
|
POETRY_VERSION: "1.1.14"
|
||||||
run: |
|
run: |
|
||||||
curl -sSL "https://install.python-poetry.org" | python -
|
curl -sSL "https://install.python-poetry.org" | python -
|
||||||
# Adding `poetry` to `$PATH`:
|
# Adding `poetry` to `$PATH`:
|
||||||
|
@ -90,9 +90,7 @@ class TransportBot:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def morning_bus_mailing(
|
async def morning_bus_mailing(chat_ids: list[int] | None) -> None:
|
||||||
chat_ids: list[int] | None, show_keyboard: bool = False
|
|
||||||
) -> None:
|
|
||||||
if not chat_ids:
|
if not chat_ids:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -106,15 +104,10 @@ class TransportBot:
|
|||||||
'т19',
|
'т19',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
kwargs = {'reply_markup': TransportBot.get_keyboard()} if show_keyboard else {}
|
|
||||||
|
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
*[
|
*[
|
||||||
TransportBot.bot.send_message(
|
TransportBot.bot.send_message(
|
||||||
chat_id=chat_id,
|
chat_id=chat_id, text=text, parse_mode=types.ParseMode.HTML
|
||||||
text=text,
|
|
||||||
parse_mode=types.ParseMode.HTML,
|
|
||||||
**kwargs
|
|
||||||
)
|
)
|
||||||
for chat_id in chat_ids
|
for chat_id in chat_ids
|
||||||
]
|
]
|
||||||
|
@ -9,32 +9,25 @@ bot_cron_jobs = {
|
|||||||
'job': TransportBot.morning_bus_mailing,
|
'job': TransportBot.morning_bus_mailing,
|
||||||
'cron': [
|
'cron': [
|
||||||
{
|
{
|
||||||
'time': {
|
'trigger': 'cron',
|
||||||
'trigger': 'cron',
|
'day_of_week': 'mon-fri',
|
||||||
'day_of_week': 'mon-fri',
|
'hour': 8,
|
||||||
'hour': 8,
|
'minute': 59,
|
||||||
'minute': 59,
|
'second': 0,
|
||||||
'second': 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'time': {
|
'trigger': 'cron',
|
||||||
'trigger': 'cron',
|
'day_of_week': 'mon-fri',
|
||||||
'day_of_week': 'mon-fri',
|
'hour': 9,
|
||||||
'hour': 9,
|
'minute': 4,
|
||||||
'minute': 4,
|
'second': 0,
|
||||||
'second': 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'time': {
|
'trigger': 'cron',
|
||||||
'trigger': 'cron',
|
'day_of_week': 'mon-fri',
|
||||||
'day_of_week': 'mon-fri',
|
'hour': 9,
|
||||||
'hour': 9,
|
'minute': 9,
|
||||||
'minute': 9,
|
'second': 0,
|
||||||
'second': 0,
|
|
||||||
},
|
|
||||||
'kwargs_per_job': {'show_keyboard': True},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'func_kwargs': {
|
'func_kwargs': {
|
||||||
@ -61,11 +54,7 @@ class BotScheduler:
|
|||||||
return None
|
return None
|
||||||
for cron in cron_jobs['cron']:
|
for cron in cron_jobs['cron']:
|
||||||
self.scheduler.add_job(
|
self.scheduler.add_job(
|
||||||
cron_jobs['job'],
|
cron_jobs['job'], kwargs=cron_jobs.get('func_kwargs'), **cron
|
||||||
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}')
|
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 \
|
sshpass \
|
||||||
&& pip install --upgrade pip \
|
&& pip install --upgrade pip \
|
||||||
# Installing `poetry` package manager:
|
# Installing `poetry` package manager:
|
||||||
&& pip install poetry wheel\
|
&& pip install poetry \
|
||||||
# Cleaning cache:
|
# Cleaning cache:
|
||||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
||||||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
&& 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/
|
COPY --chown="$USER":"$USER" ./poetry.lock ./pyproject.toml /app/
|
||||||
|
|
||||||
# Installing requirements
|
# Installing requirements
|
||||||
RUN poetry --version \
|
RUN poetry version \
|
||||||
&& poetry run pip install -U pip \
|
&& poetry run pip install -U pip \
|
||||||
&& poetry install \
|
&& poetry install \
|
||||||
$(if [ "$USER" != 'root' ]; then echo '--no-dev'; fi) \
|
$(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