コード例 #1
0
    def test_clearData(self):
        KujiUtil.updateMemberJp(1, 1)
        KujiUtil.clearData()
        assert KujiUtil.canDrawJp(1)

        KujiUtil.updateMemberCn(1, 1, 2)
        assert not KujiUtil.canDrawCn(1)
コード例 #2
0
 async def draw_jp(self, ctx: commands.Command, *argv):
     if not KujiUtil.canDrawJp(ctx.author.id):
         await ctx.reply("親愛的員工, 你今天已經抽過清水寺籤了哦! 每人一天只限一次.")
         return
     if not await self.checkToken(ctx):
         return
     random.seed(random.random())
     index = random.randint(0, 98)
     kuji = OMIKUJI[index]
     imagePath = KujiUtil.generageImageForJp(KujiObj(kuji))
     img = File(imagePath, filename=KujiUtil.getKujiImageName())
     await ctx.reply(file=img,
                     embed=KujiEmbed.createEmbededJp(
                         kuji, datetime.now(),
                         f"{self.bot.user.name} - 抽籤遊戲"))
     KujiUtil.updateMemberJp(ctx.author.id, index)
コード例 #3
0
 def test_canDrawJp_false(self):
     KujiUtil.updateMemberJp(1, 1)
     assert not KujiUtil.canDrawJp(1)
コード例 #4
0
 def test_canDraw_true(self):
     assert KujiUtil.canDrawJp(1)
     assert KujiUtil.canDrawCn(1)
     assert KujiUtil.canDrawLs(1)