hal.py 文件源码

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

项目:HAL-9000 作者: AnsonRS 项目源码 文件源码
def loadQuestions(self, msg):
        msg = msg.split(" ")
        if len(msg) == 2:
            _, qlist = msg
            if qlist == "random":
                chosenList = choice(glob.glob("trivia/*.txt"))
                self.questionList = self.loadList(chosenList)
                self.status = "new question"
                self.timeout = time.perf_counter()
                if self.questionList: await self.newQuestion()
            else:
                if os.path.isfile("trivia/" + qlist + ".txt"):
                    self.questionList = self.loadList("trivia/" + qlist + ".txt")
                    self.status = "new question"
                    self.timeout = time.perf_counter()
                    if self.questionList: await self.newQuestion()
                else:
                    await client.send_message(self.channel, "`There is no list with that name.`")
                    await self.stopTrivia()
        else:
            await client.send_message(self.channel, "`" + settings["PREFIX"] + "trivia [list name]`")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号