Example #1
0
async def handle_1_activity_raffle(num, giftId, text1, text2, raffleid):
    # print('参与')
    await asyncio.sleep(random.uniform(0.5, min(30, num * 1.3)))
    json_response1 = await bilibili.get_gift_of_events_app(
        text1, text2, raffleid)
    json_pc_response = await bilibili.get_gift_of_events_web(
        text1, text2, raffleid)

    printer.info(
        [f'参与了房间{text1:^9}的{bilibili.get_giftids_raffle(str(giftId))}活动抽奖'],
        True)

    if not json_response1['code']:
        printer.info([f'# 移动端活动抽奖结果: {json_response1["data"]["gift_desc"]}'])
        Statistics.add_to_result(
            *(json_response1['data']['gift_desc'].split('X')))
    else:
        print(json_response1)
        printer.info([f'# 移动端活动抽奖结果: {json_response1}'])

    printer.info([f'# 网页端活动抽奖状态:  {json_pc_response}'])
    if not json_pc_response['code']:
        Statistics.append_to_activitylist(raffleid, text1)
    else:
        print(json_pc_response)
    return True
Example #2
0
async def handle_1_activity_raffle(num, giftId, text1, text2, raffleid):
    # print('参与')
    await asyncio.sleep(random.uniform(0.5, min(30, num * 1.3)))
    json_response1 = await bilibili.get_gift_of_events_app(
        text1, text2, raffleid)
    json_pc_response = await bilibili.get_gift_of_events_web(
        text1, text2, raffleid)

    Printer().printlist_append([
        'join_lottery', '', 'user',
        f'参与了房间{text1:^9}的{bilibili.get_giftids_raffle(str(giftId))}活动抽奖'
    ], True)

    if not json_response1['code']:
        Printer().printlist_append([
            'join_lottery', '', 'user', "# 移动端活动抽奖结果: ",
            json_response1['data']['gift_desc']
        ])
        Statistics.add_to_result(
            *(json_response1['data']['gift_desc'].split('X')))
    else:
        print(json_response1)
        Printer().printlist_append([
            'join_lottery', '', 'user', "# 移动端活动抽奖结果: ",
            json_response1['message']
        ])

    Printer().printlist_append([
        'join_lottery', '', 'user', "# 网页端活动抽奖状态: ",
        json_pc_response['message']
    ])
    if not json_pc_response['code']:
        Statistics.append_to_activitylist(raffleid, text1)
    else:
        print(json_pc_response)
    return True