motd.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Red_Star 作者: medeor413 项目源码 文件源码
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"
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号