def activate(self):
self.run_timer = True
try:
with open(self.plugin_config.motd_file, "r", encoding="utf8") as f:
self.motds = json.load(f)
schedule.every().day.at("00:00").do(self._display_motd)
asyncio.ensure_future(self._run_motd())
except FileNotFoundError:
with open(self.plugin_config.motd_file, "w", encoding="utf8") as f:
self.motds = {}
f.write("{}")
except json.decoder.JSONDecodeError:
self.logger.exception(f"Could not decode {self.plugin_config.motd_file}! ", exc_info=True)
# This is stupid
self.valid_months = {
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December", "Any"
}
self.valid_days = {
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Any",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
"17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"
}
评论列表
文章目录