示例#1
0
文件: test.py 项目: 3-24/nalgang
 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)
示例#2
0
 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)
示例#3
0
文件: test.py 项目: 3-24/nalgang
 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)
示例#4
0
 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)
示例#5
0
 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(""))
示例#6
0
文件: test.py 项目: 3-24/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)
示例#7
0
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
示例#8
0
文件: bot.py 项目: 3-24/nalgang
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