Skip to content

Commit

Permalink
Merge pull request #17 from TimNekk/develop
Browse files Browse the repository at this point in the history
Added auto alembic
  • Loading branch information
TimNekk authored Mar 2, 2023
2 parents 0a32580 + 76042a2 commit 6ef44ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,38 @@ services:
context: .
working_dir: "/usr/src/app/${BOT_NAME:-tg_bot}"
volumes:
- .:/usr/src/app/${BOT_NAME:-tg_bot}
command: python3 -m bot
- .:/usr/src/app/${BOT_NAME:-tg_bot}
command: bash -c "alembic upgrade head && python3 -m bot"
restart: always
env_file:
- ".env"
depends_on:
- db
- redis
db:
condition: service_healthy
redis:
condition: service_started
networks:
- tg_bot
- tg_bot

db:
container_name: "${DB_CONTAINER_NAME:-db-container}"
image: postgres:14
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_NAME}
restart: always
ports:
- "${DB_EXPOSE_PORT:-5432}:5432"
networks:
- tg_bot
volumes:
- ./postgres:/var/lib/postgresql
healthcheck:
test: [ "CMD", "pg_isready", "-U", "${DB_USER}", "-d", "${DB_NAME}" ]
interval: 1s
timeout: 3s
retries: 5

redis:
container_name: "${REDIS_CONTAINER_NAME:-redis-container}"
Expand Down
4 changes: 2 additions & 2 deletions tgbot/models/user_tg.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ async def _execute_telegram_edit_action(self,
) -> types.Message | base.Boolean | None:
try:
return await action(*args, **kwargs)
except (exceptions.MessageToEditNotFound, exceptions.MessageCantBeEdited) as e:
except (exceptions.MessageToEditNotFound, exceptions.MessageCantBeEdited, exceptions.MessageNotModified) as e:
logger.debug(f"{self}: {e.match}")
raise e
except (exceptions.BotBlocked, exceptions.ChatNotFound, exceptions.UserDeactivated) as e:
logger.debug(f"{self}: {e.match}")
await self.update(is_banned=True).apply()
except (exceptions.TelegramAPIError, exceptions.MessageNotModified) as e:
except exceptions.TelegramAPIError as e:
logger.exception(f"{self}: {e}")
return None

Expand Down

0 comments on commit 6ef44ce

Please sign in to comment.