Skip to content

Commit

Permalink
Merge pull request #8 from NikitosKey/ref-text-locale
Browse files Browse the repository at this point in the history
Refactoring complete
  • Loading branch information
NikitosKey authored Dec 21, 2024
2 parents 8712a62 + d0afb24 commit 7edb9fd
Show file tree
Hide file tree
Showing 39 changed files with 1,723 additions and 628 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/python-poetry-code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: code-quality

on:
push:

jobs:
pylint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: install poetry
run: pipx install poetry

- name: Check pyproject.toml validity
run: poetry check --no-interaction

- name: Install deps
if: steps.cache-deps.cache-hit != 'true'
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction
- name: Analysing the code with pylint
run: poetry run pylint bot

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.13" ]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pipx install poetry

- name: Check pyproject.toml validity
run: poetry check --no-interaction

- name: Install deps
if: steps.cache-deps.cache-hit != 'true'
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction
- name: Test with pytest
run: |
poetry run pytest -v --cov=bot
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

[![Actions](https://github.com/NikitosKey/alcounting_bot/actions/workflows/main.yml/badge.svg)](https://github.com/NikitosKey/alcounting_bot/actions/workflows/main.yml)
[![code-quality](https://github.com/NikitosKey/alcounting_bot/actions/workflows/python-poetry-code-quality.yml/badge.svg)](https://github.com/NikitosKey/alcounting_bot/actions/workflows/python-poetry-code-quality.yml)

# Alcounting Telegram Bot

Expand All @@ -9,7 +8,8 @@ A bot designed to help manage parties and prevent organizers from going into the

- [Description](#description)
- [Guide](#Guide)
- [User Documentation](#user-documentation)
- [Documentation](#documentation)
- [Contributing](#contributing)

## Description

Expand Down
Empty file added bot/__init__.py
Empty file.
10 changes: 7 additions & 3 deletions bot/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"""
This module initializes and runs the bot application.
"""

import os
import logging
from telegram import Update
from telegram.ext import Application

from handlers import register_handlers
from bot.handlers import register_handlers

# Set up logging
logging.basicConfig(
Expand All @@ -18,12 +22,12 @@
def main() -> None:
"""Allow running a bot."""
# Create the Application and pass it your bot's token.
application = Application.builder().token(os.getenv('BOT_TOKEN')).build()
application = Application.builder().token(os.getenv("BOT_TOKEN")).build()

# Register all handlers
register_handlers(application)

# Run the bot until the user presses Ctrl-C
# Run the bot
application.run_polling(allowed_updates=Update.ALL_TYPES)


Expand Down
9 changes: 3 additions & 6 deletions bot/database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Module for database operations."""

from bot.database.database import Database
from bot.database.user import User
from bot.database.product import Product
from bot.database.order import Order

__all__ = [
'Database',
'User',
'Product',
'Order'
]
__all__ = ["Database", "User", "Product", "Order"]
Loading

0 comments on commit 7edb9fd

Please sign in to comment.