Example #1
0
File: 0x0st.py Project: k-18/PPE
def upload_to_0x0st(path):
    try:
        req = requests.post('https://0x0.st', files={'file': open(path, 'rb')})
    except ConnectionError:
        raise ConnectionError
    DelFile(path)
    return req.text
Example #2
0
    async def kangcmd(self, message):
        """Забрасывай в анал свой крючок!
        использовать: .kang ответить на стикер/документ/фото и можно выбрать эмодзи для стикера
        Если doesn\'t он будет создан автоматически.
        """
        user = await self.client.get_me()
        if not user.username:
            user.username = user.first_name
        reply = await message.get_reply_message()
        photo = None
        emojibypass = False
        is_anim = False
        emoji = ""
        silent_mode = self.config['silent_mode']
        if silent_mode != "on":
            await utils.answer(message, self.strings('preparing_msg', message))
        if reply and reply.media:
            try:
                if reply.photo:
                    photo = io.BytesIO()
                    photo = await self.client.download_media(
                        reply.photo, photo)
                elif reply.file:
                    if reply.file.mime_type == "application/x-tgsticker":
                        await self.client.download_file(
                            reply.media.document, 'AnimatedSticker.tgs')
                        try:
                            emoji = reply.media.document.attributes[0].alt
                        except AttributeError:
                            emoji = reply.media.document.attributes[1].alt
                        emojibypass = True
                        is_anim = True
                        photo = 1
                    else:
                        photo = io.BytesIO()
                        await self.client.download_file(
                            reply.media.document, photo)

                        # For kanging other sticker
                        if reply.sticker:
                            emoji = reply.file.emoji
                            emojibypass = True
                else:
                    await utils.answer(
                        message, self.strings('unsupported_err', message))
                    return
            except AttributeError:
                photo = io.BytesIO()
                photo = await self.client.download_media(reply.photo, photo)
                try:
                    emoji = reply.media.document.attributes[1].alt
                    emojibypass = True
                except AttributeError:
                    emojibypass = False
        else:
            await utils.answer(message, self.strings('reply_err', message))
            return

        if silent_mode != "on":
            await utils.answer(message, self.strings('gettingType_msg',
                                                     message))

        if photo:
            splat = message.text.split()
            if not emojibypass or not emoji:
                emoji = "🤔"
            pack = 1
            if len(splat) == 3:
                pack = splat[2]  # User sent both
                emoji = splat[1]
            elif len(splat) == 2:
                if splat[1].isnumeric():
                    pack = int(splat[1])
                else:
                    emoji = splat[1]

            packname = f"a{user.id}_by_{user.username}_{pack}"
            packnick = self.config['pack_name'].replace(
                '%username%',
                f'@{user.username}').replace("%packNumber%", str(pack))
            cmd = '/newpack'
            file = io.BytesIO()

            if not is_anim:
                image = await resize_photo(photo)
                file.name = "sticker.png"
                image.save(file, "PNG")
                if silent_mode != "on":
                    await utils.answer(
                        message, self.strings('image_kanging_msg', message))
            else:
                packname += "_anim"
                packnick += " animated"
                cmd = '/newanimated'
                if silent_mode != "on":
                    await utils.answer(
                        message, self.strings('animated_kanging_msg', message))
            try:
                response = await self.client(
                    GetStickerSetRequest(stickerset=InputStickerSetShortName(
                        short_name=packname)))
            except StickersetInvalidError:
                response = None

            if response is not None:
                async with self.client.conversation('Stickers') as conv:
                    await conv.send_message('/addsticker')
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message(packname)
                    x = await conv.get_response()
                    mtext = x.text
                    while '120' in mtext:
                        pack += 1
                        packname = f"a{user.id}_by_{user.username}_{pack}"
                        packnick = self.config['pack_name'].replace(
                            '%username%', f'@{user.username}').replace(
                                "%packNumber%",  # noqa: E128
                                str(pack))
                        if silent_mode != "on":
                            await utils.answer(message, self.strings('switching_msg', message)\
                                .format(str(pack)))
                        await conv.send_message(packname)
                        x = await conv.get_response()
                        mtext = x.text
                        if x.text == "Invalid pack selected." or x.text == "Не выбран набор стикеров.":
                            await conv.send_message(cmd)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.send_message(packnick)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            if is_anim:
                                await conv.send_file('AnimatedSticker.tgs',
                                                     force_document=True)
                                DelFile('AnimatedSticker.tgs')
                            else:
                                file.seek(0)
                                await conv.send_file(file, force_document=True)
                            await conv.get_response()
                            await conv.send_message(emoji)
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await conv.send_message("/publish")
                            if is_anim:
                                await conv.get_response()
                                await conv.send_message(f"<{packnick}>")
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.send_message("/skip")
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await conv.send_message(packname)
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await utils.answer(message,
                                        self.strings('added_to_different_msg', message)\
                                            .format(  # noqa: E127
                                            f"t.me/addstickers/{packname}"
                                        ))
                            await sleep(5)
                            await message.delete()
                            return
                    if is_anim:
                        await conv.send_file('AnimatedSticker.tgs',
                                             force_document=True)  # noqa: E128
                        DelFile('AnimatedSticker.tgs')
                    else:
                        file.seek(0)
                        await conv.send_file(file, force_document=True)
                    await conv.get_response()
                    await conv.send_message(emoji)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message('/done')
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
            else:
                if silent_mode != "on":
                    await utils.answer(message,
                                       self.strings('pack_notExist', message))
                async with self.client.conversation('Stickers') as conv:
                    await conv.send_message(cmd)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message(packnick)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    if is_anim:
                        await conv.send_file('AnimatedSticker.tgs',
                                             force_document=True)  # noqa: E128
                        DelFile('AnimatedSticker.tgs')
                    else:
                        file.seek(0)
                        await conv.send_file(file, force_document=True)
                    await conv.get_response()
                    await conv.send_message(emoji)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message("/publish")
                    if is_anim:
                        await conv.get_response()
                        await conv.send_message(f"<{packnick}>")
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message("/skip")
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message(packname)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
            await utils.answer(message,
                                self.strings('added_msg', message)\
                                    .format(  # noqa: E127
                                    f"t.me/addstickers/{packname}"
                                ))
            await sleep(5)
            await message.delete()
Example #3
0
    async def kangcmd(self, message):
        """Kangs a sticker or image to your own pack!
        Usage: .kang (reply) (optional: emoji)
        If pack doesn\'t exist it will be created automatically.
        """
        user = await self.client.get_me()
        if not user.username:
            user.username = user.first_name
        reply = await message.get_reply_message()
        photo = None
        emojibypass = False
        is_anim = False
        emoji = ""
        silent_mode = self.config['silent_mode']
        if silent_mode != "on":
            await utils.answer(message, self.strings['preparing_msg'])
        if reply and reply.media:
            try:
                if reply.photo:
                    photo = io.BytesIO()
                    photo = await self.client.download_media(
                        reply.photo, photo)
                elif reply.file:
                    if reply.file.mime_type == "application/x-tgsticker":
                        await self.client.download_file(
                            reply.media.document, 'AnimatedSticker.tgs')
                        try:
                            emoji = reply.media.document.attributes[0].alt
                        except AttributeError:
                            emoji = reply.media.document.attributes[1].alt
                        emojibypass = True
                        is_anim = True
                        photo = 1
                    else:
                        photo = io.BytesIO()
                        await self.client.download_file(
                            reply.media.document, photo)

                        # For kanging other sticker
                        if reply.sticker:
                            emoji = reply.file.emoji
                            emojibypass = True
                else:
                    await utils.answer(message,
                                       self.strings['unsupported_err'])
                    return
            except AttributeError:
                photo = io.BytesIO()
                photo = await self.client.download_media(reply.photo, photo)
                try:
                    emoji = reply.media.document.attributes[1].alt
                    emojibypass = True
                except AttributeError:
                    emojibypass = False
        else:
            await utils.answer(message, self.strings['reply_err'])
            return

        if silent_mode != "on":
            await utils.answer(message, self.strings['gettingType_msg'])

        if photo:
            splat = message.text.split()
            if not emojibypass or not emoji:
                emoji = "🤔"
            pack = 1
            if len(splat) == 3:
                pack = splat[2]  # User sent both
                emoji = splat[1]
            elif len(splat) == 2:
                if splat[1].isnumeric():
                    pack = int(splat[1])
                else:
                    emoji = splat[1]

            packname = f"a{user.id}_by_{user.username}_{pack}"
            packnick = self.config['pack_name'].replace(
                '%username%',
                f'@{user.username}').replace("%packNumber%",
                                             str(pack))  # noqa: E128
            cmd = '/newpack'
            file = io.BytesIO()

            if not is_anim:
                image = await resize_photo(photo)
                file.name = "sticker.png"
                image.save(file, "PNG")
                await utils.answer(message, self.strings['image_kanging_msg'])
            else:
                packname += "_anim"
                packnick += " animated"
                cmd = '/newanimated'
                await utils.answer(message,
                                   self.strings['animated_kanging_msg'])

            response = urllib.request.urlopen(
                urllib.request.Request(f'http://t.me/addstickers/{packname}'))
            htmlstr = response.read().decode("utf8").split('\n')

            if "  A <strong>Telegram</strong> user has created the <strong>Sticker&nbsp;Set</strong>." not in htmlstr:
                async with self.client.conversation('Stickers') as conv:
                    await conv.send_message('/addsticker')
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message(packname)
                    x = await conv.get_response()
                    mtext = x.text
                    while mtext == PACK_FULL or mtext == PACK_FULL_RUS:
                        pack += 1
                        packname = f"a{user.id}_by_{user.username}_{pack}"
                        packnick = self.config['pack_name'].replace(
                            '%username%', f'@{user.username}').replace(
                                "%packNumber%",  # noqa: E128
                                str(pack))
                        if silent_mode != "on":
                            await utils.answer(
                                message, self.strings['switching_msg'].format(
                                    str(pack)))
                        await conv.send_message(packname)
                        x = await conv.get_response()
                        mtext = x.text
                        if x.text == "Invalid pack selected." or x.text == "Не выбран набор стикеров.":
                            await conv.send_message(cmd)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.send_message(packnick)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            if is_anim:
                                await conv.send_file('AnimatedSticker.tgs',
                                                     force_document=True)
                                DelFile('AnimatedSticker.tgs')
                            else:
                                file.seek(0)
                                await conv.send_file(file, force_document=True)
                            await conv.get_response()
                            await conv.send_message(emoji)
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await conv.send_message("/publish")
                            if is_anim:
                                await conv.get_response()
                                await conv.send_message(f"<{packnick}>")
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.send_message("/skip")
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await conv.send_message(packname)
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await utils.answer(
                                message,
                                self.strings['added_to_different_msg'].
                                format(  # noqa: E127
                                    f"t.me/addstickers/{packname}"))
                            await sleep(5)
                            await message.delete()
                            return
                    if is_anim:
                        await conv.send_file('AnimatedSticker.tgs',
                                             force_document=True)  # noqa: E128
                        DelFile('AnimatedSticker.tgs')
                    else:
                        file.seek(0)
                        await conv.send_file(file, force_document=True)
                    await conv.get_response()
                    await conv.send_message(emoji)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message('/done')
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
            else:
                if silent_mode != "on":
                    await utils.answer(message, self.strings['pack_notExist'])
                async with self.client.conversation('Stickers') as conv:
                    await conv.send_message(cmd)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message(packnick)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    if is_anim:
                        await conv.send_file('AnimatedSticker.tgs',
                                             force_document=True)  # noqa: E128
                        DelFile('AnimatedSticker.tgs')
                    else:
                        file.seek(0)
                        await conv.send_file(file, force_document=True)
                    await conv.get_response()
                    await conv.send_message(emoji)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message("/publish")
                    if is_anim:
                        await conv.get_response()
                        await conv.send_message(f"<{packnick}>")
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message("/skip")
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message(packname)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
            await utils.answer(
                message,
                self.strings['added_msg'].format(  # noqa: E127
                    f"t.me/addstickers/{packname}"))
            await sleep(5)
            await message.delete()
async def kang(args):
    """ For .kang command, kangs stickers or creates new ones. """
    user = await bot.get_me()
    if not user.username:
        user.username = user.first_name
    message = await args.get_reply_message()
    photo = None
    emojibypass = False
    is_anim = False
    emoji = ""
    await args.edit("`Kanging...`")
    if message and message.media:
        # For kanging regular images
        if isinstance(message.media, MessageMediaPhoto):
            photo = io.BytesIO()
            photo = await bot.download_media(message.photo, photo)
        elif "image" in message.media.document.mime_type.split('/'):
            photo = io.BytesIO()
            await bot.download_file(message.media.document, photo)
            # For kanging other sticker
            if (DocumentAttributeFilename(file_name='sticker.webp')
                    in message.media.document.attributes):
                emoji = message.media.document.attributes[1].alt
                emojibypass = True
        # For kanging Animated Stickers
        elif (DocumentAttributeFilename(file_name='AnimatedSticker.tgs')
              in message.media.document.attributes):
            await bot.download_file(message.media.document,
                                    'AnimatedSticker.tgs')
            #
            # !!! HACK HACK HACK HACK !!!
            # We have to check both as Telegram constantly moving
            # the attributes between 0 and 1
            #
            try:
                emoji = message.media.document.attributes[0].alt
            except AttributeError:
                emoji = message.media.document.attributes[1].alt
            emojibypass = True
            is_anim = True
            photo = 1
        else:
            await args.edit("`Unsupported File!`")
            return
    else:
        await args.edit("`Reply to photo to kang it bruh`")
        return

    if photo:
        splat = args.text.split()
        if not emojibypass:
            emoji = "🤔"
        pack = 1
        if len(splat) == 3:
            pack = splat[2]  # User sent both
            emoji = splat[1]
        elif len(splat) == 2:
            if splat[1].isnumeric():
                # User wants to push into different pack, but is okay with
                # thonk as emote.
                pack = int(splat[1])
            else:
                # User sent just custom emote, wants to push to default
                # pack
                emoji = splat[1]

        packname = f"a{user.id}_by_{user.username}_{pack}"
        packnick = f"@{user.username}'s userbot pack {pack}"
        cmd = '/newpack'
        file = io.BytesIO()

        if not is_anim:
            image = await resize_photo(photo)
            file.name = "sticker.png"
            image.save(file, "PNG")
        else:
            packname += "_anim"
            packnick += " animated"
            cmd = '/newanimated'

        response = urllib.request.urlopen(
            urllib.request.Request(f'http://t.me/addstickers/{packname}'))
        htmlstr = response.read().decode("utf8").split('\n')

        if CREATE_RESP not in htmlstr:
            async with bot.conversation('Stickers') as conv:
                await conv.send_message('/addsticker')
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.send_message(packname)
                resp = await conv.get_response()
                while resp.text == PACK_FULL:
                    pack += 1
                    packname = f"a{user.id}_by_{user.username}_{pack}"
                    packnick = f"@{user.username}'s userbot pack {pack}"
                    await args.edit("`Switching to Pack " + str(pack) +
                                    " due to insufficient space`")
                    await conv.send_message(packname)
                    resp = await conv.get_response()
                    if resp.text == "Invalid pack selected.":
                        await conv.send_message(cmd)
                        await conv.get_response()
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.send_message(packnick)
                        await conv.get_response()
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        if is_anim:
                            await conv.send_file('AnimatedSticker.tgs',
                                                 force_document=True)
                            DelFile('AnimatedSticker.tgs')
                        else:
                            file.seek(0)
                            await conv.send_file(file, force_document=True)
                        await conv.get_response()
                        await conv.send_message(emoji)
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.get_response()
                        await conv.send_message("/publish")
                        if is_anim:
                            await conv.get_response()
                            await conv.send_message(f"<{packnick}>")
                        # Ensure user doesn't get spamming notifications
                        await conv.get_response()
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.send_message("/skip")
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.get_response()
                        await conv.send_message(packname)
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await conv.get_response()
                        # Ensure user doesn't get spamming notifications
                        await bot.send_read_acknowledge(conv.chat_id)
                        await args.edit(
                            f"Sticker added in a Different Pack! This Pack is Newly created! \
                            Your pack can be found [here](t.me/addstickers/{packname})",
                            parse_mode='md')
                        return
                if is_anim:
                    await conv.send_file('AnimatedSticker.tgs',
                                         force_document=True)
                    DelFile('AnimatedSticker.tgs')
                else:
                    file.seek(0)
                    await conv.send_file(file, force_document=True)
                await conv.get_response()
                await conv.send_message(emoji)
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                await conv.send_message('/done')
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
        else:
            await args.edit("Userbot sticker pack \
doesn't exist! Making a new one!")
            async with bot.conversation('Stickers') as conv:
                await conv.send_message(cmd)
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.send_message(packnick)
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                if is_anim:
                    await conv.send_file('AnimatedSticker.tgs',
                                         force_document=True)
                    DelFile('AnimatedSticker.tgs')
                else:
                    file.seek(0)
                    await conv.send_file(file, force_document=True)
                await conv.get_response()
                await conv.send_message(emoji)
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                await conv.send_message("/publish")
                if is_anim:
                    await conv.get_response()
                    await conv.send_message(f"<{packnick}>")
                # Ensure user doesn't get spamming notifications
                await conv.get_response()
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.send_message("/skip")
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                await conv.send_message(packname)
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)
                await conv.get_response()
                # Ensure user doesn't get spamming notifications
                await bot.send_read_acknowledge(conv.chat_id)

        await args.edit(
            f"Sticker added! Your pack can be found [here](t.me/addstickers/{packname})",
            parse_mode='md')
Example #5
0
    async def kangcmd(self, message):
        """Kangs a sticker or image to your own pack!
        Usage: .kang (reply) (optional: emoji)
        If pack doesn\'t exist it will be created automatically.
        """
        user = await self.client.get_me()
        if not user.username:
            user.username = user.first_name
        reply = await message.get_reply_message()
        photo = None
        is_anim = False
        emoji = ""
        silent_mode = "on" if self.config["silent_mode"] == "on" else "off"
        if silent_mode != "on":
            await utils.answer(message, self.strings("preparing_msg", message))
        if reply and reply.media:
            try:
                if reply.photo:
                    photo = io.BytesIO()
                    await self.client.download_media(reply.photo, photo)
                elif reply.file:
                    if reply.file.mime_type == "application/x-tgsticker":
                        await self.client.download_file(
                            reply.media.document, "AnimatedSticker.tgs")
                        emoji = reply.file.emoji
                        is_anim = True
                    else:
                        photo = io.BytesIO()
                        await self.client.download_file(
                            reply.media.document, photo)
                        if reply.sticker:
                            emoji = reply.file.emoji
                else:
                    await utils.answer(
                        message, self.strings("unsupported_err", message))
                    return
            except AttributeError:
                photo = io.BytesIO()
                await self.client.download_media(reply.photo, photo)
                emoji = reply.file.emoji
        else:
            await utils.answer(message, self.strings("reply_err", message))
            return

        if silent_mode != "on":
            await utils.answer(message, self.strings("gettingType_msg",
                                                     message))

        if photo or is_anim:
            splat = message.text.split()
            if not emoji:
                emoji = "🤔"
            pack = 1
            if len(splat) == 3:
                pack = splat[2]  # User sent both
                emoji = splat[1]
            elif len(splat) == 2:
                if splat[1].isnumeric():
                    pack = int(splat[1])
                else:
                    emoji = splat[1]

            packname = f"a{user.id}_by_{user.username}_{pack}"
            packnick = self.config["pack_name"].replace(
                "%username%",
                f"@{user.username}").replace("%packNumber%", str(pack))
            cmd = "/newpack"
            file = io.BytesIO()

            if not is_anim:
                image = await resize_photo(photo)
                file.name = "sticker.png"
                image.save(file, "PNG")
                if silent_mode != "on":
                    await utils.answer(
                        message, self.strings("image_kanging_msg", message))
            else:
                packname += "_anim"
                packnick += " animated"
                cmd = "/newanimated"
                if silent_mode != "on":
                    await utils.answer(
                        message, self.strings("animated_kanging_msg", message))
            try:
                response = await self.client(
                    GetStickerSetRequest(stickerset=InputStickerSetShortName(
                        short_name=packname)))
            except StickersetInvalidError:
                response = None

            if response is not None:
                async with self.client.conversation("Stickers") as conv:
                    await conv.send_message("/addsticker")
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message(packname)
                    x = await conv.get_response()
                    mtext = x.text
                    while "120" in mtext:
                        pack += 1
                        packname = f"a{user.id}_by_{user.username}_{pack}"
                        packnick = self.config["pack_name"]
                        packnick = packnick.replace(
                            "%username%", f"@{user.username}").replace(
                                "%packNumber%", str(pack))
                        if silent_mode != "on":
                            await utils.answer(
                                message,
                                self.strings("switching_msg",
                                             message).format(str(pack)))
                        await conv.send_message(packname)
                        x = await conv.get_response()
                        mtext = x.text
                        if x.text == "Invalid pack selected." or x.text == "Не выбран набор стикеров.":
                            await conv.send_message(cmd)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.send_message(packnick)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            if is_anim:
                                await conv.send_file("AnimatedSticker.tgs",
                                                     force_document=True)
                                DelFile("AnimatedSticker.tgs")
                            else:
                                file.seek(0)
                                await conv.send_file(file, force_document=True)
                            await conv.get_response()
                            await conv.send_message(emoji)
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await conv.send_message("/publish")
                            if is_anim:
                                await conv.get_response()
                                await conv.send_message(f"<{packnick}>")
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.send_message("/skip")
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await conv.send_message(packname)
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await conv.get_response()
                            await self.client.send_read_acknowledge(
                                conv.chat_id)
                            await utils.answer(
                                message,
                                self.strings(
                                    "added_to_different_msg", message).format(
                                        f"t.me/addstickers/{packname}"))
                            await sleep(5)
                            await message.delete()
                            return
                    if is_anim:
                        await conv.send_file("AnimatedSticker.tgs",
                                             force_document=True)  # noqa: E128
                        DelFile("AnimatedSticker.tgs")
                    else:
                        file.seek(0)
                        await conv.send_file(file, force_document=True)
                    await conv.get_response()
                    await conv.send_message(emoji)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message("/done")
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
            else:
                if silent_mode != "on":
                    await utils.answer(message,
                                       self.strings("pack_notExist", message))
                async with self.client.conversation("Stickers") as conv:
                    await conv.send_message(cmd)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message(packnick)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    if is_anim:
                        await conv.send_file("AnimatedSticker.tgs",
                                             force_document=True)  # noqa: E128
                        DelFile("AnimatedSticker.tgs")
                    else:
                        file.seek(0)
                        await conv.send_file(file, force_document=True)
                    await conv.get_response()
                    await conv.send_message(emoji)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message("/publish")
                    if is_anim:
                        await conv.get_response()
                        await conv.send_message(f"<{packnick}>")
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.send_message("/skip")
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await conv.send_message(packname)
                    await self.client.send_read_acknowledge(conv.chat_id)
                    await conv.get_response()
                    await self.client.send_read_acknowledge(conv.chat_id)
            await utils.answer(
                message,
                self.strings("added_msg",
                             message).format(f"t.me/addstickers/{packname}"))
            await sleep(5)
            await message.delete()