async def gift(session, ctx: commands.context, a: int, b: int): point = session.query(Point).filter_by(owner=str(ctx.author.id)).first() if point is None: point = Point() point.owner = str(ctx.author.id) point.point = 0 session.add(point) gift_point = randint(a, b) point.point += gift_point session.commit() await ctx.reply(f"선물 상자에서 {gift_point}P 를 받았습니다!")
async def create(self, ctx: commands.context): session_ = sessionmaker(bind=engine.get_engine()) session = session_() point = session.query(Point).filter_by( owner=str(ctx.author.id) ).first() if point is not None: await ctx.reply( "**경고** 당신은 이미 포인트 지갑을 가지고 있습니다." ) else: point = Point() point.owner = str(ctx.author.id) point.point = 0 session.add(point) session.commit() await ctx.reply( "포인트 지갑 생성 완료" )