updates 24-02
This commit is contained in:
@@ -3,9 +3,8 @@
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
FROM python:3.9.2
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
RUN wget https://raw.githubusercontent.com/TeamUltroid/Ultroid/main/resources/startup/deploy.sh
|
||||
RUN sh deploy.sh
|
||||
FROM python:3.9.2-slim-buster
|
||||
COPY resources/startup/deploy.sh .
|
||||
RUN chmod +x deploy.sh && sh deploy.sh
|
||||
WORKDIR /root/TeamUltroid/
|
||||
CMD ["bash", "resources/startup/startup.sh"]
|
||||
|
||||
10
README.md
10
README.md
@@ -5,17 +5,17 @@ A stable pluggable Telegram userbot, based on Telethon.
|
||||
<img src="./resources/extras/logo_rdm.png" alt="TeamUltroid">
|
||||
</p>
|
||||
|
||||
[](https://github.com/TeamUltroid/Ultroid/stargazers)
|
||||
[](https://github.com/TeamUltroid/Ultroid/fork)
|
||||
[](https://github.com/TeamUltroid/Ultroid/stargazers)
|
||||
[](https://github.com/TeamUltroid/Ultroid/fork)
|
||||
[](https://www.python.org/)
|
||||
[](https://github.com/TeamUltroid/Ultroid/graphs/contributors)
|
||||
[](https://github.com/TeamUltroid/Ultroid/graphs/contributors)
|
||||
[](https://github.com/TeamUltroid/Ultroid/blob/main/LICENSE)
|
||||
[](https://github.com/TeamUltroid/Ultroid/)
|
||||
[](https://github.com/TeamUltroid/Ultroid/)
|
||||
|
||||
<details>
|
||||
<summary>More Info</summary>
|
||||
<br>
|
||||
Documentation soon.. <br />
|
||||
<b>Documentation</b> - <a href="https://ultroid.netlify.app">ultroid.netlify.app</a> <br />
|
||||
</details>
|
||||
|
||||
# Deploy
|
||||
|
||||
@@ -92,3 +92,79 @@ async def dell(event):
|
||||
return await event.edit("Done!")
|
||||
except BaseException:
|
||||
return await event.edit("Something went wrong...")
|
||||
|
||||
|
||||
@callback("alvcstmm")
|
||||
@owner
|
||||
async def alvcs(event):
|
||||
await event.edit(
|
||||
"Customise your PMPERMIT Settings -",
|
||||
buttons=[
|
||||
[Button.inline("PM Text", data="alvtxx")],
|
||||
[Button.inline("Pm Media", data="alvmedd")],
|
||||
[Button.inline("Delete PM Media", data="delmedd")],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@callback("alvtxx")
|
||||
@owner
|
||||
async def name(event):
|
||||
await event.delete()
|
||||
pru = event.sender_id
|
||||
var = "PM_TEXT"
|
||||
name = "PM Text"
|
||||
async with event.client.conversation(pru) as conv:
|
||||
await conv.send_message(
|
||||
"**PM Text**\nEnter the new alive text.\n\nUse /cancel to terminate the operation."
|
||||
)
|
||||
response = conv.wait_event(events.NewMessage(chats=pruu))
|
||||
response = await response
|
||||
themssg = response.message.message
|
||||
if themssg == "/cancel":
|
||||
return await conv.send_message("Cancelled!!")
|
||||
else:
|
||||
await setit(event, var, themssg)
|
||||
await conv.send_message("{} changed to {}".format(name, themssg))
|
||||
|
||||
|
||||
@callback("alvmedd")
|
||||
@owner
|
||||
async def media(event):
|
||||
await event.delete()
|
||||
pru = event.sender_id
|
||||
var = "PMPIC"
|
||||
name = "PM Media"
|
||||
async with event.client.conversation(pru) as conv:
|
||||
await conv.send_message(
|
||||
"**PM Media**\nSend me a pic/gif/bot api id of sticker to set as alive media.\n\nUse /cancel to terminate the operation."
|
||||
)
|
||||
response = await conv.get_response()
|
||||
try:
|
||||
themssg = response.message.message
|
||||
if themssg == "/cancel":
|
||||
return await conv.send_message("Operation cancelled!!")
|
||||
except BaseException:
|
||||
pass
|
||||
media = await event.client.download_media(response, "alvpcc")
|
||||
if not (response.text).startswith("/") and not response.text == "":
|
||||
url = response.text
|
||||
else:
|
||||
try:
|
||||
x = upload_file(media)
|
||||
url = f"https://telegra.ph/{x[0]}"
|
||||
os.remove(media)
|
||||
except BaseException:
|
||||
return await conv.send_message("Terminated.")
|
||||
await setit(event, var, url)
|
||||
await conv.send_message("{} has been set.".format(name))
|
||||
|
||||
|
||||
@callback("delmedd")
|
||||
@owner
|
||||
async def dell(event):
|
||||
try:
|
||||
udB.delete("PMPIC")
|
||||
return await event.edit("Done!")
|
||||
except BaseException:
|
||||
return await event.edit("Something went wrong...")
|
||||
|
||||
@@ -29,16 +29,9 @@ async def gsearch(q_event):
|
||||
except IndexError:
|
||||
kkkk = q_event.builder.article(
|
||||
title="Search Something",
|
||||
thumb=wb(
|
||||
gugirl,
|
||||
0,
|
||||
"image/jpeg",
|
||||
[]),
|
||||
thumb=wb(gugirl, 0, "image/jpeg", []),
|
||||
text="**Gᴏᴏɢʟᴇ Sᴇᴀʀᴄʜ**\n\nYou didn't search anything",
|
||||
buttons=Button.switch_inline(
|
||||
"Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
|
||||
query="go ",
|
||||
same_peer=True),
|
||||
buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="go ", same_peer=True),
|
||||
)
|
||||
await q_event.answer([kkkk])
|
||||
searcher = []
|
||||
@@ -150,16 +143,9 @@ async def _(e):
|
||||
except IndexError:
|
||||
kkkk = e.builder.article(
|
||||
title="Search Something",
|
||||
thumb=wb(
|
||||
ps,
|
||||
0,
|
||||
"image/jpeg",
|
||||
[]),
|
||||
thumb=wb(ps, 0, "image/jpeg", []),
|
||||
text="**Pʟᴀʏ Sᴛᴏʀᴇ**\n\nYou didn't search anything",
|
||||
buttons=Button.switch_inline(
|
||||
"Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
|
||||
query="app ",
|
||||
same_peer=True),
|
||||
buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="app ", same_peer=True),
|
||||
)
|
||||
await e.answer([kkkk])
|
||||
foles = []
|
||||
@@ -212,10 +198,7 @@ async def _(e):
|
||||
kkkk = e.builder.article(
|
||||
title="Search Something",
|
||||
text="**Mᴏᴅᴅᴇᴅ Aᴘᴘs**\n\nYou didn't search anything",
|
||||
buttons=Button.switch_inline(
|
||||
"Sᴇᴀʀᴄʜ Aɢᴀɪɴ",
|
||||
query="mods ",
|
||||
same_peer=True),
|
||||
buttons=Button.switch_inline("Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="mods ", same_peer=True),
|
||||
)
|
||||
await e.answer([kkkk])
|
||||
page = 1
|
||||
@@ -277,7 +260,7 @@ async def clip(e):
|
||||
quer = quer.replace(" ", "+")
|
||||
sear = f"https://clipartix.com/search/{quer}"
|
||||
html = urlopen(sear)
|
||||
bs = BeautifulSoup(html, "lxml", from_encoding="utf-8")
|
||||
bs = BeautifulSoup(html, "html.parser", from_encoding="utf-8")
|
||||
resul = bs.find_all("img", "attachment-full size-full")
|
||||
buil = e.builder
|
||||
hm = []
|
||||
|
||||
@@ -18,7 +18,7 @@ async def otvaar(event):
|
||||
buttons=[
|
||||
[Button.inline("Tag Logger", data="taglog")],
|
||||
[Button.inline("PM Permit", data="pmset")],
|
||||
[Button.inline("SuperFban", data="sfban")]
|
||||
[Button.inline("SuperFban", data="sfban")],
|
||||
],
|
||||
)
|
||||
|
||||
@@ -75,11 +75,13 @@ async def pmofff(event):
|
||||
@callback("sfban")
|
||||
@owner
|
||||
async def sfban(event):
|
||||
await event.edit("SuperFban Settings:",
|
||||
buttons=[
|
||||
[Button.inline("FBan Group", data="sfgrp")],
|
||||
[Button.inline("Exclude Feds", data="sfexf")]
|
||||
])
|
||||
await event.edit(
|
||||
"SuperFban Settings:",
|
||||
buttons=[
|
||||
[Button.inline("FBan Group", data="sfgrp")],
|
||||
[Button.inline("Exclude Feds", data="sfexf")],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@callback("sfgrp")
|
||||
@@ -90,7 +92,9 @@ async def sfgrp(event):
|
||||
var = "FBAN_GROUP_ID"
|
||||
pru = event.sender_id
|
||||
async with asst.conversation(pru) as conv:
|
||||
await conv.send_message(f"Make a group, add @MissRose_Bot, send `{hndlr}id`, copy that and send it here.\nUse /cancel to go back.")
|
||||
await conv.send_message(
|
||||
f"Make a group, add @MissRose_Bot, send `{hndlr}id`, copy that and send it here.\nUse /cancel to go back."
|
||||
)
|
||||
response = conv.wait_event(events.NewMessage(chats=pru))
|
||||
response = await response
|
||||
themssg = response.message.message
|
||||
@@ -109,7 +113,9 @@ async def sfexf(event):
|
||||
var = "EXCLUDE_FED"
|
||||
pru = event.sender_id
|
||||
async with asst.conversation(pru) as conv:
|
||||
await conv.send_message(f"Send the Fed IDs you want to exclude in the ban. Split by a space.\neg`id1 id2 id3`\nSet is as `None` if you dont want any.\nUse /cancel to go back.")
|
||||
await conv.send_message(
|
||||
f"Send the Fed IDs you want to exclude in the ban. Split by a space.\neg`id1 id2 id3`\nSet is as `None` if you dont want any.\nUse /cancel to go back."
|
||||
)
|
||||
response = conv.wait_event(events.NewMessage(chats=pru))
|
||||
response = await response
|
||||
themssg = response.message.message
|
||||
|
||||
@@ -107,6 +107,7 @@ async def setting(event):
|
||||
"Choose from the below options -",
|
||||
buttons=[
|
||||
[custom.Button.inline("Alive Customisation", data="alvcstm")],
|
||||
[custom.Button.inline("PM Customisation", data="alvcstmm")],
|
||||
[custom.Button.inline("API Keys", data="apiset")],
|
||||
[custom.Button.inline("Other Vars.", data="otvars")],
|
||||
],
|
||||
|
||||
@@ -13,7 +13,8 @@ import time
|
||||
|
||||
from pyUltroid.functions.all import *
|
||||
from telethon import Button
|
||||
from telethon.tl.types import DocumentAttributeAudio, InputWebDocument as wb
|
||||
from telethon.tl.types import DocumentAttributeAudio
|
||||
from telethon.tl.types import InputWebDocument as wb
|
||||
from youtube_dl import YoutubeDL
|
||||
from youtubesearchpython import VideosSearch
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ if Var.BOT_USERNAME is not None and asst is not None:
|
||||
"• Iɴsᴛᴀʟʟ A Pʟᴜɢɪɴ Mᴀɴᴜᴀʟʟʏ Oʀ Aᴅᴅ Vᴀʀ ADDON Wɪᴛʜ Vᴀʟᴜᴇ Tʀᴜᴇ",
|
||||
cache_time=0,
|
||||
alert=True,
|
||||
link_preview=False,
|
||||
)
|
||||
|
||||
@callback("rstrt")
|
||||
@@ -296,7 +295,7 @@ if Var.BOT_USERNAME is not None and asst is not None:
|
||||
@owner
|
||||
async def backr(event):
|
||||
xhelps = helps.format(OWNER_NAME, len(PLUGINS) - 4)
|
||||
current_page_number = 0
|
||||
current_page_number = int(upage)
|
||||
buttons = paginate_help(current_page_number, PLUGINS, "helpme")
|
||||
await event.edit(f"{xhelps}", buttons=buttons, link_preview=False)
|
||||
|
||||
@@ -304,7 +303,7 @@ if Var.BOT_USERNAME is not None and asst is not None:
|
||||
@owner
|
||||
async def backr(event):
|
||||
xhelps = zhelps.format(OWNER_NAME, len(ADDONS))
|
||||
current_page_number = 0
|
||||
current_page_number = int(addpage)
|
||||
buttons = paginate_addon(current_page_number, ADDONS, "addon")
|
||||
await event.edit(f"{xhelps}", buttons=buttons, link_preview=False)
|
||||
|
||||
@@ -427,6 +426,8 @@ def paginate_help(page_number, loaded_plugins, prefix):
|
||||
multi = os.environ.get("EMOJI_TO_DESPLAY_IN_HELP", "✘")
|
||||
mult2i = os.environ.get("EMOJI2_TO_DESPLAY_IN_HELP", "✘")
|
||||
helpable_plugins = []
|
||||
global upage
|
||||
upage = page_number
|
||||
for p in loaded_plugins:
|
||||
if not p.startswith("_"):
|
||||
helpable_plugins.append(p)
|
||||
@@ -459,6 +460,14 @@ def paginate_help(page_number, loaded_plugins, prefix):
|
||||
),
|
||||
)
|
||||
]
|
||||
else:
|
||||
pairs = pairs[
|
||||
modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
|
||||
] + [
|
||||
(
|
||||
Button.inline("-Bᴀᴄᴋ-", data="open"),
|
||||
)
|
||||
]
|
||||
return pairs
|
||||
|
||||
|
||||
@@ -468,6 +477,8 @@ def paginate_addon(page_number, loaded_plugins, prefix):
|
||||
multi = os.environ.get("EMOJI_TO_DESPLAY_IN_HELP", "✘")
|
||||
mult2i = os.environ.get("EMOJI2_TO_DESPLAY_IN_HELP", "✘")
|
||||
helpable_plugins = []
|
||||
global addpage
|
||||
addpage = page_number
|
||||
for p in loaded_plugins:
|
||||
if not p.startswith("_"):
|
||||
helpable_plugins.append(p)
|
||||
@@ -500,4 +511,12 @@ def paginate_addon(page_number, loaded_plugins, prefix):
|
||||
),
|
||||
)
|
||||
]
|
||||
else:
|
||||
pairs = pairs[
|
||||
modulo_page * number_of_rows : number_of_rows * (modulo_page + 1)
|
||||
] + [
|
||||
(
|
||||
Button.inline("-Bᴀᴄᴋ-", data="open"),
|
||||
)
|
||||
]
|
||||
return pairs
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
from telethon import events, custom
|
||||
from telethon import custom, events
|
||||
from telethon.utils import get_display_name
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_bot.on(
|
||||
events.NewMessage(
|
||||
incoming=True,
|
||||
@@ -36,7 +37,7 @@ async def all_messages_catcher(e):
|
||||
NEEDTOLOG,
|
||||
cap,
|
||||
link_preview=False,
|
||||
buttons=[[custom.Button.url(btx, msg)]]
|
||||
buttons=[[custom.Button.url(btx, msg)]],
|
||||
)
|
||||
except BaseException:
|
||||
if e.text:
|
||||
@@ -44,11 +45,7 @@ async def all_messages_catcher(e):
|
||||
else:
|
||||
cap = f"{xx} tagged you in {yy}\n\n [📨Message📨]({msg})"
|
||||
try:
|
||||
await ultroid_bot.send_message(
|
||||
NEEDTOLOG,
|
||||
cap,
|
||||
link_preview=False
|
||||
)
|
||||
await ultroid_bot.send_message(NEEDTOLOG, cap, link_preview=False)
|
||||
except BaseException:
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -24,23 +24,20 @@
|
||||
Kick the user from the chat.
|
||||
|
||||
• `{i}pin <reply to message>`
|
||||
Pin the message in the chat.
|
||||
Pin the message in the chat
|
||||
for silent pin use ({i}pin silent).
|
||||
|
||||
• `{i}unpin (all) <reply to message>`
|
||||
Unpin the message(s) in the chat.
|
||||
|
||||
• `{i}dpin <reply to message>`
|
||||
Pin the message in the chat Silently.
|
||||
|
||||
• `{i}dunpin (all) <reply to message>`
|
||||
Unpin the message(s) in the chat Silently.
|
||||
|
||||
• `{i}purge <reply to message>`
|
||||
Purge all messages from the replied message.
|
||||
|
||||
• `{i}purgeall <reply to msg/input>`
|
||||
• `{i}purgeme <reply to message>`
|
||||
Purge Only your messages from the replied message.
|
||||
|
||||
• `{i}purgeall <reply to message>`
|
||||
Delete all msgs of replied user.
|
||||
Delete all msgs of input user
|
||||
|
||||
• `{i}del <reply to message>`
|
||||
Delete the replied message.
|
||||
@@ -166,13 +163,6 @@ async def bban(ult):
|
||||
ChatBannedRights(
|
||||
until_date=None,
|
||||
view_messages=True,
|
||||
send_messages=True,
|
||||
send_media=True,
|
||||
send_stickers=True,
|
||||
send_gifs=True,
|
||||
send_games=True,
|
||||
send_inline=True,
|
||||
embed_links=True,
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -221,13 +211,6 @@ async def uunban(ult):
|
||||
ChatBannedRights(
|
||||
until_date=None,
|
||||
view_messages=None,
|
||||
send_messages=None,
|
||||
send_media=None,
|
||||
send_stickers=None,
|
||||
send_gifs=None,
|
||||
send_games=None,
|
||||
send_inline=None,
|
||||
embed_links=None,
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -280,51 +263,46 @@ async def kck(ult):
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="pin($| (.*))",
|
||||
pattern="pin ?(.*)",
|
||||
)
|
||||
async def pin(msg):
|
||||
x = await eor(msg, "`Wait...`")
|
||||
if not msg.is_private:
|
||||
# for pin(s) in private messages
|
||||
await msg.get_chat()
|
||||
cht = await ultroid_bot.get_entity(msg.chat_id)
|
||||
xx = msg.reply_to_msg_id
|
||||
if not msg.is_reply:
|
||||
return await x.edit("`Reply to a message to pin it.`")
|
||||
ch = msg.pattern_match.group(1)
|
||||
slnt = False
|
||||
if ch == "loud":
|
||||
slnt = True
|
||||
tt = msg.text
|
||||
try:
|
||||
await ultroid_bot.pin_message(msg.chat_id, xx, notify=slnt)
|
||||
except BadRequestError:
|
||||
return await x.edit("`Hmm, I'm have no rights here...`")
|
||||
except Exception as e:
|
||||
return await x.edit(f"**ERROR:**`{str(e)}`")
|
||||
await x.edit(f"`Pinned` [this message](https://t.me/c/{cht.id}/{xx})!")
|
||||
kk = tt[4]
|
||||
if kk == "g":
|
||||
return
|
||||
except BaseException:
|
||||
pass
|
||||
if not msg.is_reply:
|
||||
return
|
||||
ch = msg.pattern_match.group(1)
|
||||
if ch != "silent":
|
||||
slnt = True
|
||||
x = await eor(msg, "`Processing...`")
|
||||
try:
|
||||
await ultroid_bot.pin_message(msg.chat_id, xx, notify=slnt)
|
||||
except BadRequestError:
|
||||
return await x.edit("`Hmm, I'm have no rights here...`")
|
||||
except Exception as e:
|
||||
return await x.edit(f"**ERROR:**`{str(e)}`")
|
||||
await x.edit(f"`Pinned` [this message](https://t.me/c/{cht.id}/{xx})!")
|
||||
else:
|
||||
try:
|
||||
await ultroid_bot.pin_message(msg.chat_id, xx, notify=False)
|
||||
except BadRequestError:
|
||||
return await eor(msg, "`Hmm, I'm have no rights here...`")
|
||||
except Exception as e:
|
||||
return await eor(msg, f"**ERROR:**`{str(e)}`")
|
||||
try:
|
||||
await msg.delete()
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="dpin($| (.*))",
|
||||
)
|
||||
async def pin(msg):
|
||||
if not msg.is_private:
|
||||
# for pin(s) in private messages
|
||||
await msg.get_chat()
|
||||
cht = await ultroid_bot.get_entity(msg.chat_id)
|
||||
xx = msg.reply_to_msg_id
|
||||
if not msg.is_reply:
|
||||
return await msg.edit("Reply to a message to pin it.")
|
||||
ch = msg.pattern_match.group(1)
|
||||
slnt = False
|
||||
if ch == "loud":
|
||||
slnt = True
|
||||
try:
|
||||
await ultroid_bot.pin_message(msg.chat_id, xx, notify=slnt)
|
||||
except BadRequestError:
|
||||
return await msg.edit("Hmm, I'm have no rights here...")
|
||||
except Exception as e:
|
||||
return await msg.edit(f"**ERROR:**{str(e)}")
|
||||
await msg.delete()
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="unpin($| (.*))",
|
||||
@@ -356,34 +334,6 @@ async def unp(ult):
|
||||
return await xx.edit(f"Either reply to a message, or, use `{hndlr}unpin all`")
|
||||
await xx.edit("`Unpinned!`")
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="dunpin($| (.*))",
|
||||
)
|
||||
async def unp(ult):
|
||||
if not ult.is_private:
|
||||
# for (un)pin(s) in private messages
|
||||
await ult.get_chat()
|
||||
ch = (ult.pattern_match.group(1)).strip()
|
||||
msg = ult.reply_to_msg_id
|
||||
if msg and not ch:
|
||||
try:
|
||||
await ultroid_bot.unpin_message(ult.chat_id, msg)
|
||||
except BadRequestError:
|
||||
return await ult.edit("`Hmm, I'm have no rights here...`")
|
||||
except Exception as e:
|
||||
return await ult.edit(f"**ERROR:**\n`{str(e)}`")
|
||||
elif ch == "all":
|
||||
try:
|
||||
await ultroid_bot.unpin_message(ult.chat_id)
|
||||
except BadRequestError:
|
||||
return await ult.edit("`Hmm, I'm have no rights here...`")
|
||||
except Exception as e:
|
||||
return await ult.edit(f"**ERROR:**`{str(e)}`")
|
||||
else:
|
||||
return await ult.edit(f"Either reply to a message, or, use `{hndlr}unpin all`")
|
||||
if not msg and ch != "all":
|
||||
return await ult.edit(f"Either reply to a message, or, use `{hndlr}unpin all`")
|
||||
await ult.delete()
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="purge$",
|
||||
@@ -413,29 +363,55 @@ async def fastpurger(purg):
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="purgeall ?(.*)",
|
||||
pattern="purgeme$",
|
||||
)
|
||||
async def fastpurgerme(purg):
|
||||
chat = await purg.get_input_chat()
|
||||
msgs = []
|
||||
count = 0
|
||||
if not purg.reply_to_msg_id:
|
||||
return await eod(purg, "`Reply to a message to purge from.`", time=10)
|
||||
async for msg in ultroid_bot.iter_messages(
|
||||
chat, from_user="me", min_id=purg.reply_to_msg_id
|
||||
):
|
||||
msgs.append(msg)
|
||||
count = count + 1
|
||||
msgs.append(purg.reply_to_msg_id)
|
||||
if len(msgs) == 100:
|
||||
await ultroid_bot.delete_messages(chat, msgs)
|
||||
msgs = []
|
||||
|
||||
if msgs:
|
||||
await ultroid_bot.delete_messages(chat, msgs)
|
||||
done = await ultroid_bot.send_message(
|
||||
purg.chat_id,
|
||||
"__Fast purge complete!__\n**Purged** `" + str(count) + "` **messages.**",
|
||||
)
|
||||
await asyncio.sleep(5)
|
||||
await done.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="purgeall$",
|
||||
)
|
||||
async def _(e):
|
||||
input = e.pattern_match.group(1)
|
||||
xx = await eor(e, "`Processing...`")
|
||||
if e.reply_to_msg_id:
|
||||
input = (await e.get_reply_message()).sender_id
|
||||
if input:
|
||||
user = (await e.client.get_entity(input)).first_name
|
||||
try:
|
||||
nos = 0
|
||||
async for x in e.client.iter_messages(e.chat_id, from_user=input):
|
||||
await e.client.delete_messages(e.chat_id, x)
|
||||
nos += 1
|
||||
await e.client.send_message(
|
||||
e.chat_id, f"**Purged {nos} msgs of {input} from here**"
|
||||
)
|
||||
await xx.edit(f"**Purged **`{nos}`** msgs of **[{input}](tg://user?id={input})")
|
||||
except ValueError:
|
||||
return await eod(xx, str(er), time=5)
|
||||
else:
|
||||
return await eod(
|
||||
xx,
|
||||
"Reply to someone's msg or give their id to delete all msgs from this chat",
|
||||
time=10,
|
||||
"`Reply to someone's msg to delete.`",
|
||||
time=5,
|
||||
)
|
||||
|
||||
|
||||
@@ -452,7 +428,7 @@ async def delete_it(delme):
|
||||
await eod(
|
||||
delme,
|
||||
f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`",
|
||||
time=10,
|
||||
time=5,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -57,17 +57,17 @@ async def set_not_afk(event):
|
||||
shite = await ultroid_bot.send_message(event.chat_id, file=pic)
|
||||
shites = await ultroid_bot.send_message(
|
||||
event.chat_id,
|
||||
"`No Longer Afk`\n\nWas afk for~`" + total_afk_time + "`",
|
||||
"`No Longer Afk`\n\nWas afk for~ " + total_afk_time + "`",
|
||||
)
|
||||
else:
|
||||
shite = await ultroid_bot.send_message(
|
||||
event.chat_id,
|
||||
"`No Longer Afk`\n\nWas afk for~`" + total_afk_time + "`",
|
||||
"`No Longer Afk`\n\nWas afk for~ " + total_afk_time + "`",
|
||||
file=pic,
|
||||
)
|
||||
except BaseException:
|
||||
shite = await ultroid_bot.send_message(
|
||||
event.chat_id, "`No Longer Afk`\nWas afk for" + total_afk_time + "`"
|
||||
event.chat_id, "`No Longer Afk \nWas afk for " + total_afk_time + "`"
|
||||
)
|
||||
try:
|
||||
try:
|
||||
@@ -133,7 +133,7 @@ async def on_afk(event):
|
||||
message_to_reply = (
|
||||
f"__Master #AFK since__ `{total_afk_time}`\n\n"
|
||||
+ f"__"
|
||||
+ f"\n\n**Reason:- **{reason}"
|
||||
+ f"\n\n**Reason:- `**{reason}`"
|
||||
)
|
||||
else:
|
||||
message_to_reply = f"__Master #AFK since__ `{total_afk_time}`\n\n" + f"__"
|
||||
|
||||
51
plugins/autopic.py
Normal file
51
plugins/autopic.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2020 TeamUltroid
|
||||
#
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
"""
|
||||
✘ Commands Available -
|
||||
|
||||
• `{i}autopic <search query>`
|
||||
will change your profile pic at defined intervals.
|
||||
search query required.
|
||||
|
||||
"""
|
||||
import asyncio
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import urllib
|
||||
|
||||
from bs4 import BeautifulSoup as bs
|
||||
from requests import get
|
||||
from telethon import functions
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="autopic ?(.*)")
|
||||
async def autopic(e):
|
||||
search = e.pattern_match.group(1)
|
||||
if not search:
|
||||
return await eor(e, "Heya Give me some Text ..")
|
||||
clls = returnpage(search)
|
||||
if len(clls) == 0:
|
||||
return await eor(e, f"No Results found for `{search}`")
|
||||
num = random.randrange(0, len(clls) - 1)
|
||||
page = clls[num]
|
||||
title = page["title"]
|
||||
a = await eor(
|
||||
e, f" Got a Collection `{title}` related to your search !\nStarting Autopic !!"
|
||||
)
|
||||
while True:
|
||||
animepp(page["href"])
|
||||
file = await ultroid_bot.upload_file("autopic.jpg")
|
||||
await ultroid_bot(functions.photos.UploadProfilePhotoRequest(file))
|
||||
os.system("rm -rf autopic.jpg")
|
||||
await asyncio.sleep(1100)
|
||||
|
||||
|
||||
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
|
||||
@@ -9,7 +9,9 @@
|
||||
✘ Commands Available -
|
||||
|
||||
• `{i}install <reply to plugin>`
|
||||
To install the plugin.
|
||||
To install the plugin,
|
||||
`{i}install f`
|
||||
To force Install.
|
||||
|
||||
• `{i}uninstall <plugin name>`
|
||||
To unload and remove the plugin.
|
||||
@@ -26,13 +28,13 @@
|
||||
|
||||
import os
|
||||
|
||||
from telethon.tl.custom import Button
|
||||
from telethon import Button
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@in_pattern(
|
||||
"send (.*)",
|
||||
"send ?(.*)",
|
||||
)
|
||||
@in_owner
|
||||
async def inline_handler(event):
|
||||
@@ -40,7 +42,7 @@ async def inline_handler(event):
|
||||
input_str = event.pattern_match.group(1)
|
||||
plug = [*PLUGINS]
|
||||
plugs = []
|
||||
if input_str == "all":
|
||||
if input_str == None or input_str == "":
|
||||
for i in plug:
|
||||
try:
|
||||
plugs.append(
|
||||
@@ -52,7 +54,7 @@ async def inline_handler(event):
|
||||
buttons=[
|
||||
[
|
||||
Button.switch_inline(
|
||||
"Search Again..?", query="send all", same_peer=True
|
||||
"Search Again..?", query="send ", same_peer=True
|
||||
)
|
||||
]
|
||||
],
|
||||
@@ -96,17 +98,17 @@ async def inline_handler(event):
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="install$",
|
||||
pattern="install",
|
||||
)
|
||||
async def install(event):
|
||||
await safeinstall(event)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern=r"unload (?P<shortname>\w+)$",
|
||||
pattern=r"unload ?(.*)",
|
||||
)
|
||||
async def unload(event):
|
||||
shortname = event.pattern_match["shortname"]
|
||||
shortname = event.pattern_match.group(1)
|
||||
if not shortname:
|
||||
await eor(event, "`Give name of plugin which u want to unload`")
|
||||
return
|
||||
@@ -126,10 +128,10 @@ async def unload(event):
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern=r"uninstall (?P<shortname>\w+)$",
|
||||
pattern=r"uninstall ?(.*)",
|
||||
)
|
||||
async def uninstall(event):
|
||||
shortname = event.pattern_match["shortname"]
|
||||
shortname = event.pattern_match.group(1)
|
||||
if not shortname:
|
||||
await eor(event, "`Give name of plugin which u want to uninstall`")
|
||||
return
|
||||
@@ -150,10 +152,10 @@ async def uninstall(event):
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern=r"load (?P<shortname>\w+)$",
|
||||
pattern=r"load ?(.*)",
|
||||
)
|
||||
async def load(event):
|
||||
shortname = event.pattern_match["shortname"]
|
||||
shortname = event.pattern_match.group(1)
|
||||
if not shortname:
|
||||
await eor(event, "`Give name of plugin which u want to load`")
|
||||
return
|
||||
|
||||
@@ -33,7 +33,7 @@ from . import *
|
||||
async def google(event):
|
||||
inp = event.pattern_match.group(1)
|
||||
if not inp:
|
||||
return await event.edit("Give something to search")
|
||||
return await event.edit("`Give something to search..`")
|
||||
x = await eor(event, "`searching..`")
|
||||
gs = GoogleSearch()
|
||||
res = await gs.async_search(f"{inp}")
|
||||
@@ -52,7 +52,7 @@ async def google(event):
|
||||
async def goimg(event):
|
||||
query = event.pattern_match.group(1)
|
||||
if not query:
|
||||
return await eor(event, "`Give something to search")
|
||||
return await eor(event, "`Give something to search...`")
|
||||
nn = await eor(event, "`Processing Keep Patience...`")
|
||||
if ";" in query:
|
||||
try:
|
||||
@@ -79,7 +79,7 @@ async def goimg(event):
|
||||
async def reverse(event):
|
||||
reply = await event.get_reply_message()
|
||||
if not reply:
|
||||
return await eor(event, "`Reply to any Image`")
|
||||
return await eor(event, "`Reply to an Image`")
|
||||
ult = await eor(event, "`Processing...`")
|
||||
dl = await bot.download_media(reply)
|
||||
img = Image.open(dl)
|
||||
|
||||
217
plugins/mute.py
Normal file
217
plugins/mute.py
Normal file
@@ -0,0 +1,217 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2020 TeamUltroid
|
||||
#
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
"""
|
||||
✘ Commands Available -
|
||||
|
||||
• `{i}mute <reply to msg/ user id>`
|
||||
Mute user in current chat.
|
||||
|
||||
• `{i}unmute <reply to msg/ user id>`
|
||||
Unmute user in current chat.
|
||||
|
||||
• `{i}dmute <reply to msg/ user id>`
|
||||
Mute user in current chat by deleting msgs.
|
||||
|
||||
• `{i}undmute <reply to msg/ use id>`
|
||||
Unmute dmuted user in current chat.
|
||||
|
||||
• `{i}tmute <time> <reply to msg/ use id>`
|
||||
time - m- minutes
|
||||
h- hours
|
||||
d- days
|
||||
Mute user in current chat with time.
|
||||
"""
|
||||
|
||||
|
||||
from pyUltroid.functions.all import ban_time
|
||||
from pyUltroid.functions.mute_db import is_muted, mute, unmute
|
||||
from telethon import events
|
||||
from telethon.tl.functions.channels import EditBannedRequest
|
||||
from telethon.tl.types import ChatBannedRights
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_bot.on(events.NewMessage(incoming=True))
|
||||
async def watcher(event):
|
||||
if is_muted(f"{event.sender_id}_{event.chat_id}"):
|
||||
await event.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="dmute ?(.*)",
|
||||
)
|
||||
async def startmute(event):
|
||||
xx = await eor(event, "`Muting...`")
|
||||
private = False
|
||||
if event.is_private:
|
||||
private = True
|
||||
if event.pattern_match.group(1):
|
||||
userid = int(event.pattern_match.group(1))
|
||||
elif event.reply_to_msg_id:
|
||||
userid = (await event.get_reply_message()).sender_id
|
||||
elif private is True:
|
||||
userid = event.chat_id
|
||||
else:
|
||||
return await eod(xx, "`Reply to a user or add their userid.`", time=5)
|
||||
chat_id = event.chat_id
|
||||
chat = await event.get_chat()
|
||||
if "admin_rights" in vars(chat) and vars(chat)["admin_rights"] is not None:
|
||||
if chat.admin_rights.delete_messages is True:
|
||||
pass
|
||||
else:
|
||||
return await eor(xx, "`No proper admin rights...`", time=5)
|
||||
elif "creator" in vars(chat):
|
||||
pass
|
||||
elif private == True:
|
||||
pass
|
||||
else:
|
||||
return await eod(xx, "`No proper admin rights...`", time=5)
|
||||
if is_muted(f"{userid}_{chat_id}"):
|
||||
return await eod(xx, "`This user is already muted in this chat.`", time=5)
|
||||
try:
|
||||
mute(f"{userid}_{chat_id}")
|
||||
await eod(xx, "`Successfully muted...`", time=3)
|
||||
except Exception as e:
|
||||
await eod(xx, "Error: " + f"`{str(e)}`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="undmute ?(.*)",
|
||||
)
|
||||
async def endmute(event):
|
||||
xx = await eor(event, "`Unmuting...`")
|
||||
private = False
|
||||
if event.is_private:
|
||||
private = True
|
||||
reply = await event.get_reply_message()
|
||||
if event.pattern_match.group(1):
|
||||
userid = int(event.pattern_match.group(1))
|
||||
elif reply is not None:
|
||||
userid = reply.sender_id
|
||||
elif private is True:
|
||||
userid = event.chat_id
|
||||
else:
|
||||
return await eod(xx, "`Reply to a user or add their userid.`", time=5)
|
||||
chat_id = event.chat_id
|
||||
if not is_muted(f"{userid}_{chat_id}"):
|
||||
return await eod(xx, "`This user is not muted in this chat.`", time=3)
|
||||
try:
|
||||
unmute(f"{userid}_{chat_id}")
|
||||
await eod(xx, "`Successfully unmuted...`", time=3)
|
||||
except Exception as e:
|
||||
await eod(xx, "Error: " + f"`{str(e)}`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="tmute",
|
||||
groups_only=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Muting...`")
|
||||
huh = e.text.split(" ")
|
||||
try:
|
||||
tme = huh[1]
|
||||
except:
|
||||
return await eod(xx, "`Time till mute?`", time=5)
|
||||
try:
|
||||
input = huh[2]
|
||||
except:
|
||||
pass
|
||||
chat = await e.get_chat()
|
||||
if e.reply_to_msg_id:
|
||||
userid = (await e.get_reply_message()).sender_id
|
||||
name = (await e.client.get_entity(userid)).first_name
|
||||
elif input:
|
||||
userid = int(input)
|
||||
name = (await e.client.get_entity(input)).first_name
|
||||
else:
|
||||
return await eod(xx, "`Reply to someone or use its id...`", time=3)
|
||||
if userid == ultroid_bot.uid:
|
||||
return await eod(xx, "`I can't mute myself.`", time=3)
|
||||
try:
|
||||
bun = await ban_time(xx, tme)
|
||||
await e.client(
|
||||
EditBannedRequest(
|
||||
chat.id, userid, ChatBannedRights(until_date=bun, send_messages=True)
|
||||
)
|
||||
)
|
||||
await eod(
|
||||
xx,
|
||||
f"`Successfully Muted` [{name}](tg://user?id={userid}) `in {chat.title} for {tme}`",
|
||||
time=5,
|
||||
)
|
||||
except BaseException as m:
|
||||
await eod(xx, f"`{str(m)}`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="unmute ?(.*)",
|
||||
groups_only=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Unmuting...`")
|
||||
input = int(e.pattern_match.group(1)) if e.pattern_match.group(1) else None
|
||||
chat = await e.get_chat()
|
||||
if e.reply_to_msg_id:
|
||||
userid = (await e.get_reply_message()).sender_id
|
||||
name = (await e.client.get_entity(userid)).first_name
|
||||
elif input:
|
||||
userid = input
|
||||
name = (await e.client.get_entity(input)).first_name
|
||||
else:
|
||||
return await eod(xx, "`Reply to someone or use its id...`", time=3)
|
||||
try:
|
||||
await e.client(
|
||||
EditBannedRequest(
|
||||
chat.id, userid, ChatBannedRights(until_date=None, send_messages=False)
|
||||
)
|
||||
)
|
||||
await eod(
|
||||
xx,
|
||||
f"`Successfully Unmuted` [{name}](tg://user?id={userid}) `in {chat.title}`",
|
||||
time=5,
|
||||
)
|
||||
except BaseException as m:
|
||||
await eod(xx, f"`{str(m)}`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="mute ?(.*)",
|
||||
groups_only=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Muting...`")
|
||||
input = int(e.pattern_match.group(1)) if e.pattern_match.group(1) else None
|
||||
chat = await e.get_chat()
|
||||
if e.reply_to_msg_id:
|
||||
userid = (await e.get_reply_message()).sender_id
|
||||
name = (await e.client.get_entity(userid)).first_name
|
||||
elif input:
|
||||
userid = input
|
||||
name = (await e.client.get_entity(input)).first_name
|
||||
else:
|
||||
return await eod(xx, "`Reply to someone or use its id...`", time=3)
|
||||
if userid == ultroid_bot.uid:
|
||||
return await eod(xx, "`I can't mute myself.`", time=3)
|
||||
try:
|
||||
await e.client(
|
||||
EditBannedRequest(
|
||||
chat.id, userid, ChatBannedRights(until_date=None, send_messages=True)
|
||||
)
|
||||
)
|
||||
await eod(
|
||||
xx,
|
||||
f"`Successfully Muted` [{name}](tg://user?id={userid}) `in {chat.title}`",
|
||||
time=5,
|
||||
)
|
||||
except BaseException as m:
|
||||
await eod(xx, f"`{str(m)}`")
|
||||
|
||||
|
||||
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
|
||||
@@ -5,6 +5,22 @@
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
"""
|
||||
✘ Commands Available -
|
||||
|
||||
• `{i}a` or `{i}approve`
|
||||
To Approve Someone In PM.
|
||||
|
||||
• `{i}da` or `{i}disapprove`
|
||||
To Disapprove Someone In PM.
|
||||
|
||||
• `{i}block`
|
||||
To Block Someone in PM.
|
||||
|
||||
• `{i}unblock`
|
||||
To Unblock Someone in PM.
|
||||
"""
|
||||
|
||||
from pyUltroid.functions.pmpermit_db import *
|
||||
from telethon import events
|
||||
from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
|
||||
@@ -15,12 +31,32 @@ from . import *
|
||||
# ========================= CONSTANTS =============================
|
||||
COUNT_PM = {}
|
||||
LASTMSG = {}
|
||||
PMPIC = "https://telegra.ph/file/94f6a4aeb21ce2d58dd41.jpg"
|
||||
UNAPPROVED_MSG = """
|
||||
if Redis("PMPIC"):
|
||||
PMPIC = Redis("PMPIC")
|
||||
else:
|
||||
PMPIC = "https://telegra.ph/file/94f6a4aeb21ce2d58dd41.jpg"
|
||||
if not Redis("PM_MSG"):
|
||||
UNAPPROVED_MSG = """
|
||||
**PMSecurity of {}!**
|
||||
Please wait for me to respnd or you will be blocked and reported as spam!!
|
||||
|
||||
You have {}/{} warnings!"""
|
||||
else:
|
||||
UNAPPROVED_MSG = (
|
||||
"""
|
||||
**PMSecurity of {}!**
|
||||
|
||||
"""
|
||||
f"""{Redis("PM_MSG")}"""
|
||||
"""
|
||||
|
||||
Please wait for me to respnd or you will be blocked and reported as spam!!
|
||||
|
||||
You have {}/{} warnings!"""
|
||||
)
|
||||
|
||||
UND = "Please wait for me to respnd or you will be blocked and reported as spam!!"
|
||||
|
||||
WARNS = 3
|
||||
NO_REPLY = "Reply to someone's msg or try this commmand in private."
|
||||
PMCMDS = [
|
||||
@@ -39,90 +75,93 @@ if sett is None:
|
||||
if sett == "True" and sett != "False":
|
||||
|
||||
@ultroid_bot.on(events.NewMessage(outgoing=True, func=lambda e: e.is_private))
|
||||
async def autoappr(event):
|
||||
chat = await event.get_chat()
|
||||
mssg = event.text
|
||||
async def autoappr(e):
|
||||
miss = await e.get_chat()
|
||||
if miss.bot or miss.is_self:
|
||||
return
|
||||
mssg = e.text
|
||||
if mssg in PMCMDS: # do not approve if outgoing is a command.
|
||||
return
|
||||
if not is_approved(chat.id) and chat.id not in COUNT_PM:
|
||||
approve_user(chat.id)
|
||||
if not is_approved(e.chat_id):
|
||||
approve_user(e.chat_id)
|
||||
async for message in e.client.iter_messages(e.chat_id, search=UND):
|
||||
await message.delete()
|
||||
if Var.LOG_CHANNEL:
|
||||
name = await event.client.get_entity(chat.id)
|
||||
name = await e.client.get_entity(e.chat_id)
|
||||
name0 = str(name.first_name)
|
||||
await event.client.send_message(
|
||||
await e.client.send_message(
|
||||
Var.LOG_CHANNEL,
|
||||
f"#AutoApproved\nUser - [{name0}](tg://user?id={chat.id})",
|
||||
f"#AutoApproved\nUser - [{name0}](tg://user?id={e.chat_id})",
|
||||
)
|
||||
|
||||
@ultroid_bot.on(events.NewMessage(incoming=True))
|
||||
@ultroid_bot.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
|
||||
async def permitpm(event):
|
||||
if event.is_private:
|
||||
user = await event.get_chat()
|
||||
if user.bot:
|
||||
return
|
||||
apprv = is_approved(user.id)
|
||||
if not apprv and event.text != UNAPPROVED_MSG:
|
||||
try:
|
||||
wrn = COUNT_PM[user.id]
|
||||
except KeyError:
|
||||
wrn = 0
|
||||
if user.id in LASTMSG:
|
||||
prevmsg = LASTMSG[user.id]
|
||||
if event.text != prevmsg:
|
||||
async for message in event.client.iter_messages(
|
||||
user.id, from_user="me", search=UNAPPROVED_MSG
|
||||
):
|
||||
await message.delete()
|
||||
await event.client.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=UNAPPROVED_MSG.format(OWNER_NAME, wrn, WARNS),
|
||||
)
|
||||
elif event.text == prevmsg:
|
||||
async for message in event.client.iter_messages(
|
||||
user.id, from_user="me", search=UNAPPROVED_MSG
|
||||
):
|
||||
await message.delete()
|
||||
await event.client.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=UNAPPROVED_MSG.format(OWNER_NAME, wrn, WARNS),
|
||||
)
|
||||
LASTMSG.update({user.id: event.text})
|
||||
else:
|
||||
user = await event.get_chat()
|
||||
if user.bot or user.is_self:
|
||||
return
|
||||
apprv = is_approved(user.id)
|
||||
if not apprv and event.text != UND:
|
||||
try:
|
||||
wrn = COUNT_PM[user.id]
|
||||
except KeyError:
|
||||
wrn = 0
|
||||
if user.id in LASTMSG:
|
||||
prevmsg = LASTMSG[user.id]
|
||||
if event.text != prevmsg:
|
||||
async for message in event.client.iter_messages(
|
||||
user.id, search=UND
|
||||
):
|
||||
await message.delete()
|
||||
await event.client.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=UNAPPROVED_MSG.format(OWNER_NAME, wrn, WARNS),
|
||||
)
|
||||
LASTMSG.update({user.id: event.text})
|
||||
if user.id not in COUNT_PM:
|
||||
COUNT_PM.update({user.id: 1})
|
||||
else:
|
||||
COUNT_PM[user.id] = COUNT_PM[user.id] + 1
|
||||
if COUNT_PM[user.id] > WARNS:
|
||||
await event.respond(
|
||||
"`You were spamming my Master's PM, which I didn't like.`\n`You have been BLOCKED and reported as SPAM, until further notice.`"
|
||||
elif event.text == prevmsg:
|
||||
async for message in event.client.iter_messages(
|
||||
user.id, search=UND
|
||||
):
|
||||
await message.delete()
|
||||
await event.client.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=UNAPPROVED_MSG.format(OWNER_NAME, wrn, WARNS),
|
||||
)
|
||||
try:
|
||||
del COUNT_PM[user.id]
|
||||
del LASTMSG[user.id]
|
||||
except KeyError:
|
||||
if Var.LOG_CHANNEL:
|
||||
await event.client.send_message(
|
||||
Var.LOG_CHANNEL,
|
||||
"PMPermit is messed! Pls restart the bot!!",
|
||||
)
|
||||
return LOGS.info("COUNT_PM is messed.")
|
||||
await event.client(BlockRequest(user.id))
|
||||
await event.client(ReportSpamRequest(peer=user.id))
|
||||
LASTMSG.update({user.id: event.text})
|
||||
else:
|
||||
await event.client.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=UNAPPROVED_MSG.format(OWNER_NAME, wrn, WARNS),
|
||||
)
|
||||
LASTMSG.update({user.id: event.text})
|
||||
if user.id not in COUNT_PM:
|
||||
COUNT_PM.update({user.id: 1})
|
||||
else:
|
||||
COUNT_PM[user.id] = COUNT_PM[user.id] + 1
|
||||
if COUNT_PM[user.id] > WARNS:
|
||||
await event.respond(
|
||||
"`You were spamming my Master's PM, which I didn't like.`\n`You have been BLOCKED and reported as SPAM, until further notice.`"
|
||||
)
|
||||
try:
|
||||
del COUNT_PM[user.id]
|
||||
del LASTMSG[user.id]
|
||||
except KeyError:
|
||||
if Var.LOG_CHANNEL:
|
||||
name = await event.client.get_entity(user.id)
|
||||
name0 = str(name.first_name)
|
||||
await event.client.send_message(
|
||||
Var.LOG_CHANNEL,
|
||||
f"[{name0}](tg://user?id={user.id}) was blocked for spamming.",
|
||||
"PMPermit is messed! Pls restart the bot!!",
|
||||
)
|
||||
return LOGS.info("COUNT_PM is messed.")
|
||||
await event.client(BlockRequest(user.id))
|
||||
await event.client(ReportSpamRequest(peer=user.id))
|
||||
if Var.LOG_CHANNEL:
|
||||
name = await event.client.get_entity(user.id)
|
||||
name0 = str(name.first_name)
|
||||
await event.client.send_message(
|
||||
Var.LOG_CHANNEL,
|
||||
f"[{name0}](tg://user?id={user.id}) was blocked for spamming.",
|
||||
)
|
||||
|
||||
@ultroid_cmd(pattern="(a|approve)(?: |$)")
|
||||
async def approvepm(apprvpm):
|
||||
@@ -149,9 +188,7 @@ if sett == "True" and sett != "False":
|
||||
if not is_approved(uid):
|
||||
approve_user(uid)
|
||||
await apprvpm.edit(f"[{name0}](tg://user?id={uid}) `approved to PM!`")
|
||||
async for message in apprvpm.client.iter_messages(
|
||||
user.id, from_user="me", search=UNAPPROVED_MSG
|
||||
):
|
||||
async for message in apprvpm.client.iter_messages(user.id, search=UND):
|
||||
await message.delete()
|
||||
await asyncio.sleep(3)
|
||||
await apprvpm.delete()
|
||||
@@ -256,3 +293,6 @@ if sett == "True" and sett != "False":
|
||||
Var.LOG_CHANNEL,
|
||||
f"[{name0}](tg://user?id={replied_user.id}) was unblocked!.",
|
||||
)
|
||||
|
||||
|
||||
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})
|
||||
|
||||
@@ -226,7 +226,7 @@ async def _(event):
|
||||
async def wall(event):
|
||||
inp = event.pattern_match.group(1)
|
||||
if not inp:
|
||||
return await eor(event, "`Give something to search")
|
||||
return await eor(event, "`Give me something to search..`")
|
||||
nn = await eor(event, "`Processing Keep Patience...`")
|
||||
query = f"hd {inp}"
|
||||
gi = googleimagesdownload()
|
||||
|
||||
@@ -83,7 +83,7 @@ async def waifu(animu):
|
||||
else:
|
||||
await xx.edit("`You haven't written any article, Waifu is going away.`")
|
||||
return
|
||||
waifus = [32,33,37,40,41,42,58,20]
|
||||
waifus = [32, 33, 37, 40, 41, 42, 58, 20]
|
||||
finalcall = "#" + (str(random.choice(waifus)))
|
||||
try:
|
||||
sticcers = await ultroid_bot.inline_query(
|
||||
|
||||
@@ -70,14 +70,14 @@ async def upstream(ups):
|
||||
repo = Repo.init()
|
||||
origin = repo.create_remote("upstream", off_repo)
|
||||
origin.fetch()
|
||||
repo.create_head("main", origin.refs.main)
|
||||
repo.heads.main.set_tracking_branch(origin.refs.main)
|
||||
repo.heads.main.checkout(True)
|
||||
repo.create_head("beta", origin.refs.beta)
|
||||
repo.heads.beta.set_tracking_branch(origin.refs.beta)
|
||||
repo.heads.beta.checkout(True)
|
||||
ac_br = repo.active_branch.name
|
||||
if ac_br != "main":
|
||||
if ac_br != "beta":
|
||||
await eod(
|
||||
pagal,
|
||||
f"**[UPDATER]:**` You are on ({ac_br})\n Please change to main branch.`",
|
||||
f"**[UPDATER]:**` You are on ({ac_br})\n Please change to beta branch.`",
|
||||
)
|
||||
repo.__del__()
|
||||
return
|
||||
|
||||
@@ -353,7 +353,7 @@ async def _(event):
|
||||
xx = await eor(event, "`Processing...`")
|
||||
replied_user, error_i_a = await get_full_user(event)
|
||||
if replied_user is None:
|
||||
await xx.edit("Please repl to a user.\nError - " + str(error_i_a))
|
||||
await xx.edit("Please reply to a user.\nError - " + str(error_i_a))
|
||||
return False
|
||||
replied_user_profile_photos = await event.client(
|
||||
GetUserPhotosRequest(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
py-Ultroid==2021.2.21
|
||||
py-Ultroid==2021.2.24
|
||||
asyncurban
|
||||
carbonnow
|
||||
cairosvg
|
||||
|
||||
BIN
resources/fonts/1.ttf
Normal file
BIN
resources/fonts/1.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/10.ttf
Normal file
BIN
resources/fonts/10.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/3.ttf
Normal file
BIN
resources/fonts/3.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/4.ttf
Normal file
BIN
resources/fonts/4.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/5.ttf
Normal file
BIN
resources/fonts/5.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/6.ttf
Normal file
BIN
resources/fonts/6.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/7.ttf
Normal file
BIN
resources/fonts/7.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/8.ttf
Normal file
BIN
resources/fonts/8.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/9.ttf
Normal file
BIN
resources/fonts/9.ttf
Normal file
Binary file not shown.
Binary file not shown.
@@ -16,9 +16,8 @@ API_ID = int(input("Enter API ID: "))
|
||||
API_HASH = input("Enter API HASH: ")
|
||||
|
||||
with TelegramClient(StringSession(), API_ID, API_HASH) as client:
|
||||
ult = client.send_message("me", client.session.save())
|
||||
ult.reply(
|
||||
"The above is the `SESSION` for your current session.\nVisit @TheUltroid")
|
||||
ult = client.send_message("me",f"`{client.session.save()}`")
|
||||
ult.reply("The above is the `SESSION` for your current session.\nVisit @TheUltroid")
|
||||
print("")
|
||||
print("String Session for the current login has been generated.")
|
||||
print("Check your Telegram Saved messages for your SESSION.")
|
||||
|
||||
@@ -21,15 +21,53 @@ export DEBIAN_FRONTEND=noninteractive
|
||||
export TZ=Asia/Kolkata
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
apt-get install -y --no-install-recommends ffmpeg neofetch mediainfo megatools
|
||||
apt-get autoremove --purge
|
||||
apt update && apt upgrade -y && apt install --no-install-recommends -y \
|
||||
debian-keyring \
|
||||
debian-archive-keyring \
|
||||
bash \
|
||||
curl \
|
||||
git \
|
||||
util-linux \
|
||||
libffi-dev \
|
||||
libjpeg-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libwebp-dev \
|
||||
linux-headers-amd64 \
|
||||
musl-dev \
|
||||
musl \
|
||||
neofetch \
|
||||
python3-lxml \
|
||||
postgresql \
|
||||
postgresql-client \
|
||||
libpq-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
openssl \
|
||||
pv \
|
||||
jq \
|
||||
wget \
|
||||
python3-dev \
|
||||
libreadline-dev \
|
||||
libyaml-dev \
|
||||
zlib1g \
|
||||
ffmpeg \
|
||||
libssl-dev \
|
||||
libgconf-2-4 \
|
||||
libxi6 \
|
||||
zlib1g-dev \
|
||||
xvfb \
|
||||
unzip \
|
||||
make \
|
||||
libopus0 \
|
||||
libopus-dev \
|
||||
gcc
|
||||
|
||||
echo '
|
||||
•• Cloning Repository
|
||||
'
|
||||
git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/
|
||||
|
||||
git clone https://github.com/Teamultroid/Ultroid.git /root/TeamUltroid/
|
||||
|
||||
echo '
|
||||
•• Getting Libraries and Installing
|
||||
|
||||
Reference in New Issue
Block a user