async def yobot_clan_statistics_api(group_id): bm = ue.get_bm(group_id) group = ue.get_group(bm) if group is None: return jsonify(code=20, message="Group dosen't exist") apikey = request.args.get('apikey') or 'apikey' return await ue.clan_statistics_api(bm, apikey)
async def yobot_clan_statistics(group_id): bm = ue.get_bm(group_id) group = ue.get_group(bm) if group is None: return await render_template( '404.html', item='公会' ), 404 return await render_template( 'clan/statistics.html', )
async def yobot_clan(group_id): bm = ue.get_bm(group_id) group = ue.get_group(bm) if group is None: return await render_template( '404.html', item='公会' ), 404 member = ue.get_member(bm, uid=session.get('yobot_user')) if not member and member['authority_group'] >= 10: return await render_template('clan/unauthorized.html') return await render_template( 'clan/panel.html', is_member=member )
async def yobot_clan_user(group_id, uid): if 'yobot_user' not in session: return redirect(url_for('yobot_login', callback=request.path)) bm = ue.get_bm(group_id) group = ue.get_group(bm) if group is None: return await render_template('404.html', item='公会'), 404 member = ue.get_member(bm, uid=session.get('yobot_user')) if not member and member['authority_group'] >= 10: return await render_template('clan/unauthorized.html') return await render_template( 'clan/user.html', uid=uid, )
async def yobot_clan_setting(group_id): if 'yobot_user' not in session: return redirect(url_for('yobot_login', callback=request.path)) bm = ue.get_bm(group_id) group = ue.get_group(bm) if group is None: return await render_template('404.html', item='公会'), 404 member = ue.get_member(bm, uid=session.get('yobot_user')) if not member: return await render_template( 'unauthorized.html', limit='本公会成员', auth='无') if member['authority_group'] >= 100: return await render_template( 'unauthorized.html', limit='公会战管理员', auth='成员') return await render_template('clan/setting.html')
async def yobot_clan_setting_api(group_id): if 'yobot_user' not in session: return jsonify(code=10, message='Not logged in') uid = session.get('yobot_user') bm = ue.get_bm(group_id) group = ue.get_group(bm) if group is None: return jsonify(code=20, message="Group dosen't exist") member = ue.get_member(bm, uid=uid) if not member or member['authority_group'] >= 100: return jsonify(code=11, message='Insufficient authority') payload = await request.get_json() if payload is None: return jsonify(code=30, message='Invalid payload') else: payload['uid'] = uid if payload.get('csrf_token') != session['csrf_token']: return jsonify(code=15, message='Invalid csrf_token') return ue.clan_setting_api(bm, payload)