Beispiel #1
0
async def auto(event):
    metod = event.pattern_match.group(1).lower()

    if str(metod) != "isim" and str(metod) != "bio":
        await event.edit(
            f"Bilinmeyen tür. Var olan türler: `isim`, `bio` {metod}")
        return

    if metod in ASYNC_POOL:
        await event.edit(
            f"`Görünüşe göre {metod} zaten otomatik olarak değişiyor.`")
        return

    await event.edit(f"`{metod} ayarlanıyor ...`")
    if metod == "isim":
        HM = time.strftime("%H:%M")

        await event.client(
            functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                last_name=f"⏰{HM}"))
    elif metod == "bio":
        DMY = time.strftime("%d.%m.%Y")
        HM = time.strftime("%H:%M")

        Bio = f"📅 Tarih: {DMY} | ⌚️ Saat: {HM} | @SedenUserBot"
        await event.client(
            functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                about=Bio))

    await event.edit(f"`{metod} ayarlandı :)`")

    ASYNC_POOL.append(metod)

    while metod in ASYNC_POOL:
        try:
            if metod == "isim":
                HM = time.strftime("%H:%M")

                await event.client(
                    functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                        last_name=f"⏰{HM}"))
            elif metod == "bio":
                DMY = time.strftime("%d.%m.%Y")
                HM = time.strftime("%H:%M")

                Bio = f"📅 Tarih: {DMY} | ⌚️ Saat: {HM} | @SedenUserBot"
                await event.client(
                    functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                        about=Bio))

            await asyncio.sleep(60)
        except:
            return
Beispiel #2
0
async def auto(event):
    metod = event.pattern_match.group(1).lower()
    
    if str(metod) != "ad" and str(metod) != "bio":
        await event.edit(LANG['INVALID_TYPE'])
        return

    if metod in ASYNC_POOL:
        await event.edit(LANG['ALREADY'] % metod)
        return

    await event.edit(LANG['SETTING'] % metod)
    if metod == "ad":
        HM = time.strftime("%H:%M")

        await event.client(functions.account.UpdateProfileRequest(
            last_name=LANG['NAME'] % HM
        ))
    elif metod == "bio":
        DMY = time.strftime("%d.%m.%Y")
        HM = time.strftime("%H:%M")

        Bio = LANG['BIO'].format(tarih=DMY, saat=HM) + LANG['NICK'] 
        await event.client(functions.account.UpdateProfileRequest(
            about=Bio
        ))


    await event.edit(LANG['SETTED'] % metod)

    ASYNC_POOL.append(metod)

    while metod in ASYNC_POOL:
        try:
            if metod == "ad":
                HM = time.strftime("%H:%M")

                await event.client(functions.account.UpdateProfileRequest(
                    last_name=LANG['NAME'] % HM
                ))
            elif metod == "bio":
                DMY = time.strftime("%d.%m.%Y")
                HM = time.strftime("%H:%M")

                Bio = LANG['BIO'].format(tarix=DMY, saat=HM) + LANG['NICK'] 
                await event.client(functions.account.UpdateProfileRequest(
                    about=Bio
                ))

            await asyncio.sleep(60)
        except:
            return
Beispiel #3
0
async def autovideo(event):
    if 'autovideo' in ASYNC_POOL:
        await event.edit(LANG['VIDEO_ALREADY_CHANGING'])
        return

    if not event.reply_to_msg_id:
        return await event.edit(LANG['NEED_VIDEO'])
    else:
        await event.edit(LANG['SETTING_VIDEO'])

        # Telethon doesn't support download profile-video so ... #
        reply = await event.get_reply_message()
        video = await reply.download_media()
        yazi = event.pattern_match.group(1)

    try:
        os.remove("./pp.mp4")
    except:
        pass

    try:
        await event.client(
            functions.photos.UploadProfilePhotoRequest(
                video=await event.client.upload_file(video)))
    except VideoFileInvalidError:
        return await event.edit(LANG['INVALID_VIDEO'])

    ASYNC_POOL.append('autovideo')

    await event.edit(LANG['STARTED_VIDEO'])
    while "autovideo" in ASYNC_POOL:
        saat = time.strftime("%H\.%M")
        tarih = time.strftime("%d\/%m\/%Y")

        if yazi:
            yazi = yazi.replace("$saat", saat).replace("$tarih", tarih)
            KOMUT = f"text=\'{yazi}\' :expansion=normal: y=h-line_h-10:x=(mod(5*n\,w+tw)-tw): fontcolor=white: fontsize=30: box=1: [email protected]: boxborderw=5: shadowx=2: shadowy=2"
        else:
            KOMUT = f"text=\'Saat\: {saat} Tarih\: {tarih} {yazi}\' :expansion=normal: y=h-line_h-10:x=(mod(5*n\,w+tw)-tw): fontcolor=white: fontsize=30: box=1: [email protected]: boxborderw=5: shadowx=2: shadowy=2"

        ses = await asyncio.create_subprocess_shell(
            f"ffmpeg -y -i '{video}' -vf drawtext=\"{KOMUT}\" pp.mp4")
        await ses.communicate()

        await event.client(
            functions.photos.UploadProfilePhotoRequest(
                video=await event.client.upload_file("pp.mp4")))
        os.remove("./pp.mp4")
        await asyncio.sleep(60)

    os.remove(video)
Beispiel #4
0
async def autopic(event):
    if 'autopic' in ASYNC_POOL:
        await event.edit(
            "`Görünüşe göre profil fotoğrafınız zaten otomatik olarak değişiyor.`"
        )
        return

    await event.edit("`Profil fotoğrafınız ayarlanıyor ...`")

    FONT_FILE_TO_USE = await get_font_file(event.client, "@FontDunyasi")

    downloaded_file_name = "./userbot/eskipp.png"
    downloader = SmartDL(AUTO_PP, downloaded_file_name, progress_bar=True)
    downloader.start(blocking=False)
    photo = "yenipp.png"
    while not downloader.isFinished():
        continue

    await event.edit("`Profil fotoğrafınız ayarlandı :)`")

    ASYNC_POOL.append('autopic')

    while 'autopic' in ASYNC_POOL:
        shutil.copy(downloaded_file_name, photo)
        current_time = datetime.now().strftime("%H:%M")
        img = Image.open(photo)
        drawn_text = ImageDraw.Draw(img)
        fnt = ImageFont.truetype(FONT_FILE_TO_USE, 70)
        size = drawn_text.multiline_textsize(current_time, font=fnt)
        drawn_text.text(((img.width - size[0]) / 2, (img.height - size[1])),
                        current_time,
                        font=fnt,
                        fill=(255, 255, 255))
        img.save(photo)
        file = await event.client.upload_file(photo)  # pylint:disable=E0602
        try:
            await event.client(
                functions.photos.UploadProfilePhotoRequest(  # pylint:disable=E0602
                    file))
            os.remove(photo)
            await asyncio.sleep(60)
        except:
            return
Beispiel #5
0
async def autopic(event):
    if 'autopic' in ASYNC_POOL:
        await event.edit(LANG['PHOTO_ALREADY_CHANGING'])
        return

    await event.edit(LANG['SETTING'])

    FONT_FILE_TO_USE = await get_font_file(event.client, "@FontDunyasi")

    downloaded_file_name = "./userbot/eskipp.png"
    r = requests.get(AUTO_PP)

    with open(downloaded_file_name, 'wb') as f:
        f.write(r.content)
    photo = "yenipp.png"
    await event.edit(LANG['SETTED'])

    ASYNC_POOL.append('autopic')

    while 'autopic' in ASYNC_POOL:
        shutil.copy(downloaded_file_name, photo)
        current_time = datetime.now().strftime("%H:%M")
        img = Image.open(photo)
        drawn_text = ImageDraw.Draw(img)
        fnt = ImageFont.truetype(FONT_FILE_TO_USE, 70)
        size = drawn_text.multiline_textsize(current_time, font=fnt)
        drawn_text.text(((img.width - size[0]) / 2, (img.height - size[1])),
                        current_time,
                        font=fnt,
                        fill=(255, 255, 255))
        img.save(photo)
        file = await event.client.upload_file(photo)  # pylint:disable=E0602
        try:
            await event.client(
                functions.photos.UploadProfilePhotoRequest(  # pylint:disable=E0602
                    file))
            os.remove(photo)
            await asyncio.sleep(60)
        except:
            return
async def galeri(event):
    try:
        import userbot.modules.sql_helper.galeri_sql as sql
    except:
        await event.edit("`SQL dışı mod'ta galeri çalışmaz!`")
    secenek = event.pattern_match.group(1)
    secen = secenek.split(" ")
    if secen[0] == "ekle":
        if len(secen) > 1:
            URL = re.search(URL_REGEX, secen[1])
            if URL != None:
                sql.ekle_foto(secen[1])
                sql.getir_foto()
                await event.edit(LANG['ADDED_LIST'])
            else:
                await event.edit(LANG['INVALID_URL'])
        else:
            await event.edit(LANG['EXAMPLE'])
    elif secen[0] == "liste":
        yfoto = ""
        sql.getir_foto()
        fotolar = sql.TUM_GALERI
        for foto in fotolar:
            yfoto += f"\n▶️ ({foto.g_id}) [Fotoğraf]({foto.foto})"
        await event.edit(f"**{LANG['LIST']}**\n" + yfoto)
    elif secen[0] == "sil":
        if secen[1].isdigit():
            silme = sql.sil_foto(secen[1])
            if silme == True:
                await event.edit(LANG['REMOVED'])
            else:
                await event.edit(f"{LANG['REMOVED_ERROR']}: {silme}")
        else:
            await event.edit(f"**{LANG['NEED_NUMBER']}** `.galeri sil 2`")
    elif secen[0] == "başla":
        if "galeri" in ASYNC_POOL:
            await event.edit(LANG['WORKING'])
            return
        ASYNC_POOL.append("galeri")
        sql.getir_foto()
        await event.edit(LANG['STARTED'])
        if len(sql.TUM_GALERI) >= 1:
            while "galeri" in ASYNC_POOL:
                fotolar = sql.TUM_GALERI
                i = 0
                while i < len(fotolar):
                    if not "galeri" in ASYNC_POOL:
                        break
                    if i == len(fotolar):
                        i = 0
                    await FotoDegistir(i)
                    await asyncio.sleep(GALERI_SURE)
                    i += 1
        else:
            await event.edit(LANG['NEED_PHOTO'])
            return
    elif secen[0] == "kapa":
        if "galeri" in ASYNC_POOL:
            ASYNC_POOL.remove("galeri")
            await event.edit(LANG['STOPPED'])
        else:
            event.edit(LANG['ALREADY_STOP'])
        return
    else:
        await event.edit(LANG['INVALID'])
Beispiel #7
0
async def degistir(event):
    try:
        import userbot.modules.sql_helper.galeri_sql as sql
    except:
        await event.edit("`SQL dışı mod'ta galeri çalışmaz!`")
    secenek = event.pattern_match.group(1)
    secen = secenek.split(" ")
    if secen[0] == "ekle":
        if len(secen) > 1:
            URL = re.search(URL_REGEX, secen[1])
            print(URL)
            if URL != None:
                sql.ekle_foto(secen[1])
                sql.getir_foto()
                await event.edit("`Fotoğraf sıraya alındı.`")
            else:
                await event.edit("`Geçersiz bir resim URL'si girdiniz. Kullanım hakkında bir fikriniz yoksa, ` `.asena galeri` `yazınız.`")
        else:
            await event.edit("`Lütfen bir resim adresi giriniz. Örnek olarak: ` `.galeri ekle https://i.resimyukle.xyz/7Qbbc9.jpeg`")
    elif secen[0] == "liste":
        yfoto = ""
        sql.getir_foto()
        fotolar = sql.TUM_GALERI
        for foto in fotolar:
            yfoto += f"\n▶️ ({foto.g_id}) [Fotoğraf]({foto.foto})"
        await event.edit("**Sıraya Aldığınız Fotoğraflar**\n" + yfoto)
    elif secen[0] == "sil":
        if secen[1].isdigit():
            silme = sql.sil_foto(secen[1])
            if silme == True:
                await event.edit("**Sıradaki fotoğraf başarıyla kaldırıldı**")
            else:
                await event.edit(f"**Sıradaki fotoğraf kaldırılamadı** Hata: {silme}")
        else:
            await event.edit("**Lütfen resmin sırasını belirtiniz. Örnek:** `.galeri sil 2`")
    elif secen[0] == "başla":
        if "galeri" in ASYNC_POOL:
            await event.edit("`Hali hazırda galeri çalışıyor.`")
            return
        ASYNC_POOL.append("galeri")
        sql.getir_foto()
        await event.edit("`Galeri çalışmaya başladı.`")
        if len(sql.TUM_GALERI) >= 1:
            while "galeri" in ASYNC_POOL:
                fotolar = sql.TUM_GALERI
                i = 0
                while i < len(fotolar):
                    if not "galeri" in ASYNC_POOL:
                        break
                    if i == len(fotolar):
                        i = 0
                    await FotoDegistir(i)
                    await asyncio.sleep(GALERI_SURE)
                    i += 1
        else:
            await event.edit("`Galeri çalışması için fotoğraf eklemeniz gerekmektedir. Eklemeyi bilmiyorsanız .asena galeri ile kullanım hakkında bilgi sahibi olabilirsiniz.`")
            return
    elif secen[0] == "kapa":
        if "galeri" in ASYNC_POOL:
            ASYNC_POOL.remove("galeri")
            await event.edit("`Galeri durduruldu!`")
        else:
            event.edit("`Galeri zaten çalışmıyor.`")
        return
    else:
        await event.edit("**Bilinmeyen komut** Kullanım:\n\nGaleri'ye fotoğraf ekleme: `.galeri ekle https://i.resimyukle.xyz/7Qbbc9.jpeg`\nGaleri listesini görme: `.galeri liste`\nSıradan bir fotoğrafı silme: `.galeri sil <sıra sayısı>`")
Beispiel #8
0
async def auto(event):
    metod = event.pattern_match.group(1).lower()

    if str(metod) != "isim" and str(metod) != "bio" and str(metod) != "pp":
        await event.edit(LANG['INVALID_TYPE'])
        return

    if metod in ASYNC_POOL:
        await event.edit(LANG['ALREADY'] % metod)
        return

    await event.edit(LANG['SETTING'] % metod)
    if metod == "isim":
        HM = time.strftime("%H:%M")

        await event.client(
            functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                last_name=LANG['NAME'] % HM))

    elif metod == "bio":
        DMY = time.strftime("%d.%m.%Y")
        HM = time.strftime("%H:%M")

        Bio = LANG['BIO'].format(tarih=DMY, saat=HM) + LANG['NICK']
        await event.client(
            functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                about=Bio))

    elif str(metod) == "pp":
        FONT_FILE_TO_USE = await get_font_file(event.client, "@FontDunyasi")

        downloaded_file_name = "./userbot/eskipp.png"
        r = requests.get(AUTO_PP)

        with open(downloaded_file_name, 'wb') as f:
            f.write(r.content)
        photo = "yenipp.png"

    ASYNC_POOL.append(metod)

    await event.edit(LANG['SETTED'] % metod)

    while metod in ASYNC_POOL:
        try:
            if metod == "isim":
                HM = time.strftime("%H:%M")

                await event.client(
                    functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                        last_name=LANG['NAME'] % HM))
            elif metod == "bio":
                DMY = time.strftime("%d.%m.%Y")
                HM = time.strftime("%H:%M")

                Bio = LANG['BIO'].format(tarih=DMY, saat=HM) + LANG['NICK']
                await event.client(
                    functions.account.UpdateProfileRequest(  # pylint:disable=E0602
                        about=Bio))

            elif metod == 'pp':
                shutil.copy(downloaded_file_name, photo)
                current_time = datetime.now().strftime("%H:%M")
                img = Image.open(photo)
                drawn_text = ImageDraw.Draw(img)
                fnt = ImageFont.truetype(FONT_FILE_TO_USE, 70)
                size = drawn_text.multiline_textsize(current_time, font=fnt)
                drawn_text.text(
                    ((img.width - size[0]) / 2, (img.height - size[1])),
                    current_time,
                    font=fnt,
                    fill=(255, 255, 255))
                img.save(photo)
                file = await event.client.upload_file(photo)  # pylint:disable=E0602
                try:
                    await event.client(
                        functions.photos.UploadProfilePhotoRequest(  # pylint:disable=E0602
                            file))
                    os.remove(photo)
                    await asyncio.sleep(60)
                except:
                    return

            await asyncio.sleep(60)
        except:
            return