예제 #1
0
    async def get_history(self, ctx: commands.Command, *argv):
        historyJp = KujiUtil.getHistoryJp(ctx.author.id)
        historyCn = KujiUtil.getHistoryCn(ctx.author.id)
        historyLs = KujiUtil.getHistoryLs(ctx.author.id)
        if (-1, None) == historyJp and (-1, None) == historyLs and (
                -1, -1, None) == historyCn:
            await ctx.reply("親愛的員工, 你還沒抽過籤呢! 先試著抽一個看看?.")
        if not (-1, None) == historyLs:
            ls = LUNGSHAN[historyLs[0]]
            status = ls["status"]
            img = File(KujiUtil.getImageUrlLs(status),
                       filename=KujiUtil.getImageNameLs(status))
            await ctx.reply(file=img,
                            embed=KujiEmbed.createEmbededLs(
                                ls, datetime.now(),
                                f"{self.bot.user.name} - 抽籤遊戲"))

        if not (-1, None) == historyJp:
            kuji = OMIKUJI[historyJp[0]]
            imagePath = KujiUtil.generageImageForJp(KujiObj(kuji))
            img = File(imagePath, filename=KujiUtil.getKujiImageName())
            await ctx.reply(file=img,
                            embed=KujiEmbed.createEmbededJp(
                                kuji, historyJp[1],
                                f"{self.bot.user.name} - 抽籤遊戲"))

        if not (-1, -1, None) == historyCn:
            yi = KujiUtil.getTargetedYi(historyCn[0], historyCn[1])
            await ctx.reply(embed=KujiEmbed.createEmbededCn(
                yi, historyCn[2], f"{self.bot.user.name} - 抽籤遊戲"))
예제 #2
0
    def test_getHistoryCn(self):
        KujiUtil.updateMemberCn(1, 1, 2)
        history = KujiUtil.getHistoryCn(1)

        assert history[0] == 1
        assert history[1] == 2