-
Notifications
You must be signed in to change notification settings - Fork 5
/
ascii.py
106 lines (95 loc) · 3.68 KB
/
ascii.py
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#Ascii module by @legendx22 for @LEGENDBOT_official
#A over powerful bot
#I know u will kang...
#GTFO!! MOTHERFUCKER!!!!!!!!!!!
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from ULTRA.utils import admin_cmd, edit_or_reply, sudo_cmd
from ULTRA import CMD_HELP, ALIVE_NAME
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell User"
USERID = bot.uid
mention = f"[{DEFAULTUSER}](tg://user?id={USERID})"
@bot.on(admin_cmd("ascii ?(.*)"))
@bot.on(sudo_cmd(pattern="ascii ?(.*)", allow_sudo=True))
async def _(event):
if event.fwd_from:
return
if not event.reply_to_msg_id:
await edit_or_reply(event, "Reply to any user message.😒🤐")
return
reply_message = await event.get_reply_message()
if not reply_message.media:
await edit_or_reply(event, "Reply to media message😒🤐")
return
chat = "@asciiart_bot"
reply_message.sender
if reply_message.sender.bot:
await edit_or_reply(event, "Reply to actual users message.😒🤐")
return
legendx22 = await edit_or_reply(event, "Wait making ASCII...🤓🔥🔥")
async with event.client.conversation(chat) as conv:
try:
response = conv.wait_event(
events.NewMessage(incoming=True, from_users=164766745)
)
await event.client.send_message(chat, reply_message)
response = await response
except YouBlockedUserError:
await legendx22.edit("`Please unblock @asciiart_bot and try again`")
return
if response.text.startswith("Forward"):
await legendx22.edit(
"`can you kindly disable your forward privacy settings for good?`"
)
else:
await legendx22.delete()
await event.client.send_file(
event.chat_id,
response.message.media,
caption=f"**Image Type :** ASCII Art\n**Uploaded By :** {mention}",
)
await event.client.send_read_acknowledge(conv.chat_id)
@bot.on(admin_cmd(pattern="line ?(.*)"))
@bot.on(sudo_cmd(pattern="line ?(.*)", allow_sudo=True))
async def _(event):
if event.fwd_from:
return
if not event.reply_to_msg_id:
await edit_or_reply(event, "Reply to any user message.😒🤐")
return
reply_message = await event.get_reply_message()
if not reply_message.media:
await edit_or_reply(event, "Reply to media message😒🤐")
return
chat = "@Lines50Bot"
reply_message.sender
if reply_message.sender.bot:
await edit_or_reply(event, "Reply to actual users message.😒🤐")
return
legendx22 = await edit_or_reply(event, "`Processing`")
async with event.client.conversation(chat) as conv:
try:
await conv.send_message("/start")
await conv.get_response()
await conv.send_message(reply_message)
await conv.get_response()
pic = await conv.get_response()
await event.client.send_read_acknowledge(conv.chat_id)
except YouBlockedUserError:
await legendx22.edit("Please unblock @Lines50Bot and try again")
return
await legendx22.delete()
await event.client.send_file(
event.chat_id,
pic,
caption=f"**Image Type :** LINE Art \n**Uploaded By :** {mention}",
)
CMD_HELP.update(
{
"ascii": "__**PLUGIN NAME :** ascii__\
\n\n** CMD ** `.ascii` reply to any image file:\
\n**USAGE : **Makes an image ascii style, try out your own.\
\n\n** CMD ** `.line` reply to any image file:\
\n**USAGE : **Makes an image line style.\ "
}
)