Beispiel #1
0
async def search_flac(session: CommandSession):
    keyword = session.current_arg_text
    resp = requests.get('http://mtage.top:8099/acg-music/search',
                        params={'title-keyword': keyword},
                        timeout=1)
    res = resp.json()
    if res['success'] is False:
        logger.error(
            f"Flac query failed.\nerrorCode={res['errorCode']}\nerrorMsg={res['errorMsg']}"
        )
        session.finish(
            f'查询失败 请至acgjc官网查询 http://www.acgjc.com/?s={quote(keyword)}',
            at_sender=True)

    music_list = res['result']['content']
    music_list = music_list[:min(5, len(music_list))]

    details = [
        " ".join([
            f"{ele['title']}", f"{ele['downloadLink']}",
            f"密码:{ele['downloadPass']}" if ele['downloadPass'] else ""
        ]) for ele in music_list
    ]

    msg = [
        f"共 {res['result']['totalElements']} 条结果" if len(music_list) > 0 else
        '没有任何结果', *details, '数据来自 http://www.acgjc.com',
        f'当前库内不包括acgjc的全部数据,更多结果可见 http://www.acgjc.com/?s={quote(keyword)}'
    ]

    session.finish('\n'.join(msg), at_sender=True)
Beispiel #2
0
async def arena_miner(session: CommandSession):
    try:
        rank = int(session.current_arg_text)
    except:
        session.finish(f'请输入"挖矿 纯数字最高排名"', at_sender=True)
    if (rank > 15000):
        amount = 42029
    elif (rank > 12000):
        amount = (rank / 100 - 120) * 45 + 40679
    elif (rank > 11900):
        amount = 40599
    elif (rank > 7999):
        amount = (rank / 100 - 80) * 95 + 36799
    elif (rank > 4000):
        amount = (rank - 4001) + 32800
    elif (rank > 2000):
        amount = (rank - 2001) * 3 + 26800
    elif (rank > 1000):
        amount = (rank - 1001) * 5 + 21800
    elif (rank > 500):
        amount = (rank - 501) * 7 + 18300
    elif (rank > 200):
        amount = (rank - 201) * 13 + 14400
    elif (rank > 100):
        amount = (rank - 101) * 35 + 10900
    elif (rank > 10):
        amount = (rank - 11) * 60 + 5500
    elif (rank > 0):
        amount = (rank - 1) * 550
    else:
        amount = 0
    amount = int(amount)
    messages = f"矿里还剩{amount}钻石"
    await session.send(messages, at_sender=True)
Beispiel #3
0
async def _(session: CommandSession):
    arr = session.current_arg_text.strip().split(' ')
    session.state['id'] = arr[0]
    try:
        session.state['num'] = int(arr[1])
    except Exception:
        session.state['num'] = 0
Beispiel #4
0
async def arena_miner(session: CommandSession):
    try:
        rank = int(session.current_arg_text)
    except:
        return
    rank = np.clip(rank, 1, 15001)
    s_all = all_season[1:rank].sum()
    s_this = this_season[1:rank].sum()
    msg = f"\n最高排名奖励还剩{s_this}钻\n历届最高排名还剩{s_all}钻"
    session.finish(msg,at_sender=1)
Beispiel #5
0
async def lookgqa(session: CommandSession):
    if not sv.check_priv(session.ctx, required_priv=Priv.ADMIN):
        session.finish('只有管理员才可以查看有人问')
    gid = session.ctx['group_id']
    result = Question.select(Question.quest).where(Question.rep_group == gid,
                                                   Question.rep_member == 1)
    msg = ['该群设置的"有人问"是:']
    for res in result:
        msg.append(res.quest)
    await session.send('/'.join(msg), at_sender=True)
Beispiel #6
0
async def feedback(session:CommandSession):
    uid = session.ctx['user_id']
    if not _lmt.check(uid):
        session.finish(EXCEED_NOTICE, at_sender=True)
    coffee = session.bot.config.SUPERUSERS[0]
    text = session.current_arg
    if not text:
        await session.send(f"来杯咖啡[空格]后输入您要反馈的内容~", at_sender=True)
    else:
        await session.bot.send_private_msg(self_id=session.ctx['self_id'], user_id=coffee, message=f'Q{uid}@群{session.ctx["group_id"]}\n{text}')
        await session.send(f'您的反馈已发送!\n=======\n{text}', at_sender=True)
        _lmt.increase(uid)
Beispiel #7
0
async def set_pool(session: CommandSession):
    if not sv.check_priv(session.ctx, required_priv=Priv.ADMIN):
        session.finish('只有群管理才能切换卡池', at_sender=True)
    name = util.normalize_str(session.current_arg_text)
    if not name:
        session.finish(POOL_NAME_TIP, at_sender=True)
    elif name in ('国', '国服', 'cn'):
        session.finish('请选择以下卡池\n> 选择卡池 b服\n> 选择卡池 台服\n> ')
    elif name in ('b', 'b服', 'bl', 'bilibili'):
        name = 'BL'
    elif name in ('台', '台服', 'tw', 'sonet'):
        name = 'TW'
    elif name in ('日', '日服', 'jp', 'cy', 'cygames'):
        name = 'JP'
    elif name in ('混', '混合', 'mix'):
        name = 'MIX'
    elif name in ('群', '群员', '苍蓝星', '狗托'):
        name = 'QUN'
    else:
        session.finish(f'未知服务器地区 {POOL_NAME_TIP}', at_sender=True)
    gid = str(session.ctx['group_id'])
    _group_pool[gid] = name
    dump_pool_config()
    await session.send(f'卡池已切换为{name}池', at_sender=True)
    await gacha_info(session)
Beispiel #8
0
async def cherulize(session:CommandSession):
    s = session.current_arg_text
    if 'granbluefantasy.jp' in s:
        session.finish(f'骑空士爬\n{qksimg}', at_sender=True)
    if len(s) > 500:
        session.finish('切、切噜太长切不动勒切噜噜...', at_sender=True)
    session.finish('切噜~♪' + str2cheru(s))
Beispiel #9
0
async def delqa(session: CommandSession):
    ctx = session.ctx
    gid = ctx['group_id']
    q = session.current_arg_text.strip()
    ans = answers.get(q)
    if not sv.check_priv(ctx, required_priv=Priv.ADMIN):
        session.finish('只有管理员才能删除指定人的问题', at_sender=False)
    if ans is None:
        session.finish('我不记得有这个问题')
    for m in ctx['message']:
        if m.type == 'at' and m.data['qq'] != 'all':
            uid = int(m.data['qq'])
            break
    specific = union(gid, uid)
    a = ans.get(specific)
    if a:
        Question.delete().where(
            Question.quest == q,
            Question.rep_group == gid,
            Question.rep_member == uid,
        ).execute()
        del ans[specific]
        if not ans:
            del answers[q]
        session.finish(f'删除{q}成功\n不再回答"{a}"', at_sender=False)
Beispiel #10
0
async def show_collection(session:CommandSession):
    uid = str(session.ctx['user_id'])
    uset=load_user_collection(uid)[uid]
    length = len(uset)
    if length <= 0:
        session.finish('您的仓库为空,请多多抽卡哦~',at_sender=True)
    else:
        result=list(map(lambda x:Chara.fromname(x),uset))
        step = 6
        pics = []
        for i in range(0, length, step):
            j = min(length, i + step)
            pics.append(Chara.gen_team_pic(result[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)
    msg=[
    f'仅展示三星角色~',
    f'{res}',
    f'您共有{length}个三星角色~'
    ]
    await session.send('\n'.join(msg), at_sender=True)
Beispiel #11
0
async def cherulize(session: CommandSession):
    s = session.current_arg_text
    if len(s) > 500:
        session.finish('切、切噜太长切不动勒切噜噜...', at_sender=True)
    session.finish('切噜~♪' + str2cheru(s))
Beispiel #12
0
async def _(session: CommandSession):
    session.state['arg'] = session.current_arg_text.strip()