Advertisement
l1von

sd

Feb 1st, 2021
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1.         elif status == 4:
  2.             rj = random.randint(1, 2)
  3.             if rj == 1:
  4.                 random_filename = f"randomimg_{random.randint(0, 10000000000000000000000000)}.jpg"
  5.                 dem_filename = f"result_{random.randint(0, 10000000000000000000000000)}.jpg"
  6.                 if text_lines >= 10 and pic_count >= 1:
  7.                     if message.peer_id not in dialogs or time.time() >= dialogs[message.peer_id]:
  8.                         print(message.from_id)
  9.                         print("ГЕНЕРИРУЕМ ПО КОМАНДЕ")
  10.                         with open(chat_path, encoding="utf8") as file:
  11.                             texts = file.read().splitlines()
  12.                         with open(picture_path, encoding="utf8") as file:
  13.                             pictures = file.read().splitlines()
  14.                         ll = random.randint(1, 12)
  15.                         if ll == 1:
  16.                             rndtxt = random.choice(texts)
  17.                             texts.remove(rndtxt)
  18.                             rndtxt2 = random.choice(texts)
  19.                             texts.remove(rndtxt2)
  20.                             if len(rndtxt) >= 30:
  21.                                 rndtxt = rndtxt[:30]
  22.                             if len(rndtxt2) >= 30:
  23.                                 rndtxt2 = rndtxt2[:30]
  24.                             photo1 = Image.open("mem.jpg")
  25.                             font = ImageFont.truetype("arialbd.ttf", size=30)
  26.                             idraw = ImageDraw.Draw(photo1)
  27.                             idraw.text((90, 5), rndtxt, font=font, fill='black')
  28.                             idraw.text((70, 82), rndtxt2, font=font, fill='black')
  29.                             photo1.save(dem_filename)
  30.                             photo = await photo_uploader.upload_message_photo(dem_filename)
  31.                             await message(attachment=photo)
  32.                             os.remove(dem_filename)
  33.                             dialogs[message.peer_id] = time.time() + 15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement