Esempio n. 1
0
def bantop(message):
    if message.qq not in ADMIN:
        return
    texts = message.text.split()
    if not (len(texts) > 0 and texts[0] == '/bantop'):
        return
    try:
        n = int(texts[1])
    except:
        n = 3
    topN = BanRecord.top(n)
    texts = ["**** 禁言次数排名 ****"]
    for qq, record in topN:
        texts.append("{qq} {count}".format(qq=CQAt(qq), count=record.count))
    text = '\n'.join(texts)
    reply(qqbot, message, text)
    return True
Esempio n. 2
0
def banget(message):
    if message.qq not in ADMIN:
        return
    texts = message.text.split()
    if not (len(texts) > 0 and texts[0] == '/banget'):
        return
    try:
        qq = texts[1]
        qqm = CQAt.PATTERN.fullmatch(qq)
        if qqm and qqm.group(1):
            qq = qqm.group(1)
        record = BanRecord.get(qq)
        reply(
            qqbot, message,
            "Ban count: {qq} {count}".format(qq=CQAt(qq), count=record.count))
    except:
        reply(qqbot, message, "Error parsing command.")
    return True
Esempio n. 3
0
def command(message):
    # Restrict to admin
    if message.qq not in ADMIN:
        return
    # Parse message
    try:
        texts = message.text.split()
        cmd = texts[0]
        qq = texts[1]
        idx = texts[2:]
    except:
        return
    if cmd != '/awd':
        return

    match = CQAt.PATTERN.fullmatch(qq)
    if match and match.group(1):
        qq = match.group(1)
    try:
        idx = list(map(lambda x: int(x), idx))
    except:
        idx = []
    if len(idx) == 0:
        idx = [0]

    items = list(filter(lambda x: x.qq == qq, messages))
    items.reverse()
    for i in idx:
        try:
            item = items[i]
        except:
            continue
        reply(
            qqbot, message, "[awd] {qq} #{i}\n{text}".format(i=i,
                                                             qq=CQAt(item.qq),
                                                             text=item.text))
Esempio n. 4
0
def join(message):
    qqbot.send(SendGroupMessage(
        group=message.group,
        text="{} 欢迎来到 poi 用户讨论群。新人请发女装照一张。".format(
            CQAt(message.operatedQQ))
    ))
Esempio n. 5
0
def join(message):
    qqbot.send(
        SendGroupMessage(group=message.group,
                         text="{} 欢迎来到民政统计群,请将群名片改为地区+姓氏的格式。".format(
                             CQAt(message.operatedQQ))))