add timezone so that APScheduler won't complain

This commit is contained in:
əlemi 2021-12-10 13:44:53 +01:00
parent 3252478067
commit af8afbd95c

View file

@ -1,6 +1,7 @@
import re import re
import logging import logging
import asyncio import asyncio
import datetime
from typing import List, Dict, Union, Optional, Any, Type from typing import List, Dict, Union, Optional, Any, Type
from enum import Enum from enum import Enum
@ -75,7 +76,8 @@ class Treepuncher(MinecraftClient):
self._register_handlers() self._register_handlers()
self.modules = [] self.modules = []
self.scheduler = AsyncIOScheduler() tz = datetime.datetime.now(datetime.timezone.utc).astimezone().tzname() # APScheduler will complain if I don't specify a timezone...
self.scheduler = AsyncIOScheduler(timezone=tz)
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING) # So it's way less spammy logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING) # So it's way less spammy
self.scheduler.start(paused=True) self.scheduler.start(paused=True)