Beispiel #1
0
async def _(msg: str = EventPlainText(), to_me: bool = EventToMe()):
    def split_command(msg):
        for command in commands:
            if command in msg:
                prefix, suffix = re.split(command, msg)
                return prefix, suffix
        return "", ""

    msg = msg.strip().strip(".>,?!。,()()[]【】")
    prefix_words = ["这", "这个", "那", "那个", "你", "我", "他", "它"]
    suffix_words = ["意思", "梗", "玩意", "鬼"]
    prefix, suffix = split_command(msg)
    if (not prefix or prefix
            in prefix_words) or (suffix and suffix not in suffix_words):
        what.block = False
        await what.finish()
    keyword = prefix

    if to_me:
        res = await get_content(keyword)
    else:
        res = await get_content(keyword, sources=["jiki", "nbnhhsh"])

    if res:
        what.block = True
        await what.finish(res)
    else:
        what.block = False
        await what.finish()
Beispiel #2
0
async def _(msg: Message = CommandArg(), tome: bool = EventToMe()):
    keyword = msg.extract_plain_text().strip()
    if not keyword:
        await pixiv.finish()

    if not keyword.isdigit() and keyword not in ["日榜", "周榜", "月榜"]:
        if not tome:
            await pixiv.finish()

    res = await get_pixiv(keyword)
    if not res:
        await pixiv.finish("出错了,请稍后再试")
    await pixiv.finish(res)
Beispiel #3
0
 async def __call__(self, to_me: bool = EventToMe()) -> bool:
     return to_me
Beispiel #4
0
async def event_to_me(to_me: bool = EventToMe()) -> bool:
    return to_me
Beispiel #5
0
def _configurable_to_me(to_me: bool = EventToMe()):
    if plugin_config.bison_to_me:
        return to_me
    else:
        return True