Skip to content

Commit

Permalink
Fixed crontab range error
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Aug 8, 2023
1 parent 6b38370 commit 1b8ef6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import asyncio
import logging
from termcolor import colored
from bot.config import config
Expand All @@ -8,21 +7,23 @@


dir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(dir, "logs/logs.txt")
def logs():
if os.path.exists(path):
pass
else:
try:
with open(ruta_archivo, 'w') as g:
f.write('')
print(f'{colored("[INFO]", "blue")}: LOG FILE CREATED')
except Exception as e:
print(e)
folder = os.path.join(dir, "logs")


if os.path.exists(f"{folder}/logs.txt"):
pass
elif not os.path.exists(folder):
os.makedirs(folder)
try:
with open(f"{folder}/logs.txt", 'w') as f:
f.write('')
print(f'{colored("[INFO]", "blue")}: LOG FILE CREATED')
except Exception as e:
print(e)


logging.basicConfig(
filename=path,
filename=f"{folder}/logs.txt",
format="[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s",
level=logging.INFO,
)
Expand Down
2 changes: 1 addition & 1 deletion bot/tasks/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
dir = os.path.dirname(os.path.abspath(__file__))
file = os.path.join(dir, "dev.py")
job = cron.new(command=f"python3 {file}")
job.hours.every(24)
job.hours.every(23)
cron.write()

0 comments on commit 1b8ef6c

Please sign in to comment.