2023-04-19 23:38:09 +02:00

36 lines
855 B
Python

import os
from telegram.ext import Application
import logging
from commands import journal
import models
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
)
logger = logging.getLogger(__name__)
def main() -> None:
"""Run the bot."""
token = os.getenv("BOT_TOKEN")
db_path = os.getenv("DB_PATH")
models.set_db(db_path)
application = Application.builder().token(token).build()
application.add_handler(journal.JournalHandler("journal", models).handler)
# application.add_handler(CommandHandler("help", help_command))
# on non command i.e message - echo the message on Telegram
# application.add_handler(InlineQueryHandler(inline_query))
# Run the bot until the user presses Ctrl-C
application.run_polling()
if __name__ == "__main__":
main()