Ejemplo n.º 1
0
def _(session: CommandSession):
    from re import search

    strippedArgs = session.current_arg_text.strip()
    matchObj = search(r"[a-fA-F0-9]{8,40}", strippedArgs)
    if not matchObj:
        session.pause("请输入激活密钥")
    session.state["key"] = str(matchObj.group(0)).upper()
Ejemplo n.º 2
0
def _(session: CommandSession):
    strippedArgs = session.current_arg_text.strip()
    if not strippedArgs:
        session.pause("请输入画师的用户ID")
    numberArgs = extract_numbers(session.current_arg_text)
    if len(numberArgs) > 2:
        session.pause("您输入的参数不正确")
    page, member = numberArgs if len(numberArgs) == 2 else (1, numberArgs[0])
    session.state["page"], session.state["id"] = int(page), int(member)
Ejemplo n.º 3
0
def _(session: CommandSession):
    banID = extract_numbers(session.current_arg_text)
    if not banID:
        session.pause("请输入被洗白者的QQ")
    nowBlacklist: list = PluginManager.settings(__plugin_name__,
                                                session.event).settings
    nowBlacklist = [i for i in nowBlacklist if i not in banID]
    PluginManager.settings(__plugin_name__,
                           session.event).settings = [*set(nowBlacklist)]
    return "已经为" + "".join(map(lambda x: str(MessageSegment.at(x)),
                               banID)) + "移除黑名单"
Ejemplo n.º 4
0
def _(session: CommandSession):
    if session.state.get("id", None):
        return
    args = session.current_arg_text.strip()
    avResult = MATCH_AV.search(args)
    bvResult = MATCH_BV.search(args)
    if avResult:
        session.state["id"] = int(avResult.group(1))
    elif bvResult:
        session.state["id"] = IDCoverter.bv2av(bvResult.group())
    else:
        session.pause("请输入正确的bv号或者av号")
Ejemplo n.º 5
0
def _(session: CommandSession):
    if session.current_arg_images:
        session.switch(f"!{GET_IMAGE_METHOD} {session.current_arg}")
    strippedArgs = session.current_arg_text.strip()
    if not strippedArgs:
        session.pause("请输入搜索关键词")
    keywords: List[str] = strippedArgs.split(" ")
    if len(keywords) >= 2:
        if keywords[0].isdigit():
            session.state["page"] = int(keywords[0])
            keywords.pop(0)
    session.state["keyword"] = " ".join(keywords)
Ejemplo n.º 6
0
def _(session: CommandSession):
    numberArgs = extract_numbers(session.current_arg_text)
    textArgs = extract_text(session.current_arg_text)
    if not numberArgs:
        session.pause("请输入p站图片ID")
    session.state["id"] = int(numberArgs[0])
    keywordChoice = {
        "大图": "large",
        "小图": "medium",
        "原图": "original",
    }
    for key, value in keywordChoice.items():
        if key in textArgs:
            session.state["res"] = value
            break
Ejemplo n.º 7
0
def _(session: CommandSession):
    banID = extract_numbers(session.current_arg_text)
    groupUsers = [
        i["user_id"]
        for i in callModuleAPI("get_group_member_list",
                               params={"group_id": session.event.group_id})
    ]
    banID = [*set([int(i) for i in banID]).intersection({*groupUsers})]
    if not banID:
        session.pause("请输入被拉黑者的QQ")
    nowBlacklist: list = PluginManager.settings(__plugin_name__,
                                                session.event).settings
    nowBlacklist.extend(map(int, banID))
    PluginManager.settings(__plugin_name__,
                           session.event).settings = [*set(nowBlacklist)]
    return "已经为" + "".join(map(lambda x: str(MessageSegment.at(x)),
                               banID)) + "添加黑名单"
Ejemplo n.º 8
0
def _(session: CommandSession):
    strippedArgs = session.current_arg_text.strip()
    if not strippedArgs:
        session.pause("请输入错误追踪ID")
    session.state["id"] = strippedArgs
Ejemplo n.º 9
0
def _(session: CommandSession):
    strippedArgs = session.current_arg_text.strip()
    if not strippedArgs:
        session.pause("请输入搜索关键词")
    session.state["keyword"] = strippedArgs
Ejemplo n.º 10
0
def _(session: CommandSession):
    strippedArgs = session.current_arg_text.strip()
    URLSearch = URL_MATCH_REGEX.search(strippedArgs)
    if not URLSearch:
        session.pause("请输入订阅URL")
    session.state["link"] = URLSearch.group()
Ejemplo n.º 11
0
def _(session: CommandSession):
    if session.current_arg_images:
        session.state["image"] = session.current_arg_images[0]
    else:
        session.pause("请发送一张图片来进行搜索")
Ejemplo n.º 12
0
def _(session: CommandSession):
    strippedArgs = session.current_arg.strip()
    if not strippedArgs:
        session.pause("请输入广播内容")
    session.state["content"] = strippedArgs