Exemplo n.º 1
0
async def make_proof(event, proof_id):
    proof = await System.get_messages(Sibyl_logs, ids=proof_id)
    try:
        reason = re.search(r"(\*\*)?(Scan)? ?Reason:(\*\*)? (`([^`]*)`|.*)",
                           proof.message)
        reason = reason.group(4) if reason.group(4) else reason.group(3)
    except BaseException:
        return "Invalid"
    try:
        message = re.search('(\*\*)?Target Message:(\*\*)? (.*)',
                            proof.message, re.DOTALL).group(3)
    except BaseException:
        proof_id -= 1
        proof = await System.get_messages(Sibyl_logs, ids=proof_id)
        if proof:
            if proof.media:
                return "Media"
            else:
                return False
        else:
            return False
    async with session.post('https://nekobin.com/api/documents',
                            json={'content': message}) as r:
        paste = f"https://nekobin.com/{(await r.json())['result']['key']}"
    url = "https://del.dog/documents"
    async with session.post(url, data=message.encode("UTF-8")) as f:
        r = await f.json()
        url = f"https://del.dog/{r['key']}"
    return proof_string.format(proof_id=proof_id,
                               reason=reason,
                               paste=paste,
                               url=url)
Exemplo n.º 2
0
async def proof(event):
    msg = await System.send_message(
        event.chat_id, 'Connecting to archive for case file >>>>>')
    try:
        proof_id = int(event.text.split(' ', 1)[1])
    except BaseException:
        await msg.edit('>>>>>The case file ID is invalid')
        return
    await msg.edit('Fetching msg details from case file ID <<<<<<<')
    proof = await System.get_messages(Sibyl_logs, ids=proof_id)
    try:
        reason = re.search(r"(\*\*)?Scan Reason:(\*\*)? (`([^`]*)`|.*)",
                           proof.message)
        reason = reason.group(4) if reason.group(4) else reason.group(3)
    except BaseException:
        await msg.edit(
            '>>>>Unable to see the msg or the case file ID is not valid')
        return
    try:
        message = re.search('(\*\*)?Target Message:(\*\*)? (.*)',
                            proof.message, re.DOTALL).group(3)
    except BaseException:
        proof_id -= 1
        proof = await System.get_messages(Sibyl_logs, ids=proof_id)
        if proof:
            if proof.media:
                await msg.edit('Case file includes media -> Forwarding message'
                               )
                await proof.forward_to(event.chat_id)
                return
            else:
                await msg.edit(f"Error getting case file from ID {proof_id}")
                return
        else:
            await msg.edit(f" Failed to pull case file, Is the ID valid?")
            return
    async with session.post('https://nekobin.com/api/documents',
                            json={'content': message}) as r:
        paste = f"https://nekobin.com/{(await r.json())['result']['key']}"
    url = "https://del.dog/documents"
    async with session.post(url, data=message.encode("UTF-8")) as f:
        r = await f.json()
        url = f"https://del.dog/{r['key']}"
    await msg.edit(
        proof_string.format(proof_id=proof_id,
                            reason=reason,
                            paste=paste,
                            url=url))
Exemplo n.º 3
0
async def make_proof(user):
    data = await get_gban(user)
    if not data:
        return False
    message = data.get('message') or ''
    async with session.post('https://nekobin.com/api/documents',
                            json={'content': message}) as r:
        paste = f"https://nekobin.com/{(await r.json())['result']['key']}"
    url = "https://del.dog/documents"
    async with session.post(url, data=message.encode("UTF-8")) as f:
        r = await f.json()
        url = f"https://del.dog/{r['key']}"
    return proof_string.format(proof_id=data['proof_id'],
                               reason=data['reason'],
                               paste=paste,
                               url=url)
Exemplo n.º 4
0
async def make_proof(user: Union[str, int]):
    if isinstance(user, str) and user.startswith("#"):
        data = await get_gban_by_proofid(int(user.strip("#")))
    else:
        data = await get_gban(int(user))
    if not data:
        return False
    message = data.get("message") or ""
    async with session.post("https://nekobin.com/api/documents",
                            json={"content": message}) as r:
        paste = f"https://nekobin.com/{(await r.json())['result']['key']}"
    url = "https://del.dog/documents"
    async with session.post(url, data=message.encode("UTF-8")) as f:
        r = await f.json()
        url = f"https://del.dog/{r['key']}"
    return proof_string.format(proof_id=data["proof_id"],
                               reason=data["reason"],
                               paste=paste,
                               url=url)