def testNalgangPreciseDayReset(self): m1 = Member(None) m1.id = 1 m1.guild = 2222 m1.add_db() m1.name = "Alice" m1.nalgang("", datetime(2020, 5, 7, hour=5, minute=59, second=59)) self.assertEqual(m1.get_point(), config.point_by_rank[0]) self.assertEqual(m1.get_combo(), 1) m1.nalgang("", datetime(2020, 5, 7, hour=6, minute=00, second=00)) self.assertEqual(m1.get_point(), config.point_by_rank[0] * 2) self.assertEqual(m1.get_combo(), 2)
def testDatabase(self): m1 = Member(None) m1.id_num = 1 m1.name = "Alice" m1.add_db(point=123456, combo=654321) self.assertEqual(m1.get_point(), 123456) self.assertEqual(m1.get_combo(), 654321)
def testNalgangDayReset(self): m1 = Member(None) m1.id = 1 m1.name = "Alice" m1.guild = 2222 m1.add_db() m1.nalgang("") self.assertEqual(m1.get_point(), config.point_by_rank[0]) self.assertEqual(m1.get_combo(), 1) time1 = datetime.today() + timedelta(days=1) m1.nalgang("", time1) self.assertEqual(m1.get_point(), config.point_by_rank[0] * 2) self.assertEqual(m1.get_combo(), 2) time2 = datetime.today() + timedelta(days=2) m1.nalgang("", time2) self.assertEqual(m1.get_point(), config.point_by_rank[0] * 3) self.assertEqual(m1.get_combo(), 3)
def testNalgangMonthBonus(self): m1 = Member(None) m1.id_num = 1 m1.name = "Alice" m1.add_db(combo=29) m1.nalgang("") self.assertEqual(m1.get_point(), config.point_by_rank[0] + config.month_bonus) self.assertEqual(m1.get_combo(), 30)
def testNalgang(self): m1 = Member(None) m1.id_num = 1 m1.name = "Alice" m1.add_db() m1.nalgang("") self.assertEqual(m1.get_point(), config.point_by_rank[0]) self.assertEqual(m1.get_combo(), 1) self.assertIsNone(m1.nalgang(""))
def testNalgangWeekBonus(self): m1 = Member(None) m1.id = 1 m1.name = "Alice" m1.guild = 2222 m1.add_db(combo=6) m1.nalgang("") self.assertEqual(m1.get_point(), config.point_by_rank[0] + config.week_bonus) self.assertEqual(m1.get_combo(), 7)
async def force_setup(ctx, user: discord.Member, point, combo): if not (ctx.author.id in admin_ids): return member = Member(user) prev_point = member.get_point() prev_combo = member.get_combo() member.set_point(point) member.set_combo(combo) await ctx.send( "{:s}'s point and combo changed: {:d}, {:d} -> {:d}, {:d}".format( member.name, prev_point, prev_combo, point, combo)) return
async def point(ctx, arg=None): if arg == None: user = ctx.author else: user = await commands.MemberConverter().convert(ctx, arg) member = Member(user) if not member.exist_db(): await ctx.channel.send("등록되지 않은 사용자입니다.") return await ctx.channel.send("{:s}님의 날갱점수는 {:d}점입니다. {:d}연속 출석 중입니다.".format( member.name, member.get_point(), member.get_combo())) return