1
0
Fork 0

Fix folder creation

This commit is contained in:
Ethanell 2019-12-27 13:02:41 +01:00
parent f90e69a979
commit a2b8dd76b7
3 changed files with 14 additions and 15 deletions

View file

@ -1,5 +1,6 @@
import datetime
from os.path import getmtime, isfile
from os import mkdir
from os.path import getmtime, isfile, isdir
import ics
import requests
@ -7,6 +8,10 @@ from aiogram.utils import markdown
from ics.parse import ParseError, string_to_container
from ics.timeline import Timeline
if not isdir("calendars"):
mkdir("calendars")
URL = "http://adelb.univ-lyon1.fr/jsp/custom/modules/plannings/anonymous_cal.jsp"
EMPTY_CALENDAR = "BEGIN:VCALENDAR\r\nPRODID:ics.py - http://git.io/lLljaA\r\nVERSION:2.0\r\nEND:VCALENDAR"

View file

@ -1,7 +1,4 @@
import datetime
import logging
from os import mkdir
from os.path import isdir, isfile
from os.path import isfile
from threading import RLock
from aiogram import Bot, Dispatcher, types
@ -14,14 +11,7 @@ from TelegramEDT.EDTcalendar import Calendar
from TelegramEDT.base import Base, User
from TelegramEDT.lang import lang
from TelegramEDT.logger import logger
tables = False
if not isdir("logs"):
mkdir("logs")
if not isdir("calendars"):
mkdir("calendars")
if not isfile("edt.db"):
tables = True
from TelegramEDT.modules import load_module, load_cmd, unload_cmd
if not isfile("token.ini"):
logger.critical("No token specified, impossible to start the bot !")
@ -36,7 +26,7 @@ dp = Dispatcher(bot)
engine = create_engine("sqlite:///edt.db")
Session = sessionmaker(bind=engine)
session = Session()
if tables:
if not isfile("edt.db"):
Base.metadata.create_all(engine)
dbL = RLock()
@ -57,7 +47,6 @@ def check_id(user: types.User):
session.commit()
from TelegramEDT.modules import load_module, load_cmd, unload_cmd
dp.register_message_handler(load_cmd, commands="load")
dp.register_message_handler(unload_cmd, commands="unload")

View file

@ -1,5 +1,10 @@
import logging
from logging import handlers
from os import mkdir
from os.path import isdir
if not isdir("logs"):
mkdir("logs")
log_format = "{%(levelname)s}[%(asctime)s]: %(name)s | %(message)s"