generated from geekiot/python-template
Add [bot start]: add bot_token to start_bot & configure logger
This commit is contained in:
parent
a8d1104bbd
commit
1de731d7bc
2 changed files with 10 additions and 0 deletions
|
|
@ -1,11 +1,13 @@
|
|||
__all__ = ["start_bot"]
|
||||
|
||||
|
||||
from loguru import logger
|
||||
from redis.asyncio.client import Redis
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
|
||||
async def start_bot(
|
||||
bot_token: str,
|
||||
redis_client: Redis,
|
||||
database_session: AsyncSession,
|
||||
) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,13 +1,21 @@
|
|||
import asyncio
|
||||
|
||||
from config import settings, configure_logger
|
||||
from bot import start_bot
|
||||
from db import session
|
||||
from redis_client import client
|
||||
|
||||
|
||||
def main() -> None:
|
||||
configure_logger(
|
||||
file_log_level=settings.file_log_level,
|
||||
console_log_level=settings.console_log_level,
|
||||
listen_logging=True,
|
||||
)
|
||||
|
||||
asyncio.run(
|
||||
start_bot(
|
||||
bot_token=settings.bot_token,
|
||||
redis_client=client,
|
||||
database_session=session,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue