Exemplo n.º 1
0
async def set_active(app: Mirai, group: Group, member: Member,
                     message: MessageChain):
    if message.toString().find(conf.get("basic", "command_head") + "cs") == 0:
        if group.id in conf.get("banner", "group_id"):
            return
        conf.get("active", "group_id").append(group.id)
        msg = await app.sendGroupMessage(group, [At(member.id), Plain("启用")])
        call_later(10, app.revokeMessage, msg.messageId)
Exemplo n.º 2
0
def lock(name: int):
    if name not in lottery_lock:
        if name not in conf.get("permission", "operator"):
            lottery_lock.add(name)
            call_later(240, lottery_lock.remove, name)
        return True
    else:
        return False
Exemplo n.º 3
0
async def lottery(app: Mirai, group: Group, member: Member):
    if group:
        raw = sabee_gets(sabee, str(group.id), count=10)
        print(raw)
        if not raw:
            return await app.sendGroupMessage(group, [At(member.id), Plain("至少要有3个人才能开始...")])
        victim = random.choice(raw)
        mt = random.randint(1, 240)
        try:
            await app.mute(group, int(victim[0]), 300)
            call_later(mt, app.unmute, group=group.id, member=int(victim[0]))
            return await app.sendGroupMessage(group, Plain(f"{(await app.memberInfo(group, int(victim[0]))).name or await qname.query(victim[0])}收到了红茶大礼包*{mt}"))
        except PermissionError:
            return await app.sendGroupMessage(group, Plain("我手上的权力还不够呢..."))
    else:
        await app.sendGroupMessage(group, [At(member.id), Plain("过一会再来吧")])
Exemplo n.º 4
0
async def set_inactive(app: Mirai, group: Group, member: Member):
    conf.get("active", "group_id").remove(group.id)
    msg = await app.sendGroupMessage(group, [At(member.id), Plain("禁用")])
    call_later(10, app.revokeMessage, msg.messageId)