async def _(session: CommandSession): operating_account = session.current_arg_text.strip() user_account = session.ctx['user_id'] if operating_account == '': await session.send('告诉咕咕鸟对方账号啦') return user_coin = redis_client.hget('coin', operating_account) if user_coin and int(user_coin) >= 5: redis_client.hincrby('coin', operating_account, -5) await session.send('兑换成功, 星捷快运, 贴心服务') else: await session.send('没有那么多积分, 还想薅羊毛你') return user_coin = redis_client.hget('coin', operating_account) await session.send(f''' 当前积分为{user_coin} ''', at_sender=True)
async def _(session: CommandSession): # user_name = session.ctx['sender']['card'].split('-')[-1] user_account = session.ctx['user_id'] if redis_client.get(user_account): await session.send('都签到过了还想签, 羊毛怪') return redis_client.set(user_account, 1) expire = arrow.now().shift(days=1).floor('days') - arrow.now() redis_client.expire(user_account, expire) redis_client.hincrby('coin', user_account, 1) user_coin = redis_client.hget('coin', user_account) await session.send(f''' 当前积分为{user_coin} ''', at_sender=True)
async def _(session: CommandSession): user_account = session.ctx['user_id'] user_coin = redis_client.hget('coin', user_account) if int(user_coin) < 5: await session.send('这种场所不允许未成年进入!') return redis_client.hincrby('coin', user_account, -5) rand = random.randint(0, 100) if rand <= 55: redis_client.incr('total_coin', 4) total_coin = redis_client.get('total_coin') await session.send(f'抽到{rand}, 略略略~, 积分池有{total_coin}积分了.') else: total_coin = redis_client.get('total_coin') redis_client.hincrby('coin', user_account, int(total_coin) + 5) redis_client.set('total_coin', 0) await session.send(f'抽到{rand}, 都给你吧, {total_coin}积分')
async def _(session: CommandSession): user_account = session.ctx['user_id'] user_coin = redis_client.hget('coin', user_account) if int(user_coin) < 30: await session.send('没积分还想抽奖你') return redis_client.hincrby('coin', user_account, -30) score = random.randint(0, 1000) type_id, prize = get_prize(score) if type_id < 5: redis_client.hset('prize', user_account, prize) await session.send(f''' 抽奖结果: {prize} 当前积分为{redis_client.hget('coin', user_account)} ''', at_sender=True)
async def _(session: CommandSession): user_account = session.ctx['user_id'] user_coin = redis_client.hget('coin', user_account) await session.send(f''' 当前积分为{user_coin} ''', at_sender=True)