Exemplo n.º 1
0
def ri(img):
    return rand_array(pcurl) if img in welp else img
Exemplo n.º 2
0
 def alive_default_imgs() -> str:
     alive_imgs = [
         "https://telegra.ph/file/15609c1c64aed98b7eaa6.jpg",
     ]
     return rand_array(alive_imgs)
Exemplo n.º 3
0
async def anime_Scene(message: Message):
    """ Creates random anime Cut Scene! """

    monika_faces = list("abcdefghijklmnopqr")

    natsuki_faces = list("abcdefghijklmnopqrstuvwxyz")

    natsuki_faces.extend(  # fmt: off
        [
            "1t",
            "2bt",
            "2bta",
            "2btb",
            "2btc",
            "2btd",
            "2bte",
            "2btf",
            "2btg",
            "2bth",
            "2bti",
            "2t",
            "2ta",
            "2tb",
            "2tc",
            "2td",
            "2te",
            "2tf",
            "2tg",
            "2th",
            "2ti",
        ])

    sayori_faces = list("abcdefghijklmnopqrstuvwxy")

    yuri_faces = list("abcdefghijklmnopqrstuvwx")

    background = [  # fmt: off
        "bedroom",
        "class",
        "closet",
        "club",
        "corridor",
        "house",
        "kitchen",
        "residential",
        "sayori_bedroom",
    ]

    ddlc_items = {
        "body": {
            "monika": ["1", "2"],
            "natsuki": ["1b", "1", "2b", "2"],
            "yuri": ["1b", "1", "2b", "2"],
            "sayori": ["1b", "1", "2b", "2"],
        },
        "face": {
            "monika": monika_faces,
            "natsuki": natsuki_faces,
            "yuri": yuri_faces,
            "sayori": sayori_faces,
        },
    }

    ddlc_char = ["yuri", "natsuki", "monika", "sayori"]

    replied = message.reply_to_message
    args = message.filtered_input_str
    if args:
        text = args
    elif replied:
        text = args or replied.text
    else:
        await message.err("`Input not found!...`", del_in=5)
        return
    await message.delete()
    if "-y" in message.flags:
        character = "yuri"
    if "-n" in message.flags:
        character = "natsuki"
    if "-m" in message.flags:
        character = "monika"
    elif "-s" in message.flags:
        character = "sayori"
    else:
        character = rand_array(ddlc_char)

    body = ddlc_items["body"][character]
    rando_body = rand_array(body)
    face = ddlc_items["face"][character]
    rando_face = rand_array(face)
    rand_background = rand_array(background)
    text = str(deEmojify(text))

    path = await ddlc(character, rando_face, rando_body, rand_background, text)
    if path == "ERROR":
        return await message.edit("😔 Something Wrong see Help!", del_in=2)
    chat_id = message.chat.id
    message_id = replied.message_id if replied else None
    await message.delete()
    await message.client.send_photo(chat_id=chat_id,
                                    photo=path,
                                    reply_to_message_id=message_id)
Exemplo n.º 4
0
    async def forward_stored(self,
                             client: Union['_client.Userge',
                                           '_client.UsergeBot'],
                             message_id: int,
                             chat_id: int,
                             user_id: int,
                             reply_to_message_id: int,
                             dis_preview: bool = True,
                             del_in: int = 0,
                             allow_random: bool = True) -> None:
        """\nforward stored message from log channel.

        Parameters:
            client (`Userge` | `UsergeBot`):
                Pass Userge or UsergeBot.

            message_id (`int`):
                Message id of stored message.

            chat_id (`int`):
                ID of chat (dest) you want to farward.

            user_id (`int`):
                ID of user you want to reply.

            reply_to_message_id (`int`):
                If the message is a reply, ID of the original message.

            del_in (`int`):
                Time in Seconds for delete that message.

        Returns:
            None
        """
        if not message_id or not isinstance(message_id, int):
            return
        message = await client.get_messages(chat_id=self._id,
                                            message_ids=message_id)
        caption = ''
        if message.caption:
            caption = message.caption.html.split('\n\n', maxsplit=1)[-1]
        elif message.text:
            caption = message.text.html.split('\n\n', maxsplit=1)[-1]
        if caption:
            u_dict = await client.get_user_dict(user_id)
            chat = await client.get_chat(chat_id)
            u_dict.update({
                'chat': chat.title if chat.title else "this group",
                'count': chat.members_count
            })
            caption = caption.format_map(SafeDict(**u_dict))
        file_id = get_file_id(message)
        caption, buttons = parse_buttons(caption)
        split_char = r"%%%"
        if allow_random and split_char in caption:
            caption = rand_array(caption.split(split_char))
        try:
            if message.media and file_id:
                msg = await client.send_cached_media(
                    chat_id=chat_id,
                    file_id=file_id,
                    caption=caption,
                    reply_to_message_id=reply_to_message_id,
                    reply_markup=buttons
                    if client.is_bot and buttons else None)
            else:
                msg = await client.send_message(
                    chat_id=chat_id,
                    text=caption,
                    reply_to_message_id=reply_to_message_id,
                    disable_web_page_preview=dis_preview,
                    reply_markup=buttons
                    if client.is_bot and buttons else None)
            if del_in and msg:
                await asyncio.sleep(del_in)
                await msg.delete()
        except ChatWriteForbidden:
            pass