-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhearts.py
More file actions
82 lines (71 loc) · 2.43 KB
/
hearts.py
File metadata and controls
82 lines (71 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# By AmokDev
# Refactor and optimising A9FM
# https://github.com/AmokDEV/lordnet/blob/main/modules/hearts.py
import asyncio
import random
from pyrogram import Client, filters
from command import fox_command, fox_sudo, who_message
from pyrogram.errors.exceptions.flood_420 import FloodWait
import os
R = "❤️"
W = "🤍"
heart_list = [
W * 9,
W * 2 + R * 2 + W + R * 2 + W * 2,
W + R * 7 + W,
W + R * 7 + W,
W + R * 7 + W,
W * 2 + R * 5 + W * 2,
W * 3 + R * 3 + W * 3,
W * 4 + R + W * 4,
W * 9,
]
joined_heart = "\n".join(heart_list)
heartlet_len = joined_heart.count(R)
SLEEP = 0.1
async def _wrap_edit(message, text: str):
try:
await message.edit(text)
except FloodWait as fl:
await asyncio.sleep(fl.x)
async def phase1(message):
BIG_SCROLL = "🧡💛💚💙💜🖤🤎"
await _wrap_edit(message, joined_heart)
for heart in BIG_SCROLL:
await _wrap_edit(message, joined_heart.replace(R, heart))
await asyncio.sleep(SLEEP)
async def phase2(message):
ALL = ["❤️"] + list("🧡💛💚💙💜🤎🖤")
format_heart = joined_heart.replace(R, "{}")
for _ in range(5):
heart = format_heart.format(*random.choices(ALL, k=heartlet_len))
await _wrap_edit(message, heart)
await asyncio.sleep(SLEEP)
async def phase3(message):
await _wrap_edit(message, joined_heart)
await asyncio.sleep(SLEEP * 2)
repl = joined_heart
for _ in range(joined_heart.count(W)):
repl = repl.replace(W, R, 1)
await _wrap_edit(message, repl)
await asyncio.sleep(SLEEP)
async def phase4(message):
for i in range(7, 0, -1):
heart_matrix = "\n".join([R * i] * i)
await _wrap_edit(message, heart_matrix)
await asyncio.sleep(SLEEP)
@Client.on_message(fox_command(["hearts", "magic", "love"], "Hearts", os.path.basename(__file__)) & fox_sudo())
async def hearts(client, message):
message = await who_message(client, message)
await phase1(message)
await phase2(message)
await phase3(message)
await phase4(message)
await asyncio.sleep(SLEEP * 3)
await message.edit("**❤️ I**")
await asyncio.sleep(0.5)
await message.edit("**❤️ I love**")
await asyncio.sleep(0.5)
await message.edit("**❤️ I love you**")
await asyncio.sleep(3)
await message.edit("**❤️ I love you <3**")