Spaces:
Paused
Paused
Danish
xditya
Danish
buddhhu
sppidy
Arnab Paryali
divkix
hellboi_atul
Programming Error
New-dev0
commited on

Commit
·
4b0544a
1
Parent(s):
71fe41d
Bug fixes V0.0.5
Browse filesCo-authored-by: Aditya <[email protected]>
Co-authored-by: Danish <[email protected]>
Co-authored-by: buddhhu <[email protected]>
Co-authored-by: sppidy <[email protected]>
Co-authored-by: Arnab Paryali <[email protected]>
Co-authored-by: divkix <[email protected]>
Co-authored-by: hellboi_atul <[email protected]>
Co-authored-by: Programming Error <[email protected]>
Co-authored-by: New-dev0 <[email protected]>
- Dockerfile +10 -9
- README.md +1 -1
- assistant/inlinestuff.py +1 -1
- assistant/othervars.py +31 -0
- assistant/start.py +16 -6
- plugins/_help.py +1 -1
- plugins/_tagnotifs.py +5 -2
- plugins/admintools.py +51 -1
- plugins/afk.py +7 -6
- plugins/blacklist.py +3 -6
- plugins/bot.py +6 -1
- plugins/broadcast.py +7 -5
- plugins/channelhacks.py +4 -4
- plugins/core.py +1 -1
- plugins/dm.py +3 -0
- plugins/filter.py +4 -8
- plugins/glitch.py +5 -2
- plugins/globaltools.py +8 -8
- plugins/google.py +1 -1
- plugins/greetings.py +36 -31
- plugins/groups.py +20 -14
- plugins/mediainfo.py +38 -0
- plugins/mute.py +3 -3
- plugins/notes.py +3 -10
- plugins/pmpermit.py +68 -8
- plugins/profile.py +1 -2
- plugins/snips.py +4 -8
- plugins/stickertools.py +7 -5
- plugins/sudo.py +5 -8
- plugins/tools.py +1 -2
- plugins/updater.py +4 -3
- plugins/utilities.py +9 -7
- plugins/vcplugin.py +7 -5
- plugins/webshot.py +1 -1
- requirements.txt +6 -1
- resources/session/ssgen.py +5 -5
- resources/startup/locals.py +9 -6
- src/handlers/queue.ts +2 -2
- src/handlers/skip.ts +3 -2
- src/tgcalls.ts +31 -26
- vcstarter.py +45 -34
Dockerfile
CHANGED
@@ -4,17 +4,18 @@
|
|
4 |
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
5 |
|
6 |
FROM ultroidteam/ultroid:0.0.3
|
7 |
-
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
|
8 |
-
dpkg -i ./google-chrome-stable_current_amd64.deb; apt -fqqy install && \
|
9 |
-
rm ./google-chrome-stable_current_amd64.deb
|
10 |
-
RUN wget -O chromedriver.zip http://chromedriver.storage.googleapis.com/$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
|
11 |
-
unzip chromedriver.zip chromedriver -d /usr/bin/ && \
|
12 |
-
rm chromedriver.zip
|
13 |
RUN curl --silent --location https://deb.nodesource.com/setup_15.x | bash -
|
14 |
-
RUN apt-get install -y nodejs
|
15 |
RUN git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/
|
16 |
-
WORKDIR /root/TeamUltroid/
|
17 |
RUN git clone https://github.com/1Danish-00/glitch_me.git && pip install -e ./glitch_me
|
|
|
18 |
RUN pip install -r requirements.txt
|
19 |
-
RUN
|
|
|
20 |
RUN npm run build
|
|
|
4 |
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
5 |
|
6 |
FROM ultroidteam/ultroid:0.0.3
|
7 |
+
#RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
|
8 |
+
# dpkg -i ./google-chrome-stable_current_amd64.deb; apt -fqqy install && \
|
9 |
+
# rm ./google-chrome-stable_current_amd64.deb
|
10 |
+
#RUN wget -O chromedriver.zip http://chromedriver.storage.googleapis.com/$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
|
11 |
+
# unzip chromedriver.zip chromedriver -d /usr/bin/ && \
|
12 |
+
# rm chromedriver.zip
|
13 |
RUN curl --silent --location https://deb.nodesource.com/setup_15.x | bash -
|
14 |
+
RUN apt-get install -y nodejs
|
15 |
RUN git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/
|
|
|
16 |
RUN git clone https://github.com/1Danish-00/glitch_me.git && pip install -e ./glitch_me
|
17 |
+
WORKDIR /root/TeamUltroid/
|
18 |
RUN pip install -r requirements.txt
|
19 |
+
RUN rm -rf /usr/local/lib/python3.9/site-packages/.wh*
|
20 |
+
RUN npm install -g [email protected] && npm install
|
21 |
RUN npm run build
|
README.md
CHANGED
@@ -46,7 +46,7 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
|
|
46 |
### Local Deploy - Easy Method
|
47 |
- Linux - `bash -c "$(curl -fsSL https://git.io/JY9UM)"`
|
48 |
- Windows - `cd desktop ; wget https://del.dog/raw/ultroid-termux -o locals.py ; python locals.py`
|
49 |
-
- Termux - `sh -c "$(curl -fsSL https://del.dog/raw/ultroid-termux)"`
|
50 |
|
51 |
### Local Deploy - Traditional Method
|
52 |
- Get your [Necessary Variables](#Necessary-Variables)
|
|
|
46 |
### Local Deploy - Easy Method
|
47 |
- Linux - `bash -c "$(curl -fsSL https://git.io/JY9UM)"`
|
48 |
- Windows - `cd desktop ; wget https://del.dog/raw/ultroid-termux -o locals.py ; python locals.py`
|
49 |
+
- Termux - `sh -c "$(curl -fsSL https://del.dog/raw/ultroid-termux-deploy)"`
|
50 |
|
51 |
### Local Deploy - Traditional Method
|
52 |
- Get your [Necessary Variables](#Necessary-Variables)
|
assistant/inlinestuff.py
CHANGED
@@ -121,7 +121,7 @@ async def _(e):
|
|
121 |
text=f"**File:**\n{file_name}",
|
122 |
buttons=bitton,
|
123 |
)
|
124 |
-
except:
|
125 |
lnk = e.builder.article(
|
126 |
title="fl2lnk",
|
127 |
text="File not found",
|
|
|
121 |
text=f"**File:**\n{file_name}",
|
122 |
buttons=bitton,
|
123 |
)
|
124 |
+
except BaseException:
|
125 |
lnk = e.builder.article(
|
126 |
title="fl2lnk",
|
127 |
text="File not found",
|
assistant/othervars.py
CHANGED
@@ -783,12 +783,43 @@ async def chbot(event):
|
|
783 |
buttons=[
|
784 |
[Button.inline("Cʜᴀᴛ Bᴏᴛ Oɴ", data="onchbot")],
|
785 |
[Button.inline("Cʜᴀᴛ Bᴏᴛ Oғғ", data="ofchbot")],
|
|
|
786 |
[Button.inline("« Bᴀᴄᴋ", data="setter")],
|
787 |
],
|
788 |
link_preview=False,
|
789 |
)
|
790 |
|
791 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
792 |
@callback("onchbot")
|
793 |
@owner
|
794 |
async def chon(event):
|
|
|
783 |
buttons=[
|
784 |
[Button.inline("Cʜᴀᴛ Bᴏᴛ Oɴ", data="onchbot")],
|
785 |
[Button.inline("Cʜᴀᴛ Bᴏᴛ Oғғ", data="ofchbot")],
|
786 |
+
[Button.inline("Bᴏᴛ Wᴇʟᴄᴏɴᴇ", data="bwel")],
|
787 |
[Button.inline("« Bᴀᴄᴋ", data="setter")],
|
788 |
],
|
789 |
link_preview=False,
|
790 |
)
|
791 |
|
792 |
|
793 |
+
@callback("bwel")
|
794 |
+
@owner
|
795 |
+
async def name(event):
|
796 |
+
await event.delete()
|
797 |
+
pru = event.sender_id
|
798 |
+
var = "STARTMSG"
|
799 |
+
name = "Bot Welcome Message:"
|
800 |
+
async with event.client.conversation(pru) as conv:
|
801 |
+
await conv.send_message(
|
802 |
+
"**BOT WELCOME MSG**\nEnter the msg which u want to show when someone start your assistant Bot.\n\nUse /cancel to terminate the operation.",
|
803 |
+
)
|
804 |
+
response = conv.wait_event(events.NewMessage(chats=pru))
|
805 |
+
response = await response
|
806 |
+
themssg = response.message.message
|
807 |
+
if themssg == "/cancel":
|
808 |
+
return await conv.send_message(
|
809 |
+
"Cancelled!!",
|
810 |
+
buttons=get_back_button("chatbot"),
|
811 |
+
)
|
812 |
+
else:
|
813 |
+
await setit(event, var, themssg)
|
814 |
+
await conv.send_message(
|
815 |
+
"{} changed to {}".format(
|
816 |
+
name,
|
817 |
+
themssg,
|
818 |
+
),
|
819 |
+
buttons=get_back_button("chatbot"),
|
820 |
+
)
|
821 |
+
|
822 |
+
|
823 |
@callback("onchbot")
|
824 |
@owner
|
825 |
async def chon(event):
|
assistant/start.py
CHANGED
@@ -10,6 +10,7 @@ from datetime import datetime
|
|
10 |
from pyUltroid.functions.asst_fns import *
|
11 |
from pyUltroid.misc._decorators import sed
|
12 |
from telethon import Button, events
|
|
|
13 |
|
14 |
from plugins import *
|
15 |
|
@@ -28,14 +29,23 @@ async def assistant(event):
|
|
28 |
if not is_added(event.sender_id) and event.sender_id not in sed:
|
29 |
add_user(event.sender_id)
|
30 |
ok = ""
|
31 |
-
if udB.get("PMBOT") == "True":
|
32 |
-
ok = "You can contact my master using this bot!!\n\nSend your Message, I will Deliver it To Master."
|
33 |
if event.is_private and event.sender_id in sed:
|
34 |
return
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
@asst_cmd("start ?(.*)")
|
|
|
10 |
from pyUltroid.functions.asst_fns import *
|
11 |
from pyUltroid.misc._decorators import sed
|
12 |
from telethon import Button, events
|
13 |
+
from telethon.utils import get_display_name
|
14 |
|
15 |
from plugins import *
|
16 |
|
|
|
29 |
if not is_added(event.sender_id) and event.sender_id not in sed:
|
30 |
add_user(event.sender_id)
|
31 |
ok = ""
|
|
|
|
|
32 |
if event.is_private and event.sender_id in sed:
|
33 |
return
|
34 |
+
if not udB.get("STARTMSG"):
|
35 |
+
if udB.get("PMBOT") == "True":
|
36 |
+
ok = "You can contact my master using this bot!!\n\nSend your Message, I will Deliver it To Master."
|
37 |
+
await event.reply(
|
38 |
+
f"Hey there, this is Ultroid Assistant of {OWNER_NAME}!\n\n{ok}",
|
39 |
+
buttons=[Button.url("Know More", url="https://t.me/TeamUltroid")],
|
40 |
+
)
|
41 |
+
else:
|
42 |
+
u = await event.client.get_entity(event.chat_id)
|
43 |
+
me = f"[{ultroid_bot.me.first_name}](tg://user?id={ultroid_bot.uid})"
|
44 |
+
mention = f"[{get_display_name(u)}](tg://user?id={u.id})"
|
45 |
+
await event.reply(
|
46 |
+
Redis("STARTMSG").format(me=me, mention=mention),
|
47 |
+
buttons=[Button.url("Know More", url="https://t.me/TeamUltroid")],
|
48 |
+
)
|
49 |
|
50 |
|
51 |
@asst_cmd("start ?(.*)")
|
plugins/_help.py
CHANGED
@@ -26,7 +26,7 @@ async def ult(ult):
|
|
26 |
output = f"**Plugin** - `{plug}`\n"
|
27 |
for i in HELP[plug]:
|
28 |
output += i
|
29 |
-
output += "\n© @
|
30 |
await eor(ult, output)
|
31 |
elif plug in CMD_HELP:
|
32 |
kk = f"Plugin Name-{plug}\n\n✘ Commands Available -\n\n"
|
|
|
26 |
output = f"**Plugin** - `{plug}`\n"
|
27 |
for i in HELP[plug]:
|
28 |
output += i
|
29 |
+
output += "\n© @TeamUltroid"
|
30 |
await eor(ult, output)
|
31 |
elif plug in CMD_HELP:
|
32 |
kk = f"Plugin Name-{plug}\n\n✘ Commands Available -\n\n"
|
plugins/_tagnotifs.py
CHANGED
@@ -18,8 +18,11 @@ from . import *
|
|
18 |
),
|
19 |
)
|
20 |
async def all_messages_catcher(e):
|
21 |
-
if udB.get("TAG_LOG")
|
22 |
-
|
|
|
|
|
|
|
23 |
x = await ultroid_bot.get_entity(e.sender_id)
|
24 |
if x.bot or x.verified:
|
25 |
return
|
|
|
18 |
),
|
19 |
)
|
20 |
async def all_messages_catcher(e):
|
21 |
+
if udB.get("TAG_LOG"):
|
22 |
+
try:
|
23 |
+
NEEDTOLOG = int(udB.get("TAG_LOG"))
|
24 |
+
except Exception:
|
25 |
+
return LOGS.warning("you given Wrong Grp/Channel ID in TAG_LOG.")
|
26 |
x = await ultroid_bot.get_entity(e.sender_id)
|
27 |
if x.bot or x.verified:
|
28 |
return
|
plugins/admintools.py
CHANGED
@@ -30,6 +30,12 @@
|
|
30 |
• `{i}unpin (all) <reply to message>`
|
31 |
Unpin the message(s) in the chat.
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
• `{i}purge <reply to message>`
|
34 |
Purge all messages from the replied message.
|
35 |
|
@@ -51,7 +57,7 @@ import asyncio
|
|
51 |
from telethon.errors import BadRequestError
|
52 |
from telethon.errors.rpcerrorlist import UserIdInvalidError
|
53 |
from telethon.tl.functions.channels import EditAdminRequest
|
54 |
-
from telethon.tl.types import ChatAdminRights
|
55 |
|
56 |
from . import *
|
57 |
|
@@ -427,4 +433,48 @@ async def editer(edit):
|
|
427 |
i = i + 1
|
428 |
|
429 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
|
|
|
30 |
• `{i}unpin (all) <reply to message>`
|
31 |
Unpin the message(s) in the chat.
|
32 |
|
33 |
+
• `{i}pinned`
|
34 |
+
Get pinned message in the current chat.
|
35 |
+
|
36 |
+
• `{i}listpinned`
|
37 |
+
Get all pinned messages in current chat.
|
38 |
+
|
39 |
• `{i}purge <reply to message>`
|
40 |
Purge all messages from the replied message.
|
41 |
|
|
|
57 |
from telethon.errors import BadRequestError
|
58 |
from telethon.errors.rpcerrorlist import UserIdInvalidError
|
59 |
from telethon.tl.functions.channels import EditAdminRequest
|
60 |
+
from telethon.tl.types import ChatAdminRights, InputMessagesFilterPinned
|
61 |
|
62 |
from . import *
|
63 |
|
|
|
433 |
i = i + 1
|
434 |
|
435 |
|
436 |
+
@ultroid_cmd(pattern="pinned")
|
437 |
+
async def get_pinned(event):
|
438 |
+
x = await eor(event, get_string("com_1"))
|
439 |
+
chat_id = (str(event.chat_id)).replace("-100", "")
|
440 |
+
chat_name = (await event.get_chat()).title
|
441 |
+
tem = ""
|
442 |
+
c = 0
|
443 |
+
|
444 |
+
async for i in ultroid.iter_messages(
|
445 |
+
event.chat_id, filter=InputMessagesFilterPinned
|
446 |
+
):
|
447 |
+
c += 1
|
448 |
+
tem += f"The pinned message in {chat_name} can be found <a href=https://t.me/c/{chat_id}/{i.id}>here.</a>"
|
449 |
+
if c == 1:
|
450 |
+
return await x.edit(tem, parse_mode="html")
|
451 |
+
|
452 |
+
if tem == "":
|
453 |
+
return await eod(x, "There is no pinned message in chat!", time=5)
|
454 |
+
|
455 |
+
|
456 |
+
@ultroid_cmd(pattern="listpinned")
|
457 |
+
async def get_all_pinned(event):
|
458 |
+
x = await eor(event, get_string("com_1"))
|
459 |
+
chat_id = (str(event.chat_id)).replace("-100", "")
|
460 |
+
chat_name = (await event.get_chat()).title
|
461 |
+
a = ""
|
462 |
+
c = 1
|
463 |
+
async for i in ultroid.iter_messages(
|
464 |
+
event.chat_id, filter=InputMessagesFilterPinned
|
465 |
+
):
|
466 |
+
a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>Go to message.</a>\n"
|
467 |
+
c += 1
|
468 |
+
|
469 |
+
if c == 1:
|
470 |
+
m = f"<b>The pinned message in {chat_name}:</b>\n\n"
|
471 |
+
else:
|
472 |
+
m = f"<b>List of pinned message(s) in {chat_name}:</b>\n\n"
|
473 |
+
|
474 |
+
if a == "":
|
475 |
+
return await eod(x, "There is no message pinned in this group!", time=5)
|
476 |
+
|
477 |
+
await x.edit(m + a, parse_mode="html")
|
478 |
+
|
479 |
+
|
480 |
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
|
plugins/afk.py
CHANGED
@@ -42,6 +42,10 @@ LOG = Var.LOG_CHANNEL
|
|
42 |
@ultroid_bot.on(events.NewMessage(outgoing=True))
|
43 |
@ultroid_bot.on(events.MessageEdited(outgoing=True))
|
44 |
async def set_not_afk(event):
|
|
|
|
|
|
|
|
|
45 |
global USER_AFK
|
46 |
global afk_time
|
47 |
global last_afk_message
|
@@ -106,11 +110,10 @@ async def set_not_afk(event):
|
|
106 |
events.NewMessage(incoming=True, func=lambda e: bool(e.mentioned or e.is_private)),
|
107 |
)
|
108 |
async def on_afk(event):
|
109 |
-
if event.fwd_from:
|
110 |
-
return
|
111 |
if event.is_private:
|
112 |
-
if
|
113 |
-
|
|
|
114 |
global USER_AFK
|
115 |
global afk_time
|
116 |
global last_afk_message
|
@@ -156,8 +159,6 @@ async def on_afk(event):
|
|
156 |
|
157 |
@ultroid_cmd(pattern=r"afk ?(.*)")
|
158 |
async def _(event):
|
159 |
-
if event.fwd_from:
|
160 |
-
return
|
161 |
reply = await event.get_reply_message()
|
162 |
global USER_AFK
|
163 |
global afk_time
|
|
|
42 |
@ultroid_bot.on(events.NewMessage(outgoing=True))
|
43 |
@ultroid_bot.on(events.MessageEdited(outgoing=True))
|
44 |
async def set_not_afk(event):
|
45 |
+
if event.is_private:
|
46 |
+
if Redis("PMSETTING") == "True":
|
47 |
+
if not is_approved(event.chat_id):
|
48 |
+
return
|
49 |
global USER_AFK
|
50 |
global afk_time
|
51 |
global last_afk_message
|
|
|
110 |
events.NewMessage(incoming=True, func=lambda e: bool(e.mentioned or e.is_private)),
|
111 |
)
|
112 |
async def on_afk(event):
|
|
|
|
|
113 |
if event.is_private:
|
114 |
+
if Redis("PMSETTING") == "True":
|
115 |
+
if not is_approved(event.chat_id):
|
116 |
+
return
|
117 |
global USER_AFK
|
118 |
global afk_time
|
119 |
global last_afk_message
|
|
|
159 |
|
160 |
@ultroid_cmd(pattern=r"afk ?(.*)")
|
161 |
async def _(event):
|
|
|
|
|
162 |
reply = await event.get_reply_message()
|
163 |
global USER_AFK
|
164 |
global afk_time
|
plugins/blacklist.py
CHANGED
@@ -34,7 +34,7 @@ async def af(e):
|
|
34 |
if e.is_group:
|
35 |
if not e._chat.admin_rights:
|
36 |
return await eod(e, "`You are Not Admin Here`")
|
37 |
-
wrd = e.pattern_match.group(1)
|
38 |
chat = e.chat_id
|
39 |
if not (wrd):
|
40 |
return await eod(e, "`Give the word to blacklist..`")
|
@@ -48,7 +48,7 @@ async def rf(e):
|
|
48 |
if e.is_group:
|
49 |
if not e._chat.admin_rights:
|
50 |
return await eod(e, "`You are Not Admin Here`")
|
51 |
-
wrd = e.pattern_match.group(1)
|
52 |
chat = e.chat_id
|
53 |
if not wrd:
|
54 |
return await eod(e, "`Give the word to remove from blacklist..`")
|
@@ -71,12 +71,9 @@ async def lsnote(e):
|
|
71 |
|
72 |
@ultroid_bot.on(events.NewMessage(incoming=True))
|
73 |
async def bl(e):
|
74 |
-
if e.is_group:
|
75 |
-
if not e._chat.admin_rights:
|
76 |
-
return
|
77 |
-
xx = e.text
|
78 |
chat = e.chat_id
|
79 |
x = get_blacklist(int(chat))
|
|
|
80 |
if x and xx:
|
81 |
if " " in xx:
|
82 |
xx = xx.split(" ")
|
|
|
34 |
if e.is_group:
|
35 |
if not e._chat.admin_rights:
|
36 |
return await eod(e, "`You are Not Admin Here`")
|
37 |
+
wrd = (e.pattern_match.group(1)).lower()
|
38 |
chat = e.chat_id
|
39 |
if not (wrd):
|
40 |
return await eod(e, "`Give the word to blacklist..`")
|
|
|
48 |
if e.is_group:
|
49 |
if not e._chat.admin_rights:
|
50 |
return await eod(e, "`You are Not Admin Here`")
|
51 |
+
wrd = (e.pattern_match.group(1)).lower()
|
52 |
chat = e.chat_id
|
53 |
if not wrd:
|
54 |
return await eod(e, "`Give the word to remove from blacklist..`")
|
|
|
71 |
|
72 |
@ultroid_bot.on(events.NewMessage(incoming=True))
|
73 |
async def bl(e):
|
|
|
|
|
|
|
|
|
74 |
chat = e.chat_id
|
75 |
x = get_blacklist(int(chat))
|
76 |
+
xx = (e.text).lower()
|
77 |
if x and xx:
|
78 |
if " " in xx:
|
79 |
xx = xx.split(" ")
|
plugins/bot.py
CHANGED
@@ -124,7 +124,11 @@ async def cmds(event):
|
|
124 |
pattern="restart$",
|
125 |
)
|
126 |
async def restartbt(ult):
|
127 |
-
|
|
|
|
|
|
|
|
|
128 |
|
129 |
|
130 |
@ultroid_cmd(
|
@@ -144,6 +148,7 @@ async def _(ult):
|
|
144 |
await ultroid.send_file(
|
145 |
ult.chat_id,
|
146 |
file="ultroid.log",
|
|
|
147 |
caption=f"**Ultroid Logs.**\nPasted [here](https://nekobin.com/{key}) too!",
|
148 |
)
|
149 |
await xx.edit("Done")
|
|
|
124 |
pattern="restart$",
|
125 |
)
|
126 |
async def restartbt(ult):
|
127 |
+
if not Var.HEROKU_API:
|
128 |
+
await eor(ult, "`Restarting..`")
|
129 |
+
await bash("pkill python3 && python3 -m pyUltroid")
|
130 |
+
else:
|
131 |
+
await restart(ult)
|
132 |
|
133 |
|
134 |
@ultroid_cmd(
|
|
|
148 |
await ultroid.send_file(
|
149 |
ult.chat_id,
|
150 |
file="ultroid.log",
|
151 |
+
thumb="resources/extras/logo_rdm.png",
|
152 |
caption=f"**Ultroid Logs.**\nPasted [here](https://nekobin.com/{key}) too!",
|
153 |
)
|
154 |
await xx.edit("Done")
|
plugins/broadcast.py
CHANGED
@@ -32,8 +32,9 @@ from . import *
|
|
32 |
|
33 |
@ultroid_cmd(pattern="add ?(.*)", allow_sudo=False)
|
34 |
async def broadcast_adder(event):
|
35 |
-
if
|
36 |
-
|
|
|
37 |
msgg = event.pattern_match.group(1)
|
38 |
x = await eor(event, get_string("bd_1"))
|
39 |
aldone = new = crsh = 0
|
@@ -93,8 +94,9 @@ async def broadcast_adder(event):
|
|
93 |
|
94 |
@ultroid_cmd(pattern="rem ?(.*)", allow_sudo=False)
|
95 |
async def broadcast_remover(event):
|
96 |
-
if
|
97 |
-
|
|
|
98 |
chat_id = event.pattern_match.group(1)
|
99 |
x = await eor(event, get_string("com_1"))
|
100 |
if chat_id == "all":
|
@@ -130,7 +132,7 @@ async def list_all(event):
|
|
130 |
name = ""
|
131 |
try:
|
132 |
name = (await ultroid.get_entity(int(channel))).title
|
133 |
-
except:
|
134 |
name = ""
|
135 |
msg += f"=> **{name}** [`{channel}`]\n"
|
136 |
msg += f"\nTotal {get_no_channels()} channels."
|
|
|
32 |
|
33 |
@ultroid_cmd(pattern="add ?(.*)", allow_sudo=False)
|
34 |
async def broadcast_adder(event):
|
35 |
+
if len(event.text) > 4:
|
36 |
+
if not event.text[4] == " ": # weird fix
|
37 |
+
return
|
38 |
msgg = event.pattern_match.group(1)
|
39 |
x = await eor(event, get_string("bd_1"))
|
40 |
aldone = new = crsh = 0
|
|
|
94 |
|
95 |
@ultroid_cmd(pattern="rem ?(.*)", allow_sudo=False)
|
96 |
async def broadcast_remover(event):
|
97 |
+
if len(event.text) > 4:
|
98 |
+
if not event.text[4] == " ": # weird fix
|
99 |
+
return
|
100 |
chat_id = event.pattern_match.group(1)
|
101 |
x = await eor(event, get_string("com_1"))
|
102 |
if chat_id == "all":
|
|
|
132 |
name = ""
|
133 |
try:
|
134 |
name = (await ultroid.get_entity(int(channel))).title
|
135 |
+
except BaseException:
|
136 |
name = ""
|
137 |
msg += f"=> **{name}** [`{channel}`]\n"
|
138 |
msg += f"\nTotal {get_no_channels()} channels."
|
plugins/channelhacks.py
CHANGED
@@ -88,9 +88,9 @@ async def _(e):
|
|
88 |
return
|
89 |
async for msg in ultroid_bot.iter_messages(int(c), reverse=True):
|
90 |
try:
|
91 |
-
await asyncio.sleep(0.
|
92 |
await ultroid_bot.send_message(int(d), msg)
|
93 |
-
except:
|
94 |
pass
|
95 |
await z.edit("Done")
|
96 |
|
@@ -158,7 +158,7 @@ async def list_all(event):
|
|
158 |
name = ""
|
159 |
try:
|
160 |
name = (await ultroid.get_entity(int(channel))).title
|
161 |
-
except:
|
162 |
name = ""
|
163 |
msg += f"=> **{name}** [`{channel}`]\n"
|
164 |
msg += f"\nTotal {get_no_source_channels()} channels."
|
@@ -242,7 +242,7 @@ async def list_all(event):
|
|
242 |
name = ""
|
243 |
try:
|
244 |
name = (await ultroid.get_entity(int(channel))).title
|
245 |
-
except:
|
246 |
name = ""
|
247 |
msg += f"=> **{name}** [`{channel}`]\n"
|
248 |
msg += f"\nTotal {get_no_destinations()} channels."
|
|
|
88 |
return
|
89 |
async for msg in ultroid_bot.iter_messages(int(c), reverse=True):
|
90 |
try:
|
91 |
+
await asyncio.sleep(0.7)
|
92 |
await ultroid_bot.send_message(int(d), msg)
|
93 |
+
except BaseException:
|
94 |
pass
|
95 |
await z.edit("Done")
|
96 |
|
|
|
158 |
name = ""
|
159 |
try:
|
160 |
name = (await ultroid.get_entity(int(channel))).title
|
161 |
+
except BaseException:
|
162 |
name = ""
|
163 |
msg += f"=> **{name}** [`{channel}`]\n"
|
164 |
msg += f"\nTotal {get_no_source_channels()} channels."
|
|
|
242 |
name = ""
|
243 |
try:
|
244 |
name = (await ultroid.get_entity(int(channel))).title
|
245 |
+
except BaseException:
|
246 |
name = ""
|
247 |
msg += f"=> **{name}** [`{channel}`]\n"
|
248 |
msg += f"\nTotal {get_no_destinations()} channels."
|
plugins/core.py
CHANGED
@@ -42,7 +42,7 @@ async def inline_handler(event):
|
|
42 |
input_str = event.pattern_match.group(1)
|
43 |
plug = [*PLUGINS]
|
44 |
plugs = []
|
45 |
-
if input_str
|
46 |
for i in plug:
|
47 |
try:
|
48 |
plugs.append(
|
|
|
42 |
input_str = event.pattern_match.group(1)
|
43 |
plug = [*PLUGINS]
|
44 |
plugs = []
|
45 |
+
if input_str is None or input_str == "":
|
46 |
for i in plug:
|
47 |
try:
|
48 |
plugs.append(
|
plugins/dm.py
CHANGED
@@ -16,6 +16,9 @@ from . import *
|
|
16 |
|
17 |
@ultroid_cmd(pattern="dm ?(.*)")
|
18 |
async def dm(e):
|
|
|
|
|
|
|
19 |
d = e.pattern_match.group(1)
|
20 |
c = d.split(" ")
|
21 |
try:
|
|
|
16 |
|
17 |
@ultroid_cmd(pattern="dm ?(.*)")
|
18 |
async def dm(e):
|
19 |
+
if len(e.text) > 3:
|
20 |
+
if not e.text[3] == " ": # weird fix
|
21 |
+
return
|
22 |
d = e.pattern_match.group(1)
|
23 |
c = d.split(" ")
|
24 |
try:
|
plugins/filter.py
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
• `{i}remfilter <word>`
|
15 |
Remove the filtered user..
|
16 |
|
17 |
-
• `{i}
|
18 |
list all filters.
|
19 |
"""
|
20 |
|
@@ -29,15 +29,11 @@ from . import *
|
|
29 |
|
30 |
@ultroid_cmd(pattern="addfilter ?(.*)")
|
31 |
async def af(e):
|
32 |
-
wrd = e.pattern_match.group(1)
|
33 |
wt = await e.get_reply_message()
|
34 |
chat = e.chat_id
|
35 |
if not (wt and wrd):
|
36 |
return await eor(e, "`Use this command word to set as filter and reply...`")
|
37 |
-
try:
|
38 |
-
rem_filter(int(chat), wrd)
|
39 |
-
except:
|
40 |
-
pass
|
41 |
if wt and wt.media:
|
42 |
wut = mediainfo(wt.media)
|
43 |
if wut.startswith(("pic", "gif")):
|
@@ -65,7 +61,7 @@ async def af(e):
|
|
65 |
|
66 |
@ultroid_cmd(pattern="remfilter ?(.*)")
|
67 |
async def rf(e):
|
68 |
-
wrd = e.pattern_match.group(1)
|
69 |
chat = e.chat_id
|
70 |
if not wrd:
|
71 |
return await eor(e, "`Give the filter to remove..`")
|
@@ -85,7 +81,7 @@ async def lsnote(e):
|
|
85 |
|
86 |
@ultroid_bot.on(events.NewMessage())
|
87 |
async def fl(e):
|
88 |
-
xx = e.text
|
89 |
chat = e.chat_id
|
90 |
x = get_filter(int(chat))
|
91 |
if x:
|
|
|
14 |
• `{i}remfilter <word>`
|
15 |
Remove the filtered user..
|
16 |
|
17 |
+
• `{i}listfilter`
|
18 |
list all filters.
|
19 |
"""
|
20 |
|
|
|
29 |
|
30 |
@ultroid_cmd(pattern="addfilter ?(.*)")
|
31 |
async def af(e):
|
32 |
+
wrd = (e.pattern_match.group(1)).lower()
|
33 |
wt = await e.get_reply_message()
|
34 |
chat = e.chat_id
|
35 |
if not (wt and wrd):
|
36 |
return await eor(e, "`Use this command word to set as filter and reply...`")
|
|
|
|
|
|
|
|
|
37 |
if wt and wt.media:
|
38 |
wut = mediainfo(wt.media)
|
39 |
if wut.startswith(("pic", "gif")):
|
|
|
61 |
|
62 |
@ultroid_cmd(pattern="remfilter ?(.*)")
|
63 |
async def rf(e):
|
64 |
+
wrd = (e.pattern_match.group(1)).lower()
|
65 |
chat = e.chat_id
|
66 |
if not wrd:
|
67 |
return await eor(e, "`Give the filter to remove..`")
|
|
|
81 |
|
82 |
@ultroid_bot.on(events.NewMessage())
|
83 |
async def fl(e):
|
84 |
+
xx = (e.text).lower()
|
85 |
chat = e.chat_id
|
86 |
x = get_filter(int(chat))
|
87 |
if x:
|
plugins/glitch.py
CHANGED
@@ -22,8 +22,11 @@ from . import *
|
|
22 |
@ultroid_cmd(pattern="glitch$")
|
23 |
async def _(e):
|
24 |
reply = await e.get_reply_message()
|
25 |
-
if not reply.media:
|
26 |
-
return await eor(e, "
|
|
|
|
|
|
|
27 |
xx = await eor(e, "`Gliching...`")
|
28 |
ok = await bot.download_media(reply.media)
|
29 |
cmd = f"glitch_me gif --line_count 200 -f 10 -d 50 '{ok}' ult.gif"
|
|
|
22 |
@ultroid_cmd(pattern="glitch$")
|
23 |
async def _(e):
|
24 |
reply = await e.get_reply_message()
|
25 |
+
if not (reply and reply.media):
|
26 |
+
return await eor(e, "Reply to any media")
|
27 |
+
wut = mediainfo(reply.media)
|
28 |
+
if not wut.startswith(("pic", "sticker")):
|
29 |
+
return await eor(e, "`Unsupported Media`")
|
30 |
xx = await eor(e, "`Gliching...`")
|
31 |
ok = await bot.download_media(reply.media)
|
32 |
cmd = f"glitch_me gif --line_count 200 -f 10 -d 50 '{ok}' ult.gif"
|
plugins/globaltools.py
CHANGED
@@ -66,7 +66,7 @@ async def _(e):
|
|
66 |
try:
|
67 |
await e.client.edit_permissions(ggban.id, userid, view_messages=True)
|
68 |
chats += 1
|
69 |
-
except:
|
70 |
pass
|
71 |
ungban(userid)
|
72 |
await xx.edit(
|
@@ -113,7 +113,7 @@ async def _(e):
|
|
113 |
try:
|
114 |
await e.client.edit_permissions(ggban.id, userid, view_messages=False)
|
115 |
chats += 1
|
116 |
-
except:
|
117 |
pass
|
118 |
gban(userid)
|
119 |
await xx.edit(
|
@@ -139,7 +139,7 @@ async def gcast(event):
|
|
139 |
try:
|
140 |
done += 1
|
141 |
await ultroid_bot.send_message(chat, msg)
|
142 |
-
except:
|
143 |
er += 1
|
144 |
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
145 |
|
@@ -162,7 +162,7 @@ async def gucast(event):
|
|
162 |
try:
|
163 |
done += 1
|
164 |
await ultroid_bot.send_message(chat, msg)
|
165 |
-
except:
|
166 |
er += 1
|
167 |
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
168 |
|
@@ -200,7 +200,7 @@ async def gkick(e):
|
|
200 |
try:
|
201 |
await ultroid_bot.kick_participant(gkick.id, userid)
|
202 |
chats += 1
|
203 |
-
except:
|
204 |
pass
|
205 |
await xx.edit(f"`Gkicked` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
206 |
|
@@ -240,7 +240,7 @@ async def _(e):
|
|
240 |
try:
|
241 |
await e.client.edit_permissions(onmute.id, userid, send_messages=False)
|
242 |
chats += 1
|
243 |
-
except:
|
244 |
pass
|
245 |
gmute(userid)
|
246 |
await xx.edit(f"`Gmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
@@ -277,7 +277,7 @@ async def _(e):
|
|
277 |
try:
|
278 |
await e.client.edit_permissions(hurr.id, userid, send_messages=True)
|
279 |
chats += 1
|
280 |
-
except:
|
281 |
pass
|
282 |
ungmute(userid)
|
283 |
await xx.edit(f"`Ungmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
@@ -299,7 +299,7 @@ async def _(e):
|
|
299 |
gban_watch = f"`Gbanned User` [{user.first_name}](tg://user?id={user.id}) `Spotted\n"
|
300 |
gban_watch += f"Banned Successfully`"
|
301 |
await e.reply(gban_watch)
|
302 |
-
except:
|
303 |
pass
|
304 |
|
305 |
|
|
|
66 |
try:
|
67 |
await e.client.edit_permissions(ggban.id, userid, view_messages=True)
|
68 |
chats += 1
|
69 |
+
except BaseException:
|
70 |
pass
|
71 |
ungban(userid)
|
72 |
await xx.edit(
|
|
|
113 |
try:
|
114 |
await e.client.edit_permissions(ggban.id, userid, view_messages=False)
|
115 |
chats += 1
|
116 |
+
except BaseException:
|
117 |
pass
|
118 |
gban(userid)
|
119 |
await xx.edit(
|
|
|
139 |
try:
|
140 |
done += 1
|
141 |
await ultroid_bot.send_message(chat, msg)
|
142 |
+
except BaseException:
|
143 |
er += 1
|
144 |
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
145 |
|
|
|
162 |
try:
|
163 |
done += 1
|
164 |
await ultroid_bot.send_message(chat, msg)
|
165 |
+
except BaseException:
|
166 |
er += 1
|
167 |
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
168 |
|
|
|
200 |
try:
|
201 |
await ultroid_bot.kick_participant(gkick.id, userid)
|
202 |
chats += 1
|
203 |
+
except BaseException:
|
204 |
pass
|
205 |
await xx.edit(f"`Gkicked` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
206 |
|
|
|
240 |
try:
|
241 |
await e.client.edit_permissions(onmute.id, userid, send_messages=False)
|
242 |
chats += 1
|
243 |
+
except BaseException:
|
244 |
pass
|
245 |
gmute(userid)
|
246 |
await xx.edit(f"`Gmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
|
|
277 |
try:
|
278 |
await e.client.edit_permissions(hurr.id, userid, send_messages=True)
|
279 |
chats += 1
|
280 |
+
except BaseException:
|
281 |
pass
|
282 |
ungmute(userid)
|
283 |
await xx.edit(f"`Ungmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
|
|
299 |
gban_watch = f"`Gbanned User` [{user.first_name}](tg://user?id={user.id}) `Spotted\n"
|
300 |
gban_watch += f"Banned Successfully`"
|
301 |
await e.reply(gban_watch)
|
302 |
+
except BaseException:
|
303 |
pass
|
304 |
|
305 |
|
plugins/google.py
CHANGED
@@ -77,7 +77,7 @@ async def goimg(event):
|
|
77 |
}
|
78 |
pth = gi.download(args)
|
79 |
ok = pth[0][query]
|
80 |
-
await event.client.send_file(event.chat_id, ok, album=True)
|
81 |
rmtree(f"./resources/downloads/{query}/")
|
82 |
await nn.delete()
|
83 |
|
|
|
77 |
}
|
78 |
pth = gi.download(args)
|
79 |
ok = pth[0][query]
|
80 |
+
await event.client.send_file(event.chat_id, ok, caption=query, album=True)
|
81 |
rmtree(f"./resources/downloads/{query}/")
|
82 |
await nn.delete()
|
83 |
|
plugins/greetings.py
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
• `{i}clearwelcome`
|
16 |
Delete the welcome in the current chat.
|
17 |
|
18 |
-
• `{i}getwelcome`
|
19 |
Get the welcome message in the current chat.
|
20 |
|
21 |
---- GoodByes ----
|
@@ -25,13 +25,10 @@
|
|
25 |
• `{i}cleargoodbye`
|
26 |
Delete the goodbye in the current chat.
|
27 |
|
28 |
-
• `{i}getgoodbye`
|
29 |
Get the goodbye message in the current chat.
|
30 |
|
31 |
"""
|
32 |
-
Note = "\n\nNote: `{mention}`, `{group}`, `{count}`, `{name}`, `{fullname}`, `{username}`, `{userid}` can be used as formatting parameters.\n\n"
|
33 |
-
|
34 |
-
|
35 |
import os
|
36 |
|
37 |
from telegraph import upload_file as uf
|
@@ -39,6 +36,8 @@ from telethon.utils import get_display_name, pack_bot_file_id
|
|
39 |
|
40 |
from . import *
|
41 |
|
|
|
|
|
42 |
|
43 |
@ultroid_cmd(pattern="setwelcome")
|
44 |
async def setwel(event):
|
@@ -68,7 +67,7 @@ async def setwel(event):
|
|
68 |
else:
|
69 |
add_welcome(event.chat_id, None, m)
|
70 |
await eor(x, "`Welcome note saved`")
|
71 |
-
elif r.text:
|
72 |
add_welcome(event.chat_id, r.message, None)
|
73 |
await eor(x, "`Welcome note saved`")
|
74 |
else:
|
@@ -119,18 +118,21 @@ async def _(event):
|
|
119 |
msgg = wel["welcome"]
|
120 |
med = wel["media"]
|
121 |
userid = user.id
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
134 |
|
135 |
|
136 |
@ultroid_cmd(pattern="setgoodbye")
|
@@ -161,7 +163,7 @@ async def setgb(event):
|
|
161 |
else:
|
162 |
add_goodbye(event.chat_id, None, m)
|
163 |
await eor(x, "`Goodbye note saved`")
|
164 |
-
elif r.text:
|
165 |
add_goodbye(event.chat_id, r.message, None)
|
166 |
await eor(x, "`Goddbye note saved`")
|
167 |
else:
|
@@ -212,18 +214,21 @@ async def _(event):
|
|
212 |
msgg = wel["goodbye"]
|
213 |
med = wel["media"]
|
214 |
userid = user.id
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
227 |
|
228 |
|
229 |
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}" + Note})
|
|
|
15 |
• `{i}clearwelcome`
|
16 |
Delete the welcome in the current chat.
|
17 |
|
18 |
+
• `{i}getwelcome`
|
19 |
Get the welcome message in the current chat.
|
20 |
|
21 |
---- GoodByes ----
|
|
|
25 |
• `{i}cleargoodbye`
|
26 |
Delete the goodbye in the current chat.
|
27 |
|
28 |
+
• `{i}getgoodbye`
|
29 |
Get the goodbye message in the current chat.
|
30 |
|
31 |
"""
|
|
|
|
|
|
|
32 |
import os
|
33 |
|
34 |
from telegraph import upload_file as uf
|
|
|
36 |
|
37 |
from . import *
|
38 |
|
39 |
+
Note = "\n\nNote: `{mention}`, `{group}`, `{count}`, `{name}`, `{fullname}`, `{username}`, `{userid}` can be used as formatting parameters.\n\n"
|
40 |
+
|
41 |
|
42 |
@ultroid_cmd(pattern="setwelcome")
|
43 |
async def setwel(event):
|
|
|
67 |
else:
|
68 |
add_welcome(event.chat_id, None, m)
|
69 |
await eor(x, "`Welcome note saved`")
|
70 |
+
elif r and r.text:
|
71 |
add_welcome(event.chat_id, r.message, None)
|
72 |
await eor(x, "`Welcome note saved`")
|
73 |
else:
|
|
|
118 |
msgg = wel["welcome"]
|
119 |
med = wel["media"]
|
120 |
userid = user.id
|
121 |
+
if msgg:
|
122 |
+
await event.reply(
|
123 |
+
msgg.format(
|
124 |
+
mention=mention,
|
125 |
+
group=title,
|
126 |
+
count=count,
|
127 |
+
name=name,
|
128 |
+
fullname=fullname,
|
129 |
+
username=username,
|
130 |
+
userid=userid,
|
131 |
+
),
|
132 |
+
file=med,
|
133 |
+
)
|
134 |
+
else:
|
135 |
+
await event.reply(file=med)
|
136 |
|
137 |
|
138 |
@ultroid_cmd(pattern="setgoodbye")
|
|
|
163 |
else:
|
164 |
add_goodbye(event.chat_id, None, m)
|
165 |
await eor(x, "`Goodbye note saved`")
|
166 |
+
elif r and r.text:
|
167 |
add_goodbye(event.chat_id, r.message, None)
|
168 |
await eor(x, "`Goddbye note saved`")
|
169 |
else:
|
|
|
214 |
msgg = wel["goodbye"]
|
215 |
med = wel["media"]
|
216 |
userid = user.id
|
217 |
+
if msgg:
|
218 |
+
await event.reply(
|
219 |
+
msgg.format(
|
220 |
+
mention=mention,
|
221 |
+
group=title,
|
222 |
+
count=count,
|
223 |
+
name=name,
|
224 |
+
fullname=fullname,
|
225 |
+
username=username,
|
226 |
+
userid=userid,
|
227 |
+
),
|
228 |
+
file=med,
|
229 |
+
)
|
230 |
+
else:
|
231 |
+
await event.reply(file=med)
|
232 |
|
233 |
|
234 |
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}" + Note})
|
plugins/groups.py
CHANGED
@@ -17,10 +17,16 @@
|
|
17 |
|
18 |
|
19 |
from telethon.tl import functions
|
20 |
-
from telethon.tl.types import (
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
from . import *
|
26 |
|
@@ -41,7 +47,7 @@ async def _(event):
|
|
41 |
try:
|
42 |
await event.client.edit_permissions(event.chat_id, i, view_messages=True)
|
43 |
p += 1
|
44 |
-
except:
|
45 |
pass
|
46 |
await eod(xx, "{title}: {p} unbanned")
|
47 |
|
@@ -83,7 +89,7 @@ async def _(event):
|
|
83 |
)
|
84 |
c += 1
|
85 |
y -= 1
|
86 |
-
except:
|
87 |
pass
|
88 |
if isinstance(i.status, UserStatusLastMonth):
|
89 |
m += 1
|
@@ -94,7 +100,7 @@ async def _(event):
|
|
94 |
)
|
95 |
c += 1
|
96 |
m -= 1
|
97 |
-
except:
|
98 |
pass
|
99 |
if isinstance(i.status, UserStatusLastWeek):
|
100 |
w += 1
|
@@ -105,7 +111,7 @@ async def _(event):
|
|
105 |
)
|
106 |
c += 1
|
107 |
w -= 1
|
108 |
-
except:
|
109 |
pass
|
110 |
if isinstance(i.status, UserStatusOffline):
|
111 |
o += 1
|
@@ -116,7 +122,7 @@ async def _(event):
|
|
116 |
)
|
117 |
c += 1
|
118 |
o -= 1
|
119 |
-
except:
|
120 |
pass
|
121 |
if isinstance(i.status, UserStatusOnline):
|
122 |
q += 1
|
@@ -127,7 +133,7 @@ async def _(event):
|
|
127 |
)
|
128 |
c += 1
|
129 |
q -= 1
|
130 |
-
except:
|
131 |
pass
|
132 |
if isinstance(i.status, UserStatusRecently):
|
133 |
r += 1
|
@@ -138,7 +144,7 @@ async def _(event):
|
|
138 |
)
|
139 |
c += 1
|
140 |
r -= 1
|
141 |
-
except:
|
142 |
pass
|
143 |
if i.bot:
|
144 |
b += 1
|
@@ -149,7 +155,7 @@ async def _(event):
|
|
149 |
)
|
150 |
c += 1
|
151 |
b -= 1
|
152 |
-
except:
|
153 |
pass
|
154 |
elif i.deleted:
|
155 |
d += 1
|
@@ -160,7 +166,7 @@ async def _(event):
|
|
160 |
)
|
161 |
c += 1
|
162 |
d -= 1
|
163 |
-
except:
|
164 |
pass
|
165 |
elif i.status is None:
|
166 |
n += 1
|
@@ -171,7 +177,7 @@ async def _(event):
|
|
171 |
)
|
172 |
c += 1
|
173 |
n -= 1
|
174 |
-
except:
|
175 |
pass
|
176 |
required_string = ""
|
177 |
if input_str:
|
|
|
17 |
|
18 |
|
19 |
from telethon.tl import functions
|
20 |
+
from telethon.tl.types import (
|
21 |
+
ChannelParticipantsKicked,
|
22 |
+
ChatBannedRights,
|
23 |
+
UserStatusEmpty,
|
24 |
+
UserStatusLastMonth,
|
25 |
+
UserStatusLastWeek,
|
26 |
+
UserStatusOffline,
|
27 |
+
UserStatusOnline,
|
28 |
+
UserStatusRecently,
|
29 |
+
)
|
30 |
|
31 |
from . import *
|
32 |
|
|
|
47 |
try:
|
48 |
await event.client.edit_permissions(event.chat_id, i, view_messages=True)
|
49 |
p += 1
|
50 |
+
except BaseException:
|
51 |
pass
|
52 |
await eod(xx, "{title}: {p} unbanned")
|
53 |
|
|
|
89 |
)
|
90 |
c += 1
|
91 |
y -= 1
|
92 |
+
except BaseException:
|
93 |
pass
|
94 |
if isinstance(i.status, UserStatusLastMonth):
|
95 |
m += 1
|
|
|
100 |
)
|
101 |
c += 1
|
102 |
m -= 1
|
103 |
+
except BaseException:
|
104 |
pass
|
105 |
if isinstance(i.status, UserStatusLastWeek):
|
106 |
w += 1
|
|
|
111 |
)
|
112 |
c += 1
|
113 |
w -= 1
|
114 |
+
except BaseException:
|
115 |
pass
|
116 |
if isinstance(i.status, UserStatusOffline):
|
117 |
o += 1
|
|
|
122 |
)
|
123 |
c += 1
|
124 |
o -= 1
|
125 |
+
except BaseException:
|
126 |
pass
|
127 |
if isinstance(i.status, UserStatusOnline):
|
128 |
q += 1
|
|
|
133 |
)
|
134 |
c += 1
|
135 |
q -= 1
|
136 |
+
except BaseException:
|
137 |
pass
|
138 |
if isinstance(i.status, UserStatusRecently):
|
139 |
r += 1
|
|
|
144 |
)
|
145 |
c += 1
|
146 |
r -= 1
|
147 |
+
except BaseException:
|
148 |
pass
|
149 |
if i.bot:
|
150 |
b += 1
|
|
|
155 |
)
|
156 |
c += 1
|
157 |
b -= 1
|
158 |
+
except BaseException:
|
159 |
pass
|
160 |
elif i.deleted:
|
161 |
d += 1
|
|
|
166 |
)
|
167 |
c += 1
|
168 |
d -= 1
|
169 |
+
except BaseException:
|
170 |
pass
|
171 |
elif i.status is None:
|
172 |
n += 1
|
|
|
177 |
)
|
178 |
c += 1
|
179 |
n -= 1
|
180 |
+
except BaseException:
|
181 |
pass
|
182 |
required_string = ""
|
183 |
if input_str:
|
plugins/mediainfo.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ultroid - UserBot
|
2 |
+
# Copyright (C) 2020 TeamUltroid
|
3 |
+
#
|
4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
+
# PLease read the GNU Affero General Public License in
|
6 |
+
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
+
|
8 |
+
"""
|
9 |
+
✘ Commands Available -
|
10 |
+
|
11 |
+
• `{i}mediainfo <reply to media>`
|
12 |
+
To get info about it.
|
13 |
+
"""
|
14 |
+
|
15 |
+
import os
|
16 |
+
|
17 |
+
from . import *
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
@ultroid_cmd(pattern="mediainfo$")
|
22 |
+
async def mi(e):
|
23 |
+
r = await e.get_reply_message()
|
24 |
+
if not (r and r.media):
|
25 |
+
return await eod(e, "`Reply to any media`")
|
26 |
+
xx = mediainfo(r.media)
|
27 |
+
murl = r.media.stringify()
|
28 |
+
url = html("Mediainfo", "Ultroid", f"<code>{murl}</code>")
|
29 |
+
ee = await eor(e, f"**[{xx}]({url})**\n\n`Loading More...`", link_preview=False)
|
30 |
+
dl = await ultroid_bot.download_media(r.media)
|
31 |
+
out, er = await bash(f"mediainfo {dl}")
|
32 |
+
os.remove(dl)
|
33 |
+
if er:
|
34 |
+
return await ee.edit(f"**[{xx}]({url})**", link_preview=False)
|
35 |
+
await ee.edit(f"**[{xx}]({url})**\n\n{out}")
|
36 |
+
|
37 |
+
|
38 |
+
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
|
plugins/mute.py
CHANGED
@@ -73,7 +73,7 @@ async def startmute(event):
|
|
73 |
return await eor(xx, "`No proper admin rights...`", time=5)
|
74 |
elif "creator" in vars(chat):
|
75 |
pass
|
76 |
-
elif private
|
77 |
pass
|
78 |
else:
|
79 |
return await eod(xx, "`No proper admin rights...`", time=5)
|
@@ -128,11 +128,11 @@ async def _(e):
|
|
128 |
huh = e.text.split(" ")
|
129 |
try:
|
130 |
tme = huh[1]
|
131 |
-
except:
|
132 |
return await eod(xx, "`Time till mute?`", time=5)
|
133 |
try:
|
134 |
input = huh[2]
|
135 |
-
except:
|
136 |
pass
|
137 |
chat = await e.get_chat()
|
138 |
if e.reply_to_msg_id:
|
|
|
73 |
return await eor(xx, "`No proper admin rights...`", time=5)
|
74 |
elif "creator" in vars(chat):
|
75 |
pass
|
76 |
+
elif private:
|
77 |
pass
|
78 |
else:
|
79 |
return await eod(xx, "`No proper admin rights...`", time=5)
|
|
|
128 |
huh = e.text.split(" ")
|
129 |
try:
|
130 |
tme = huh[1]
|
131 |
+
except BaseException:
|
132 |
return await eod(xx, "`Time till mute?`", time=5)
|
133 |
try:
|
134 |
input = huh[2]
|
135 |
+
except BaseException:
|
136 |
pass
|
137 |
chat = await e.get_chat()
|
138 |
if e.reply_to_msg_id:
|
plugins/notes.py
CHANGED
@@ -35,17 +35,13 @@ async def an(e):
|
|
35 |
if e.is_group:
|
36 |
if not e._chat.admin_rights:
|
37 |
return await eod(e, "`You Are Not Admin Here.", time=5)
|
38 |
-
wrd = e.pattern_match.group(1)
|
39 |
wt = await e.get_reply_message()
|
40 |
chat = e.chat_id
|
41 |
if not (wt and wrd):
|
42 |
return await eod(e, "`Use this Command with Reply and word to use a note.`")
|
43 |
if "#" in wrd:
|
44 |
wrd = wrd.replace("#", "")
|
45 |
-
try:
|
46 |
-
rem_note(int(chat), wrd)
|
47 |
-
except:
|
48 |
-
pass
|
49 |
if wt and wt.media:
|
50 |
wut = mediainfo(wt.media)
|
51 |
if wut.startswith(("pic", "gif")):
|
@@ -77,7 +73,7 @@ async def rn(e):
|
|
77 |
if e.is_group:
|
78 |
if not e._chat.admin_rights:
|
79 |
return await eod(e, "`You Are Not Admin Here.", time=5)
|
80 |
-
wrd = e.pattern_match.group(1)
|
81 |
chat = e.chat_id
|
82 |
if not wrd:
|
83 |
return await eod(e, "`Give me the note handler which you want to remove.`")
|
@@ -102,13 +98,10 @@ async def lsnote(e):
|
|
102 |
|
103 |
@ultroid_bot.on(events.NewMessage())
|
104 |
async def notes(e):
|
105 |
-
if e.is_group:
|
106 |
-
if not e._chat.admin_rights:
|
107 |
-
return
|
108 |
xx = e.text
|
109 |
if not xx.startswith("#"):
|
110 |
return
|
111 |
-
xx = xx.replace("#", "")
|
112 |
chat = e.chat_id
|
113 |
x = get_notes(int(chat))
|
114 |
if x:
|
|
|
35 |
if e.is_group:
|
36 |
if not e._chat.admin_rights:
|
37 |
return await eod(e, "`You Are Not Admin Here.", time=5)
|
38 |
+
wrd = (e.pattern_match.group(1)).lower()
|
39 |
wt = await e.get_reply_message()
|
40 |
chat = e.chat_id
|
41 |
if not (wt and wrd):
|
42 |
return await eod(e, "`Use this Command with Reply and word to use a note.`")
|
43 |
if "#" in wrd:
|
44 |
wrd = wrd.replace("#", "")
|
|
|
|
|
|
|
|
|
45 |
if wt and wt.media:
|
46 |
wut = mediainfo(wt.media)
|
47 |
if wut.startswith(("pic", "gif")):
|
|
|
73 |
if e.is_group:
|
74 |
if not e._chat.admin_rights:
|
75 |
return await eod(e, "`You Are Not Admin Here.", time=5)
|
76 |
+
wrd = (e.pattern_match.group(1)).lower()
|
77 |
chat = e.chat_id
|
78 |
if not wrd:
|
79 |
return await eod(e, "`Give me the note handler which you want to remove.`")
|
|
|
98 |
|
99 |
@ultroid_bot.on(events.NewMessage())
|
100 |
async def notes(e):
|
|
|
|
|
|
|
101 |
xx = e.text
|
102 |
if not xx.startswith("#"):
|
103 |
return
|
104 |
+
xx = (xx.replace("#", "")).lower()
|
105 |
chat = e.chat_id
|
106 |
x = get_notes(int(chat))
|
107 |
if x:
|
plugins/pmpermit.py
CHANGED
@@ -19,8 +19,15 @@
|
|
19 |
|
20 |
• `{i}unblock`
|
21 |
To Unblock Someone in PM.
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
"""
|
23 |
|
|
|
24 |
from pyUltroid.functions.pmpermit_db import *
|
25 |
from telethon import events
|
26 |
from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
|
@@ -82,15 +89,48 @@ PMCMDS = [
|
|
82 |
# =================================================================
|
83 |
|
84 |
|
85 |
-
@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
async def permitpm(event):
|
87 |
user = await event.get_chat()
|
88 |
if user.bot or user.is_self or user.verified:
|
89 |
return
|
|
|
|
|
90 |
if Redis("PMLOG") == "True":
|
91 |
pl = udB.get("PMLOGGROUP")
|
92 |
if pl is not None:
|
93 |
-
return await event.forward_to(pl)
|
94 |
await event.forward_to(Var.LOG_CHANNEL)
|
95 |
|
96 |
|
@@ -99,7 +139,12 @@ if sett is None:
|
|
99 |
sett = True
|
100 |
if sett == "True" and sett != "False":
|
101 |
|
102 |
-
@ultroid_bot.on(
|
|
|
|
|
|
|
|
|
|
|
103 |
async def autoappr(e):
|
104 |
miss = await e.get_chat()
|
105 |
if miss.bot or miss.is_self or miss.verified or Redis("AUTOAPPROVE") != "True":
|
@@ -123,7 +168,12 @@ if sett == "True" and sett != "False":
|
|
123 |
f"#AutoApproved\nßecoz of outgoing msg\nUser - [{name0}](tg://user?id={e.chat_id})",
|
124 |
)
|
125 |
|
126 |
-
@ultroid_bot.on(
|
|
|
|
|
|
|
|
|
|
|
127 |
async def permitpm(event):
|
128 |
user = await event.get_chat()
|
129 |
if user.bot or user.is_self or user.verified:
|
@@ -147,6 +197,8 @@ if sett == "True" and sett != "False":
|
|
147 |
if user.id in LASTMSG:
|
148 |
prevmsg = LASTMSG[user.id]
|
149 |
if event.text != prevmsg:
|
|
|
|
|
150 |
async for message in event.client.iter_messages(
|
151 |
user.id,
|
152 |
search=UND,
|
@@ -242,7 +294,9 @@ if sett == "True" and sett != "False":
|
|
242 |
f"[{name0}](tg://user?id={user.id}) was Blocked for spamming.",
|
243 |
)
|
244 |
|
245 |
-
@ultroid_cmd(
|
|
|
|
|
246 |
async def approvepm(apprvpm):
|
247 |
if apprvpm.reply_to_msg_id:
|
248 |
reply = await apprvpm.get_reply_message()
|
@@ -301,7 +355,9 @@ if sett == "True" and sett != "False":
|
|
301 |
else:
|
302 |
await apprvpm.edit(NO_REPLY)
|
303 |
|
304 |
-
@ultroid_cmd(
|
|
|
|
|
305 |
async def disapprovepm(e):
|
306 |
if e.reply_to_msg_id:
|
307 |
reply = await e.get_reply_message()
|
@@ -352,7 +408,9 @@ if sett == "True" and sett != "False":
|
|
352 |
else:
|
353 |
await e.edit(NO_REPLY)
|
354 |
|
355 |
-
@ultroid_cmd(
|
|
|
|
|
356 |
async def blockpm(block):
|
357 |
if block.reply_to_msg_id:
|
358 |
reply = await block.get_reply_message()
|
@@ -391,7 +449,9 @@ if sett == "True" and sett != "False":
|
|
391 |
f"#BLOCKED\nUser: [{name0}](tg://user?id={uid})",
|
392 |
)
|
393 |
|
394 |
-
@ultroid_cmd(
|
|
|
|
|
395 |
async def unblockpm(unblock):
|
396 |
if unblock.reply_to_msg_id:
|
397 |
reply = await unblock.get_reply_message()
|
|
|
19 |
|
20 |
• `{i}unblock`
|
21 |
To Unblock Someone in PM.
|
22 |
+
|
23 |
+
• `{i}nologpm`
|
24 |
+
To stop logging from that user.
|
25 |
+
|
26 |
+
• `{i}logpm`
|
27 |
+
Start logging again from that user.
|
28 |
"""
|
29 |
|
30 |
+
from pyUltroid.functions.logusers_db import *
|
31 |
from pyUltroid.functions.pmpermit_db import *
|
32 |
from telethon import events
|
33 |
from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
|
|
|
89 |
# =================================================================
|
90 |
|
91 |
|
92 |
+
@ultroid_cmd(
|
93 |
+
pattern="logpm$",
|
94 |
+
)
|
95 |
+
async def _(e):
|
96 |
+
if not e.is_private:
|
97 |
+
return await eod(e, "`Use me in Private.`", time=3)
|
98 |
+
if is_logger(str(e.chat_id)):
|
99 |
+
nolog_user(str(e.chat_id))
|
100 |
+
return await eod(e, "`Now I Will log msgs from here.`", time=3)
|
101 |
+
else:
|
102 |
+
return await eod(e, "`Wasn logging msgs from here.`", time=3)
|
103 |
+
|
104 |
+
|
105 |
+
@ultroid_cmd(
|
106 |
+
pattern="nologpm$",
|
107 |
+
)
|
108 |
+
async def _(e):
|
109 |
+
if not e.is_private:
|
110 |
+
return await eod(e, "`Use me in Private.`", time=3)
|
111 |
+
if not is_logger(str(e.chat_id)):
|
112 |
+
log_user(str(e.chat_id))
|
113 |
+
return await eod(e, "`Now I Won't log msgs from here.`", time=3)
|
114 |
+
else:
|
115 |
+
return await eod(e, "`Wasn't logging msgs from here.`", time=3)
|
116 |
+
|
117 |
+
|
118 |
+
@ultroid_bot.on(
|
119 |
+
events.NewMessage(
|
120 |
+
incoming=True,
|
121 |
+
func=lambda e: e.is_private,
|
122 |
+
),
|
123 |
+
)
|
124 |
async def permitpm(event):
|
125 |
user = await event.get_chat()
|
126 |
if user.bot or user.is_self or user.verified:
|
127 |
return
|
128 |
+
if is_logger(user.id):
|
129 |
+
return
|
130 |
if Redis("PMLOG") == "True":
|
131 |
pl = udB.get("PMLOGGROUP")
|
132 |
if pl is not None:
|
133 |
+
return await event.forward_to(int(pl))
|
134 |
await event.forward_to(Var.LOG_CHANNEL)
|
135 |
|
136 |
|
|
|
139 |
sett = True
|
140 |
if sett == "True" and sett != "False":
|
141 |
|
142 |
+
@ultroid_bot.on(
|
143 |
+
events.NewMessage(
|
144 |
+
outgoing=True,
|
145 |
+
func=lambda e: e.is_private,
|
146 |
+
),
|
147 |
+
)
|
148 |
async def autoappr(e):
|
149 |
miss = await e.get_chat()
|
150 |
if miss.bot or miss.is_self or miss.verified or Redis("AUTOAPPROVE") != "True":
|
|
|
168 |
f"#AutoApproved\nßecoz of outgoing msg\nUser - [{name0}](tg://user?id={e.chat_id})",
|
169 |
)
|
170 |
|
171 |
+
@ultroid_bot.on(
|
172 |
+
events.NewMessage(
|
173 |
+
incoming=True,
|
174 |
+
func=lambda e: e.is_private,
|
175 |
+
),
|
176 |
+
)
|
177 |
async def permitpm(event):
|
178 |
user = await event.get_chat()
|
179 |
if user.bot or user.is_self or user.verified:
|
|
|
197 |
if user.id in LASTMSG:
|
198 |
prevmsg = LASTMSG[user.id]
|
199 |
if event.text != prevmsg:
|
200 |
+
if "PMSecurity" in event.text:
|
201 |
+
return
|
202 |
async for message in event.client.iter_messages(
|
203 |
user.id,
|
204 |
search=UND,
|
|
|
294 |
f"[{name0}](tg://user?id={user.id}) was Blocked for spamming.",
|
295 |
)
|
296 |
|
297 |
+
@ultroid_cmd(
|
298 |
+
pattern="(a|approve)(?: |$)",
|
299 |
+
)
|
300 |
async def approvepm(apprvpm):
|
301 |
if apprvpm.reply_to_msg_id:
|
302 |
reply = await apprvpm.get_reply_message()
|
|
|
355 |
else:
|
356 |
await apprvpm.edit(NO_REPLY)
|
357 |
|
358 |
+
@ultroid_cmd(
|
359 |
+
pattern="(da|disapprove)(?: |$)",
|
360 |
+
)
|
361 |
async def disapprovepm(e):
|
362 |
if e.reply_to_msg_id:
|
363 |
reply = await e.get_reply_message()
|
|
|
408 |
else:
|
409 |
await e.edit(NO_REPLY)
|
410 |
|
411 |
+
@ultroid_cmd(
|
412 |
+
pattern="block$",
|
413 |
+
)
|
414 |
async def blockpm(block):
|
415 |
if block.reply_to_msg_id:
|
416 |
reply = await block.get_reply_message()
|
|
|
449 |
f"#BLOCKED\nUser: [{name0}](tg://user?id={uid})",
|
450 |
)
|
451 |
|
452 |
+
@ultroid_cmd(
|
453 |
+
pattern="unblock$",
|
454 |
+
)
|
455 |
async def unblockpm(unblock):
|
456 |
if unblock.reply_to_msg_id:
|
457 |
reply = await unblock.get_reply_message()
|
plugins/profile.py
CHANGED
@@ -28,8 +28,7 @@ import asyncio
|
|
28 |
import os
|
29 |
|
30 |
from telethon.tl import functions
|
31 |
-
from telethon.tl.functions.photos import
|
32 |
-
GetUserPhotosRequest)
|
33 |
from telethon.tl.types import InputPhoto
|
34 |
|
35 |
from . import *
|
|
|
28 |
import os
|
29 |
|
30 |
from telethon.tl import functions
|
31 |
+
from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest
|
|
|
32 |
from telethon.tl.types import InputPhoto
|
33 |
|
34 |
from . import *
|
plugins/snips.py
CHANGED
@@ -31,16 +31,12 @@ from . import *
|
|
31 |
|
32 |
@ultroid_cmd(pattern="addsnip ?(.*)")
|
33 |
async def an(e):
|
34 |
-
wrd = e.pattern_match.group(1)
|
35 |
wt = await e.get_reply_message()
|
36 |
if not (wt and wrd):
|
37 |
return await eor(e, "Give word to set as snip and reply to a message.")
|
38 |
if "$" in wrd:
|
39 |
wrd = wrd.replace("$", "")
|
40 |
-
try:
|
41 |
-
rem_snip(int(chat), wrd)
|
42 |
-
except:
|
43 |
-
pass
|
44 |
if wt and wt.media:
|
45 |
wut = mediainfo(wt.media)
|
46 |
if wut.startswith(("pic", "gif")):
|
@@ -69,7 +65,7 @@ async def an(e):
|
|
69 |
|
70 |
@ultroid_cmd(pattern="remsnip ?(.*)")
|
71 |
async def rs(e):
|
72 |
-
wrd = e.pattern_match.group(1)
|
73 |
if not wrd:
|
74 |
return await eor(e, "Give the word to remove...")
|
75 |
if wrd.startswith("$"):
|
@@ -82,7 +78,7 @@ async def rs(e):
|
|
82 |
async def lsnote(e):
|
83 |
x = list_snip()
|
84 |
if x:
|
85 |
-
sd = "SNIPS Found
|
86 |
await eor(e, sd + x)
|
87 |
else:
|
88 |
await eor(e, "No Snips Found Here")
|
@@ -90,7 +86,7 @@ async def lsnote(e):
|
|
90 |
|
91 |
@ultroid_bot.on(events.NewMessage(outgoing=True))
|
92 |
async def notes(e):
|
93 |
-
xx = e.text
|
94 |
if not xx.startswith("$"):
|
95 |
return
|
96 |
xx = xx.replace("$", "")
|
|
|
31 |
|
32 |
@ultroid_cmd(pattern="addsnip ?(.*)")
|
33 |
async def an(e):
|
34 |
+
wrd = (e.pattern_match.group(1)).lower()
|
35 |
wt = await e.get_reply_message()
|
36 |
if not (wt and wrd):
|
37 |
return await eor(e, "Give word to set as snip and reply to a message.")
|
38 |
if "$" in wrd:
|
39 |
wrd = wrd.replace("$", "")
|
|
|
|
|
|
|
|
|
40 |
if wt and wt.media:
|
41 |
wut = mediainfo(wt.media)
|
42 |
if wut.startswith(("pic", "gif")):
|
|
|
65 |
|
66 |
@ultroid_cmd(pattern="remsnip ?(.*)")
|
67 |
async def rs(e):
|
68 |
+
wrd = (e.pattern_match.group(1)).lower()
|
69 |
if not wrd:
|
70 |
return await eor(e, "Give the word to remove...")
|
71 |
if wrd.startswith("$"):
|
|
|
78 |
async def lsnote(e):
|
79 |
x = list_snip()
|
80 |
if x:
|
81 |
+
sd = "SNIPS Found :\n\n"
|
82 |
await eor(e, sd + x)
|
83 |
else:
|
84 |
await eor(e, "No Snips Found Here")
|
|
|
86 |
|
87 |
@ultroid_bot.on(events.NewMessage(outgoing=True))
|
88 |
async def notes(e):
|
89 |
+
xx = (e.text).lower()
|
90 |
if not xx.startswith("$"):
|
91 |
return
|
92 |
xx = xx.replace("$", "")
|
plugins/stickertools.py
CHANGED
@@ -39,10 +39,12 @@ from os import remove
|
|
39 |
import cv2
|
40 |
import numpy as np
|
41 |
from PIL import Image, ImageDraw
|
42 |
-
from telethon.errors import
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
|
47 |
from . import *
|
48 |
|
@@ -231,7 +233,7 @@ async def hehe(args):
|
|
231 |
" A <strong>Telegram</strong> user has created the <strong>Sticker Set</strong>."
|
232 |
not in htmlstr
|
233 |
):
|
234 |
-
async with ultroid_bot.conversation("Stickers") as conv:
|
235 |
await conv.send_message("/addsticker")
|
236 |
await conv.get_response()
|
237 |
await ultroid_bot.send_read_acknowledge(conv.chat_id)
|
|
|
39 |
import cv2
|
40 |
import numpy as np
|
41 |
from PIL import Image, ImageDraw
|
42 |
+
from telethon.errors import ChatSendInlineForbiddenError, ChatSendStickersForbiddenError
|
43 |
+
from telethon.tl.types import (
|
44 |
+
DocumentAttributeFilename,
|
45 |
+
DocumentAttributeSticker,
|
46 |
+
MessageMediaPhoto,
|
47 |
+
)
|
48 |
|
49 |
from . import *
|
50 |
|
|
|
233 |
" A <strong>Telegram</strong> user has created the <strong>Sticker Set</strong>."
|
234 |
not in htmlstr
|
235 |
):
|
236 |
+
async with ultroid_bot.conversation("@Stickers") as conv:
|
237 |
await conv.send_message("/addsticker")
|
238 |
await conv.get_response()
|
239 |
await ultroid_bot.send_read_acknowledge(conv.chat_id)
|
plugins/sudo.py
CHANGED
@@ -30,18 +30,15 @@ from . import *
|
|
30 |
pattern="addsudo ?(.*)",
|
31 |
)
|
32 |
async def _(ult):
|
33 |
-
if Var.BOT_MODE
|
34 |
try:
|
35 |
if ult.sender_id != Var.OWNER_ID:
|
36 |
-
return await
|
37 |
-
ult,
|
38 |
-
"You are sudo user, You cant add other sudo user.",
|
39 |
-
)
|
40 |
except BaseException:
|
41 |
pass
|
42 |
else:
|
43 |
if ult.sender_id != ultroid_bot.uid:
|
44 |
-
return await
|
45 |
ok = await eor(ult, "`Updating SUDO Users List ...`")
|
46 |
if ult.reply_to_msg_id:
|
47 |
replied_to = await ult.get_reply_message()
|
@@ -60,7 +57,7 @@ async def _(ult):
|
|
60 |
f"**Added [{user.user.first_name}](tg://user?id={id}) as SUDO User**",
|
61 |
)
|
62 |
else:
|
63 |
-
return await ok.edit("`SEEMS LIKE THIS FUNCTION CHOOSE TO
|
64 |
|
65 |
args = ult.pattern_match.group(1).strip()
|
66 |
|
@@ -115,7 +112,7 @@ async def _(ult):
|
|
115 |
pattern="delsudo ?(.*)",
|
116 |
)
|
117 |
async def _(ult):
|
118 |
-
if Var.BOT_MODE
|
119 |
try:
|
120 |
if ult.sender_id != Var.OWNER_ID:
|
121 |
return await eor(
|
|
|
30 |
pattern="addsudo ?(.*)",
|
31 |
)
|
32 |
async def _(ult):
|
33 |
+
if Var.BOT_MODE:
|
34 |
try:
|
35 |
if ult.sender_id != Var.OWNER_ID:
|
36 |
+
return await eod(ult, "`Sudo users can't add new sudos!`", time=10)
|
|
|
|
|
|
|
37 |
except BaseException:
|
38 |
pass
|
39 |
else:
|
40 |
if ult.sender_id != ultroid_bot.uid:
|
41 |
+
return await eod(ult, "`Sudo users can't add new sudos!`", time=10)
|
42 |
ok = await eor(ult, "`Updating SUDO Users List ...`")
|
43 |
if ult.reply_to_msg_id:
|
44 |
replied_to = await ult.get_reply_message()
|
|
|
57 |
f"**Added [{user.user.first_name}](tg://user?id={id}) as SUDO User**",
|
58 |
)
|
59 |
else:
|
60 |
+
return await ok.edit("`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`")
|
61 |
|
62 |
args = ult.pattern_match.group(1).strip()
|
63 |
|
|
|
112 |
pattern="delsudo ?(.*)",
|
113 |
)
|
114 |
async def _(ult):
|
115 |
+
if Var.BOT_MODE:
|
116 |
try:
|
117 |
if ult.sender_id != Var.OWNER_ID:
|
118 |
return await eor(
|
plugins/tools.py
CHANGED
@@ -46,8 +46,7 @@ import cv2
|
|
46 |
import emoji
|
47 |
from googletrans import Translator
|
48 |
from telethon.errors.rpcerrorlist import YouBlockedUserError
|
49 |
-
from telethon.tl.types import
|
50 |
-
ChannelParticipantsBots, User)
|
51 |
from telethon.utils import pack_bot_file_id
|
52 |
|
53 |
from . import *
|
|
|
46 |
import emoji
|
47 |
from googletrans import Translator
|
48 |
from telethon.errors.rpcerrorlist import YouBlockedUserError
|
49 |
+
from telethon.tl.types import ChannelParticipantAdmin, ChannelParticipantsBots, User
|
|
|
50 |
from telethon.utils import pack_bot_file_id
|
51 |
|
52 |
from . import *
|
plugins/updater.py
CHANGED
@@ -86,9 +86,9 @@ async def upstream(ups):
|
|
86 |
repo = Repo.init()
|
87 |
origin = repo.create_remote("upstream", off_repo)
|
88 |
origin.fetch()
|
89 |
-
repo.create_head("
|
90 |
-
repo.heads.
|
91 |
-
repo.heads.
|
92 |
ac_br = repo.active_branch.name
|
93 |
try:
|
94 |
repo.create_remote("upstream", off_repo)
|
@@ -115,6 +115,7 @@ async def upstream(ups):
|
|
115 |
reply_to=ups.id,
|
116 |
)
|
117 |
remove(f"ultroid_updates.txt")
|
|
|
118 |
else:
|
119 |
return await eod(pagal, changelog_str, parse_mode="html")
|
120 |
else:
|
|
|
86 |
repo = Repo.init()
|
87 |
origin = repo.create_remote("upstream", off_repo)
|
88 |
origin.fetch()
|
89 |
+
repo.create_head("dev", origin.refs.dev)
|
90 |
+
repo.heads.dev.set_tracking_branch(origin.refs.dev)
|
91 |
+
repo.heads.dev.checkout(True)
|
92 |
ac_br = repo.active_branch.name
|
93 |
try:
|
94 |
repo.create_remote("upstream", off_repo)
|
|
|
115 |
reply_to=ups.id,
|
116 |
)
|
117 |
remove(f"ultroid_updates.txt")
|
118 |
+
return
|
119 |
else:
|
120 |
return await eod(pagal, changelog_str, parse_mode="html")
|
121 |
else:
|
plugins/utilities.py
CHANGED
@@ -67,10 +67,10 @@ from telegraph import upload_file as uf
|
|
67 |
from telethon import functions
|
68 |
from telethon.events import NewMessage
|
69 |
from telethon.tl.custom import Dialog
|
70 |
-
from telethon.tl.functions.channels import LeaveChannelRequest
|
|
|
71 |
from telethon.tl.functions.photos import GetUserPhotosRequest
|
72 |
-
from telethon.tl.types import
|
73 |
-
User)
|
74 |
from telethon.utils import get_input_location
|
75 |
|
76 |
# =================================================================#
|
@@ -266,6 +266,8 @@ async def stats(
|
|
266 |
async def _(event):
|
267 |
xx = await eor(event, "` 《 Pasting to nekobin... 》 `")
|
268 |
input_str = "".join(event.text.split(maxsplit=1)[1:])
|
|
|
|
|
269 |
if input_str:
|
270 |
message = input_str
|
271 |
downloaded_file_name = None
|
@@ -408,7 +410,7 @@ async def _(ult):
|
|
408 |
for user_id in to_add_users.split(" "):
|
409 |
try:
|
410 |
await ultroid_bot(
|
411 |
-
|
412 |
chat_id=ult.chat_id,
|
413 |
user_id=user_id,
|
414 |
fwd_limit=1000000,
|
@@ -421,7 +423,7 @@ async def _(ult):
|
|
421 |
for user_id in to_add_users.split(" "):
|
422 |
try:
|
423 |
await ultroid_bot(
|
424 |
-
|
425 |
channel=ult.chat_id,
|
426 |
users=[user_id],
|
427 |
),
|
@@ -590,7 +592,7 @@ async def ipinfo(event):
|
|
590 |
ipaddr = ""
|
591 |
try:
|
592 |
ipaddr = ip[1]
|
593 |
-
except:
|
594 |
return await eod(xx, "`Give me an IP address you noob!`", time=5)
|
595 |
if ipaddr == "":
|
596 |
return
|
@@ -625,7 +627,7 @@ async def ipinfo(event):
|
|
625 |
tz,
|
626 |
),
|
627 |
)
|
628 |
-
except:
|
629 |
err = det["error"]["title"]
|
630 |
msg = det["error"]["messsage"]
|
631 |
await eod(xx, f"ERROR:\n{err}\n{msg}")
|
|
|
67 |
from telethon import functions
|
68 |
from telethon.events import NewMessage
|
69 |
from telethon.tl.custom import Dialog
|
70 |
+
from telethon.tl.functions.channels import LeaveChannelRequest, InviteToChannelRequest
|
71 |
+
from telethon.tl.functions.messages import AddChatUserRequest
|
72 |
from telethon.tl.functions.photos import GetUserPhotosRequest
|
73 |
+
from telethon.tl.types import Channel, Chat, InputMediaPoll, Poll, PollAnswer, User
|
|
|
74 |
from telethon.utils import get_input_location
|
75 |
|
76 |
# =================================================================#
|
|
|
266 |
async def _(event):
|
267 |
xx = await eor(event, "` 《 Pasting to nekobin... 》 `")
|
268 |
input_str = "".join(event.text.split(maxsplit=1)[1:])
|
269 |
+
if not (input_str or event.is_reply):
|
270 |
+
return await xx.edit("`Reply to a Message/Document or Give me Some Text !`")
|
271 |
if input_str:
|
272 |
message = input_str
|
273 |
downloaded_file_name = None
|
|
|
410 |
for user_id in to_add_users.split(" "):
|
411 |
try:
|
412 |
await ultroid_bot(
|
413 |
+
AddChatUserRequest(
|
414 |
chat_id=ult.chat_id,
|
415 |
user_id=user_id,
|
416 |
fwd_limit=1000000,
|
|
|
423 |
for user_id in to_add_users.split(" "):
|
424 |
try:
|
425 |
await ultroid_bot(
|
426 |
+
InviteToChannelRequest(
|
427 |
channel=ult.chat_id,
|
428 |
users=[user_id],
|
429 |
),
|
|
|
592 |
ipaddr = ""
|
593 |
try:
|
594 |
ipaddr = ip[1]
|
595 |
+
except BaseException:
|
596 |
return await eod(xx, "`Give me an IP address you noob!`", time=5)
|
597 |
if ipaddr == "":
|
598 |
return
|
|
|
627 |
tz,
|
628 |
),
|
629 |
)
|
630 |
+
except BaseException:
|
631 |
err = det["error"]["title"]
|
632 |
msg = det["error"]["messsage"]
|
633 |
await eod(xx, f"ERROR:\n{err}\n{msg}")
|
plugins/vcplugin.py
CHANGED
@@ -33,8 +33,7 @@
|
|
33 |
|
34 |
"""
|
35 |
|
36 |
-
from pyUltroid.functions.vc_sudos import
|
37 |
-
is_vcsudo)
|
38 |
from telethon.tl.functions.channels import GetFullChannelRequest as getchat
|
39 |
from telethon.tl.functions.phone import CreateGroupCallRequest as startvc
|
40 |
from telethon.tl.functions.phone import DiscardGroupCallRequest as stopvc
|
@@ -72,8 +71,11 @@ async def _(e):
|
|
72 |
pattern="playvc$",
|
73 |
)
|
74 |
async def _(e):
|
75 |
-
await eor(e, "`VC bot started...`")
|
76 |
-
await bash("npm start")
|
|
|
|
|
|
|
77 |
|
78 |
|
79 |
@ultroid_cmd(
|
@@ -92,7 +94,7 @@ async def _(e):
|
|
92 |
try:
|
93 |
await e.client(invitetovc(call=await get_call(e), users=p))
|
94 |
z += 6
|
95 |
-
except:
|
96 |
pass
|
97 |
await ok.edit(f"`Invited {z} users`")
|
98 |
|
|
|
33 |
|
34 |
"""
|
35 |
|
36 |
+
from pyUltroid.functions.vc_sudos import add_vcsudo, del_vcsudo, get_vcsudos, is_vcsudo
|
|
|
37 |
from telethon.tl.functions.channels import GetFullChannelRequest as getchat
|
38 |
from telethon.tl.functions.phone import CreateGroupCallRequest as startvc
|
39 |
from telethon.tl.functions.phone import DiscardGroupCallRequest as stopvc
|
|
|
71 |
pattern="playvc$",
|
72 |
)
|
73 |
async def _(e):
|
74 |
+
zz = await eor(e, "`VC bot started...`")
|
75 |
+
er, out = await bash("npm start")
|
76 |
+
LOGS.warning(er)
|
77 |
+
LOGS.info(out)
|
78 |
+
await zz.edit(f"Failed {er}")
|
79 |
|
80 |
|
81 |
@ultroid_cmd(
|
|
|
94 |
try:
|
95 |
await e.client(invitetovc(call=await get_call(e), users=p))
|
96 |
z += 6
|
97 |
+
except BaseException:
|
98 |
pass
|
99 |
await ok.edit(f"`Invited {z} users`")
|
100 |
|
plugins/webshot.py
CHANGED
@@ -43,7 +43,7 @@ async def webss(event):
|
|
43 |
ok = requests.get(lnk).json()
|
44 |
try:
|
45 |
sshot = ok["screenshot"]
|
46 |
-
except:
|
47 |
return await eod(xx, "Something Went Wrong :(", time=10)
|
48 |
await xx.reply(
|
49 |
f"**WebShot Generated**\n**URL**: {xurl}",
|
|
|
43 |
ok = requests.get(lnk).json()
|
44 |
try:
|
45 |
sshot = ok["screenshot"]
|
46 |
+
except BaseException:
|
47 |
return await eod(xx, "Something Went Wrong :(", time=10)
|
48 |
await xx.reply(
|
49 |
f"**WebShot Generated**\n**URL**: {xurl}",
|
requirements.txt
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
-
py-Ultroid
|
2 |
gingerit
|
3 |
Telethon==1.21.1
|
4 |
git+https://github.com/buddhhu/search-engine-parser.git
|
5 |
git+https://github.com/buddhhu/ofox.git
|
6 |
git+https://github.com/ProgrammingError/rextester_py.git
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
py-Ultroid==2021.4.15
|
2 |
gingerit
|
3 |
Telethon==1.21.1
|
4 |
git+https://github.com/buddhhu/search-engine-parser.git
|
5 |
git+https://github.com/buddhhu/ofox.git
|
6 |
git+https://github.com/ProgrammingError/rextester_py.git
|
7 |
+
google-assistant-grpc
|
8 |
+
tenacity
|
9 |
+
google-assistant-sdk
|
10 |
+
|
11 |
+
|
resources/session/ssgen.py
CHANGED
@@ -9,6 +9,10 @@
|
|
9 |
import os
|
10 |
from time import sleep
|
11 |
|
|
|
|
|
|
|
|
|
12 |
# https://www.tutorialspoint.com/how-to-clear-screen-in-python#:~:text=In%20Python%20sometimes%20we%20have,screen%20by%20pressing%20Control%20%2B%20l%20.
|
13 |
if os.name == "posix":
|
14 |
_ = os.system("clear")
|
@@ -35,7 +39,7 @@ try:
|
|
35 |
sleep(0.1)
|
36 |
|
37 |
x = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
|
38 |
-
except:
|
39 |
print("Installing Telethon...")
|
40 |
os.system("pip install telethon")
|
41 |
|
@@ -48,11 +52,7 @@ else:
|
|
48 |
print(a)
|
49 |
print(x)
|
50 |
|
51 |
-
from telethon.errors.rpcerrorlist import (ApiIdInvalidError,
|
52 |
-
PhoneNumberInvalidError)
|
53 |
# the imports
|
54 |
-
from telethon.sessions import StringSession
|
55 |
-
from telethon.sync import TelegramClient
|
56 |
|
57 |
print(
|
58 |
"Get your API ID and API HASH from my.telegram.org or @ScrapperRoBot to proceed.\n\n",
|
|
|
9 |
import os
|
10 |
from time import sleep
|
11 |
|
12 |
+
from telethon.errors.rpcerrorlist import ApiIdInvalidError, PhoneNumberInvalidError
|
13 |
+
from telethon.sessions import StringSession
|
14 |
+
from telethon.sync import TelegramClient
|
15 |
+
|
16 |
# https://www.tutorialspoint.com/how-to-clear-screen-in-python#:~:text=In%20Python%20sometimes%20we%20have,screen%20by%20pressing%20Control%20%2B%20l%20.
|
17 |
if os.name == "posix":
|
18 |
_ = os.system("clear")
|
|
|
39 |
sleep(0.1)
|
40 |
|
41 |
x = "\bFound an existing installation of Telethon...\nSuccessfully Imported.\n\n"
|
42 |
+
except BaseException:
|
43 |
print("Installing Telethon...")
|
44 |
os.system("pip install telethon")
|
45 |
|
|
|
52 |
print(a)
|
53 |
print(x)
|
54 |
|
|
|
|
|
55 |
# the imports
|
|
|
|
|
56 |
|
57 |
print(
|
58 |
"Get your API ID and API HASH from my.telegram.org or @ScrapperRoBot to proceed.\n\n",
|
resources/startup/locals.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
# Copyright (C) 2020 TeamUltroid
|
4 |
#
|
5 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
6 |
-
# Please read the GNU Affero General Public License in
|
|
|
7 |
|
8 |
# Standalone file for facilitating local deploys.
|
9 |
|
@@ -72,20 +73,21 @@ def start():
|
|
72 |
print(all_done)
|
73 |
isitdone = input("\n\nIs it all correct? [y/n]")
|
74 |
if isitdone == "y":
|
75 |
-
|
|
|
76 |
f.write(all_done)
|
77 |
f.close
|
78 |
elif isitdone == "n":
|
79 |
print("Oh, let's redo these then -_-")
|
80 |
start()
|
81 |
else:
|
82 |
-
|
|
|
83 |
f.write(all_done)
|
84 |
f.close
|
85 |
clear_screen()
|
86 |
print("\nCongrats. All done!\nTime to start the bot!")
|
87 |
print("\nInstalling requirements... This might take a while...")
|
88 |
-
os.system("cd Ultroid")
|
89 |
os.system("pip3 install -r ./resources/extras/local-requirements.txt")
|
90 |
clear_screen()
|
91 |
print(a)
|
@@ -118,7 +120,7 @@ def check_for_py():
|
|
118 |
"Enter Choice:\n1. Continue, python is installed.\n2. Exit and install python.\n",
|
119 |
),
|
120 |
)
|
121 |
-
except:
|
122 |
print("Please run the script again, and enter the choice as a number!!")
|
123 |
exit(0)
|
124 |
if ch == 1:
|
@@ -133,7 +135,8 @@ def check_for_py():
|
|
133 |
|
134 |
def gen_session():
|
135 |
print("\nProcessing...")
|
136 |
-
|
|
|
137 |
return
|
138 |
|
139 |
|
|
|
3 |
# Copyright (C) 2020 TeamUltroid
|
4 |
#
|
5 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
6 |
+
# Please read the GNU Affero General Public License in
|
7 |
+
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
8 |
|
9 |
# Standalone file for facilitating local deploys.
|
10 |
|
|
|
73 |
print(all_done)
|
74 |
isitdone = input("\n\nIs it all correct? [y/n]")
|
75 |
if isitdone == "y":
|
76 |
+
# https://github.com/TeamUltroid/Ultroid/blob/31b9eb1f4f8059e0ae66adb74cb6e8174df12eac/resources/startup/locals.py#L35
|
77 |
+
f = open(".env", "w")
|
78 |
f.write(all_done)
|
79 |
f.close
|
80 |
elif isitdone == "n":
|
81 |
print("Oh, let's redo these then -_-")
|
82 |
start()
|
83 |
else:
|
84 |
+
# https://github.com/TeamUltroid/Ultroid/blob/31b9eb1f4f8059e0ae66adb74cb6e8174df12eac/resources/startup/locals.py#L35
|
85 |
+
f = open(".env", "w")
|
86 |
f.write(all_done)
|
87 |
f.close
|
88 |
clear_screen()
|
89 |
print("\nCongrats. All done!\nTime to start the bot!")
|
90 |
print("\nInstalling requirements... This might take a while...")
|
|
|
91 |
os.system("pip3 install -r ./resources/extras/local-requirements.txt")
|
92 |
clear_screen()
|
93 |
print(a)
|
|
|
120 |
"Enter Choice:\n1. Continue, python is installed.\n2. Exit and install python.\n",
|
121 |
),
|
122 |
)
|
123 |
+
except BaseException:
|
124 |
print("Please run the script again, and enter the choice as a number!!")
|
125 |
exit(0)
|
126 |
if ch == 1:
|
|
|
135 |
|
136 |
def gen_session():
|
137 |
print("\nProcessing...")
|
138 |
+
# https://github.com/TeamUltroid/Ultroid/blob/31b9eb1f4f8059e0ae66adb74cb6e8174df12eac/resources/startup/locals.py#L35
|
139 |
+
os.system("python3 resources/session/ssgen.py")
|
140 |
return
|
141 |
|
142 |
|
src/handlers/queue.ts
CHANGED
@@ -24,9 +24,9 @@ export const queueHandler = Composer.command('queue', async ctx => {
|
|
24 |
queue && queue.length > 0
|
25 |
? queue.map((data, index) => {
|
26 |
const { info, from } = data;
|
27 |
-
return `<b>${index + 1} -</b> <a href="https://www.youtube.com/watch?v=${info.id}">${escapeHtml(info.title)}</a> (${getDuration(info.duration)})\n<b>Requested By :</b> <a href="tg://user?id=${from.id}">${from.f_name}</a
|
28 |
}).join('\n')
|
29 |
: 'The queue is empty.';
|
30 |
|
31 |
await ctx.replyWithHTML(message, { disable_web_page_preview: true });
|
32 |
-
});
|
|
|
24 |
queue && queue.length > 0
|
25 |
? queue.map((data, index) => {
|
26 |
const { info, from } = data;
|
27 |
+
return `<b>${index + 1} -</b> <a href="https://www.youtube.com/watch?v=${info.id}">${escapeHtml(info.title)}</a> (${getDuration(info.duration)})\n<b>Requested By :</b> <a href="tg://user?id=${from.id}">${from.f_name}</a>\n`
|
28 |
}).join('\n')
|
29 |
: 'The queue is empty.';
|
30 |
|
31 |
await ctx.replyWithHTML(message, { disable_web_page_preview: true });
|
32 |
+
});
|
src/handlers/skip.ts
CHANGED
@@ -29,7 +29,8 @@ export const skipCBHandler = Composer.action(/^skip:[a-zA-Z0-9.\-_]+$/, checkExp
|
|
29 |
await ctx.answerCbQuery("Skipped ...");
|
30 |
setTimeout(async () => await ctx.deleteMessage(), 1000);
|
31 |
} else {
|
32 |
-
await ctx.answerCbQuery("There's no song playing..")
|
|
|
33 |
}
|
34 |
})
|
35 |
|
@@ -42,4 +43,4 @@ export const skipCommand = Composer.command('skip', async ctx => {
|
|
42 |
|
43 |
const skipped = skip(chat.id);
|
44 |
ctx.reply(skipped ? 'Skipped.' : "There's no song playing.");
|
45 |
-
})
|
|
|
29 |
await ctx.answerCbQuery("Skipped ...");
|
30 |
setTimeout(async () => await ctx.deleteMessage(), 1000);
|
31 |
} else {
|
32 |
+
await ctx.answerCbQuery("There's no song playing..");
|
33 |
+
setTimeout(async () => await ctx.deleteMessage(), 1000);
|
34 |
}
|
35 |
})
|
36 |
|
|
|
43 |
|
44 |
const skipped = skip(chat.id);
|
45 |
ctx.reply(skipped ? 'Skipped.' : "There's no song playing.");
|
46 |
+
})
|
src/tgcalls.ts
CHANGED
@@ -49,6 +49,7 @@ interface CachedConnection {
|
|
49 |
currentSong: CurrentSong | null;
|
50 |
joinResolve?: (value: JoinVoiceCallResponse) => void;
|
51 |
source?: number;
|
|
|
52 |
}
|
53 |
|
54 |
const ws = new WebSocket(env.WEBSOCKET_URL);
|
@@ -68,7 +69,6 @@ ws.on('message', response => {
|
|
68 |
break;
|
69 |
}
|
70 |
// case 'left_vc': {
|
71 |
-
// cache.delete(data.chat.id);
|
72 |
// break;
|
73 |
// }
|
74 |
default:
|
@@ -161,10 +161,11 @@ const createConnection = async (chat: Chat.SupergroupChat): Promise<void> => {
|
|
161 |
stream,
|
162 |
queue,
|
163 |
currentSong: null,
|
|
|
164 |
};
|
165 |
|
166 |
connection.joinVoiceCall = payload => {
|
167 |
-
|
168 |
return new Promise(resolve => {
|
169 |
cachedConnection.joinResolve = resolve;
|
170 |
|
@@ -216,35 +217,34 @@ const createConnection = async (chat: Chat.SupergroupChat): Promise<void> => {
|
|
216 |
stream.emit('finish');
|
217 |
}
|
218 |
} else {
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
cachedConnection.currentSong = null;
|
225 |
}
|
226 |
});
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
};
|
239 |
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
// }
|
248 |
|
249 |
export const addToQueue = async (chat: Chat.SupergroupChat, url: string, by: Queue['from']): Promise<number | null> => {
|
250 |
if (!cache.has(chat.id)) {
|
@@ -253,6 +253,11 @@ export const addToQueue = async (chat: Chat.SupergroupChat, url: string, by: Que
|
|
253 |
}
|
254 |
|
255 |
const connection = cache.get(chat.id)!;
|
|
|
|
|
|
|
|
|
|
|
256 |
const { stream, queue } = connection;
|
257 |
|
258 |
let songInfo: DownloadedSong['info'];
|
|
|
49 |
currentSong: CurrentSong | null;
|
50 |
joinResolve?: (value: JoinVoiceCallResponse) => void;
|
51 |
source?: number;
|
52 |
+
leftVC: boolean
|
53 |
}
|
54 |
|
55 |
const ws = new WebSocket(env.WEBSOCKET_URL);
|
|
|
69 |
break;
|
70 |
}
|
71 |
// case 'left_vc': {
|
|
|
72 |
// break;
|
73 |
// }
|
74 |
default:
|
|
|
161 |
stream,
|
162 |
queue,
|
163 |
currentSong: null,
|
164 |
+
leftVC: false
|
165 |
};
|
166 |
|
167 |
connection.joinVoiceCall = payload => {
|
168 |
+
cachedConnection.source = payload.source;
|
169 |
return new Promise(resolve => {
|
170 |
cachedConnection.joinResolve = resolve;
|
171 |
|
|
|
217 |
stream.emit('finish');
|
218 |
}
|
219 |
} else {
|
220 |
+
try {
|
221 |
+
leaveVc(chat.id);
|
222 |
+
} catch (err) {
|
223 |
+
console.error(err);
|
224 |
+
}
|
225 |
cachedConnection.currentSong = null;
|
226 |
}
|
227 |
});
|
228 |
+
stream.on('leave', () => {
|
229 |
+
const data = {
|
230 |
+
_: 'leave',
|
231 |
+
data: {
|
232 |
+
source: cachedConnection.source,
|
233 |
+
chat: chat
|
234 |
+
},
|
235 |
+
};
|
236 |
+
ws.send(JSON.stringify(data));
|
237 |
+
cachedConnection.leftVC = true;
|
238 |
+
});
|
239 |
};
|
240 |
|
241 |
+
export const leaveVc = (chatId: number) => {
|
242 |
+
if (cache.has(chatId)) {
|
243 |
+
const { stream } = cache.get(chatId)!;
|
244 |
+
stream.emit('leave');
|
245 |
+
}
|
246 |
+
return false;
|
247 |
+
}
|
|
|
248 |
|
249 |
export const addToQueue = async (chat: Chat.SupergroupChat, url: string, by: Queue['from']): Promise<number | null> => {
|
250 |
if (!cache.has(chat.id)) {
|
|
|
253 |
}
|
254 |
|
255 |
const connection = cache.get(chat.id)!;
|
256 |
+
if (connection.leftVC) {
|
257 |
+
cache.delete(chat.id);
|
258 |
+
await createConnection(chat);
|
259 |
+
return addToQueue(chat, url, by);
|
260 |
+
}
|
261 |
const { stream, queue } = connection;
|
262 |
|
263 |
let songInfo: DownloadedSong['info'];
|
vcstarter.py
CHANGED
@@ -6,10 +6,12 @@ from aiohttp import web
|
|
6 |
from aiohttp.http_websocket import WSMsgType
|
7 |
from pyUltroid import Var, vcbot
|
8 |
from telethon import TelegramClient
|
9 |
-
from telethon.errors import ChannelPrivateError
|
10 |
from telethon.tl.functions.channels import GetFullChannelRequest
|
11 |
-
from telethon.tl.functions.phone import (
|
12 |
-
|
|
|
|
|
|
|
13 |
from telethon.tl.types import DataJSON
|
14 |
|
15 |
bot = TelegramClient(None, Var.API_ID, Var.API_HASH).start(bot_token=Var.BOT_TOKEN)
|
@@ -46,7 +48,7 @@ if vcbot:
|
|
46 |
return await bot.send_message(data["chat"]["id"], "`" + str(ex) + "`")
|
47 |
try:
|
48 |
call = await vcbot(GetGroupCallRequest(full_chat.full_chat.call))
|
49 |
-
except:
|
50 |
call = None
|
51 |
if not call:
|
52 |
return await bot.send_message(
|
@@ -100,36 +102,45 @@ if vcbot:
|
|
100 |
},
|
101 |
}
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
async def websocket_handler(request):
|
135 |
ws = web.WebSocketResponse()
|
|
|
6 |
from aiohttp.http_websocket import WSMsgType
|
7 |
from pyUltroid import Var, vcbot
|
8 |
from telethon import TelegramClient
|
|
|
9 |
from telethon.tl.functions.channels import GetFullChannelRequest
|
10 |
+
from telethon.tl.functions.phone import (
|
11 |
+
GetGroupCallRequest,
|
12 |
+
JoinGroupCallRequest,
|
13 |
+
LeaveGroupCallRequest,
|
14 |
+
)
|
15 |
from telethon.tl.types import DataJSON
|
16 |
|
17 |
bot = TelegramClient(None, Var.API_ID, Var.API_HASH).start(bot_token=Var.BOT_TOKEN)
|
|
|
48 |
return await bot.send_message(data["chat"]["id"], "`" + str(ex) + "`")
|
49 |
try:
|
50 |
call = await vcbot(GetGroupCallRequest(full_chat.full_chat.call))
|
51 |
+
except BaseException:
|
52 |
call = None
|
53 |
if not call:
|
54 |
return await bot.send_message(
|
|
|
102 |
},
|
103 |
}
|
104 |
|
105 |
+
async def leave_vc(data):
|
106 |
+
await bot.send_message(Var.LOG_CHANNEL, "Received Leave Request")
|
107 |
+
try:
|
108 |
+
await get_entity(data["chat"]["id"])
|
109 |
+
except Exception as ex:
|
110 |
+
return await bot.send_message(
|
111 |
+
data["chat"]["id"], "Exception in Get_Entity : `" + str(ex) + "`"
|
112 |
+
)
|
113 |
+
try:
|
114 |
+
full_chat = await vcbot(GetFullChannelRequest(chat))
|
115 |
+
except Exception as ex:
|
116 |
+
return await bot.send_message(
|
117 |
+
data["chat"]["id"],
|
118 |
+
"Exception in GetFullChannelRequest `" + str(ex) + "`",
|
119 |
+
)
|
120 |
+
try:
|
121 |
+
call = full_chat.full_chat.call
|
122 |
+
# call = await vcbot(GetGroupCallRequest(full_chat.full_chat.call))
|
123 |
+
except BaseException:
|
124 |
+
call = None
|
125 |
+
|
126 |
+
try:
|
127 |
+
result = await vcbot(
|
128 |
+
LeaveGroupCallRequest(
|
129 |
+
call=call,
|
130 |
+
source=data["source"],
|
131 |
+
),
|
132 |
+
)
|
133 |
+
await bot.send_message(
|
134 |
+
Var.LOG_CHANNEL,
|
135 |
+
f"`Left Voice Chat in {(await bot.get_entity(data['chat']['id'])).title}`",
|
136 |
+
)
|
137 |
+
except Exception as ex:
|
138 |
+
return await bot.send_message(
|
139 |
+
data["chat"]["id"],
|
140 |
+
"Exception in LeaveGRoupCallRequest: `" + str(ex) + "`",
|
141 |
+
)
|
142 |
+
|
143 |
+
return {"_": "left_vc", "data": {"chat_id": data["chat"]["id"]}}
|
144 |
|
145 |
async def websocket_handler(request):
|
146 |
ws = web.WebSocketResponse()
|