v0.0.9 18/07/2021
Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: sppidy <sppidy@users.noreply.github.com> Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com> Co-authored-by: divkix <divkix@users.noreply.github.com> Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com> Co-authored-by: Programming Error <error@notavailable.live>
This commit is contained in:
142
plugins/_ChatActions.py
Normal file
142
plugins/_ChatActions.py
Normal file
@@ -0,0 +1,142 @@
|
||||
from pyUltroid.functions.all import get_chatbot_reply
|
||||
from pyUltroid.functions.chatBot_db import chatbot_stats
|
||||
from pyUltroid.functions.clean_db import *
|
||||
from pyUltroid.functions.forcesub_db import *
|
||||
from pyUltroid.functions.gban_mute_db import *
|
||||
from pyUltroid.functions.greetings_db import *
|
||||
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
||||
from telethon.tl.functions.channels import GetParticipantRequest
|
||||
from telethon.utils import get_display_name
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_bot.on(events.ChatAction())
|
||||
async def ChatActionsHandler(ult): # sourcery no-metrics
|
||||
# clean chat actions
|
||||
if is_clean_added(ult.chat_id):
|
||||
try:
|
||||
await ult.delete()
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
# thank members
|
||||
if must_thank(ult.chat_id):
|
||||
chat_count = len(await ult.client.get_participants(await ult.get_chat()))
|
||||
if chat_count % 100 == 0:
|
||||
stik_id = chat_count / 100 - 1
|
||||
sticker = stickers[stik_id]
|
||||
await ultroid.send_message(ult.chat_id, file=sticker)
|
||||
# force subscribe
|
||||
if (
|
||||
udB.get("FORCESUB")
|
||||
and ((ult.user_joined or ult.user_added))
|
||||
and get_forcesetting(ult.chat_id)
|
||||
):
|
||||
user = await ult.get_user()
|
||||
if not user.bot:
|
||||
joinchat = get_forcesetting(ult.chat_id)
|
||||
try:
|
||||
await ultroid_bot(GetParticipantRequest(int(joinchat), user.id))
|
||||
except UserNotParticipantError:
|
||||
await ultroid_bot.edit_permissions(
|
||||
ult.chat_id, user.id, send_messages=False
|
||||
)
|
||||
res = await ultroid_bot.inline_query(
|
||||
asst.me.username, f"fsub {user.id}_{joinchat}"
|
||||
)
|
||||
await res[0].click(ult.chat_id, reply_to=ult.action_message.id)
|
||||
|
||||
# gban checks
|
||||
if ult.user_joined and ult.added_by:
|
||||
user = await ult.get_user()
|
||||
chat = await ult.get_chat()
|
||||
if is_gbanned(str(user.id)) and chat.admin_rights:
|
||||
try:
|
||||
await ultroid_bot.edit_permissions(
|
||||
chat.id,
|
||||
user.id,
|
||||
view_messages=False,
|
||||
)
|
||||
reason = get_gban_reason(user.id)
|
||||
gban_watch = f"#GBanned_User Joined.\n\n**User** - [{user.first_name}](tg://user?id={user.id})\n"
|
||||
if reason is not None:
|
||||
gban_watch += f"**Reason**: {reason}\n\n"
|
||||
gban_watch += f"`User Banned.`"
|
||||
await ult.reply(gban_watch)
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
# greetings
|
||||
if get_welcome(ult.chat_id):
|
||||
user = await ult.get_user()
|
||||
chat = await ult.get_chat()
|
||||
title = chat.title or "this chat"
|
||||
pp = await ult.client.get_participants(chat)
|
||||
count = len(pp)
|
||||
mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
|
||||
name = user.first_name
|
||||
last = user.last_name
|
||||
fullname = f"{name} {last}" if last else name
|
||||
uu = user.username
|
||||
username = f"@{uu}" if uu else mention
|
||||
msgg = wel["welcome"]
|
||||
med = wel["media"]
|
||||
userid = user.id
|
||||
if msgg and not is_gbanned(str(user.id)):
|
||||
send = await ult.reply(
|
||||
msgg.format(
|
||||
mention=mention,
|
||||
group=title,
|
||||
count=count,
|
||||
name=name,
|
||||
fullname=fullname,
|
||||
username=username,
|
||||
userid=userid,
|
||||
),
|
||||
file=med,
|
||||
)
|
||||
await asyncio.sleep(150)
|
||||
await send.delete()
|
||||
elif not is_gbanned(str(user.id)):
|
||||
await ult.reply(file=med)
|
||||
if (ult.user_left or ult.user_kicked) and get_goodbye(ult.chat_id):
|
||||
user = await ult.get_user()
|
||||
chat = await ult.get_chat()
|
||||
title = chat.title or "this chat"
|
||||
pp = await ult.client.get_participants(chat)
|
||||
count = len(pp)
|
||||
mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
|
||||
name = user.first_name
|
||||
last = user.last_name
|
||||
fullname = f"{name} {last}" if last else name
|
||||
uu = user.username
|
||||
username = f"@{uu}" if uu else mention
|
||||
msgg = wel["goodbye"]
|
||||
med = wel["media"]
|
||||
userid = user.id
|
||||
if msgg:
|
||||
send = await ult.reply(
|
||||
msgg.format(
|
||||
mention=mention,
|
||||
group=title,
|
||||
count=count,
|
||||
name=name,
|
||||
fullname=fullname,
|
||||
username=username,
|
||||
userid=userid,
|
||||
),
|
||||
file=med,
|
||||
)
|
||||
await asyncio.sleep(150)
|
||||
await send.delete()
|
||||
else:
|
||||
await ult.reply(file=med)
|
||||
|
||||
|
||||
@ultroid_bot.on(events.NewMessage(incoming=True))
|
||||
async def chatBot_replies(event):
|
||||
if event.sender_id and chatbot_stats(event.sender_id) and event.text:
|
||||
msg = get_chatbot_reply(event, event.text)
|
||||
if msg:
|
||||
await event.reply(msg)
|
||||
@@ -5,17 +5,14 @@
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
|
||||
from pyUltroid import *
|
||||
from pyUltroid.dB import *
|
||||
from pyUltroid.dB.core import *
|
||||
from pyUltroid.functions.all import *
|
||||
from pyUltroid.functions.asstcmd_db import *
|
||||
from pyUltroid.functions.broadcast_db import *
|
||||
from pyUltroid.functions.gban_mute_db import *
|
||||
from pyUltroid.functions.nsfw_db import *
|
||||
from pyUltroid.functions.sudos import *
|
||||
from pyUltroid.utils import *
|
||||
from pyUltroid.version import ultroid_version
|
||||
from telethon import Button
|
||||
from telethon.tl import functions, types
|
||||
|
||||
@@ -30,7 +27,7 @@ except ModuleNotFoundError:
|
||||
|
||||
|
||||
start_time = time.time()
|
||||
ultroid_version = "v0.0.8.1"
|
||||
|
||||
OWNER_NAME = ultroid_bot.me.first_name
|
||||
OWNER_ID = ultroid_bot.me.id
|
||||
|
||||
@@ -38,312 +35,13 @@ List = []
|
||||
Dict = {}
|
||||
N = 0
|
||||
|
||||
|
||||
def grt(seconds: int) -> str:
|
||||
count = 0
|
||||
up_time = ""
|
||||
time_list = []
|
||||
time_suffix_list = ["s", "m", "h", "d"]
|
||||
|
||||
while count < 4:
|
||||
count += 1
|
||||
if count < 3:
|
||||
remainder, result = divmod(seconds, 60)
|
||||
else:
|
||||
remainder, result = divmod(seconds, 24)
|
||||
if seconds == 0 and remainder == 0:
|
||||
break
|
||||
time_list.append(int(result))
|
||||
seconds = int(remainder)
|
||||
|
||||
for x in range(len(time_list)):
|
||||
time_list[x] = str(time_list[x]) + time_suffix_list[x]
|
||||
if len(time_list) == 4:
|
||||
up_time += time_list.pop() + ", "
|
||||
|
||||
time_list.reverse()
|
||||
up_time += ":".join(time_list)
|
||||
|
||||
return up_time
|
||||
|
||||
|
||||
_default = [
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
"f",
|
||||
"g",
|
||||
"h",
|
||||
"i",
|
||||
"j",
|
||||
"k",
|
||||
"l",
|
||||
"m",
|
||||
"n",
|
||||
"o",
|
||||
"p",
|
||||
"q",
|
||||
"r",
|
||||
"s",
|
||||
"t",
|
||||
"u",
|
||||
"v",
|
||||
"w",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"I",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"O",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
NOSPAM_CHAT = [
|
||||
-1001387666944, # @PyrogramChat
|
||||
-1001109500936, # @TelethonChat
|
||||
-1001050982793, # @Python
|
||||
-1001256902287, # @DurovsChat
|
||||
]
|
||||
|
||||
|
||||
_small_caps = [
|
||||
"ᴀ",
|
||||
"ʙ",
|
||||
"ᴄ",
|
||||
"ᴅ",
|
||||
"ᴇ",
|
||||
"ғ",
|
||||
"ɢ",
|
||||
"ʜ",
|
||||
"ɪ",
|
||||
"ᴊ",
|
||||
"ᴋ",
|
||||
"ʟ",
|
||||
"ᴍ",
|
||||
"ɴ",
|
||||
"ᴏ",
|
||||
"ᴘ",
|
||||
"ϙ",
|
||||
"ʀ",
|
||||
"s",
|
||||
"ᴛ",
|
||||
"ᴜ",
|
||||
"ᴠ",
|
||||
"ᴡ",
|
||||
"x",
|
||||
"ʏ",
|
||||
"ᴢ",
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"I",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"O",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
]
|
||||
|
||||
_monospace = [
|
||||
"𝚊",
|
||||
"𝚋",
|
||||
"𝚌",
|
||||
"𝚍",
|
||||
"𝚎",
|
||||
"𝚏",
|
||||
"𝚐",
|
||||
"𝚑",
|
||||
"𝚒",
|
||||
"𝚓",
|
||||
"𝚔",
|
||||
"𝚕",
|
||||
"𝚖",
|
||||
"𝚗",
|
||||
"𝚘",
|
||||
"𝚙",
|
||||
"𝚚",
|
||||
"𝚛",
|
||||
"𝚜",
|
||||
"𝚝",
|
||||
"𝚞",
|
||||
"𝚟",
|
||||
"𝚠",
|
||||
"𝚡",
|
||||
"𝚢",
|
||||
"𝚣",
|
||||
"𝙰",
|
||||
"𝙱",
|
||||
"𝙲",
|
||||
"𝙳",
|
||||
"𝙴",
|
||||
"𝙵",
|
||||
"𝙶",
|
||||
"𝙷",
|
||||
"𝙸",
|
||||
"𝙹",
|
||||
"𝙺",
|
||||
"𝙻",
|
||||
"𝙼",
|
||||
"𝙽",
|
||||
"𝙾",
|
||||
"𝙿",
|
||||
"𝚀",
|
||||
"𝚁",
|
||||
"𝚂",
|
||||
"𝚃",
|
||||
"𝚄",
|
||||
"𝚅",
|
||||
"𝚆",
|
||||
"𝚇",
|
||||
"𝚈",
|
||||
"𝚉",
|
||||
]
|
||||
|
||||
_double_stroke = [
|
||||
"𝕒",
|
||||
"𝕓",
|
||||
"𝕔",
|
||||
"𝕕",
|
||||
"𝕖",
|
||||
"𝕗",
|
||||
"𝕘",
|
||||
"𝕙",
|
||||
"𝕚",
|
||||
"𝕛",
|
||||
"𝕜",
|
||||
"𝕝",
|
||||
"𝕞",
|
||||
"𝕟",
|
||||
"𝕠",
|
||||
"𝕡",
|
||||
"𝕢",
|
||||
"𝕣",
|
||||
"𝕤",
|
||||
"𝕥",
|
||||
"𝕦",
|
||||
"𝕧",
|
||||
"𝕨",
|
||||
"𝕩",
|
||||
"𝕪",
|
||||
"𝕫",
|
||||
"𝔸",
|
||||
"𝔹",
|
||||
"ℂ",
|
||||
"𝔻",
|
||||
"𝔼",
|
||||
"𝔽",
|
||||
"𝔾",
|
||||
"ℍ",
|
||||
"𝕀",
|
||||
"𝕁",
|
||||
"𝕂",
|
||||
"𝕃",
|
||||
"𝕄",
|
||||
"ℕ",
|
||||
"𝕆",
|
||||
"ℙ",
|
||||
"ℚ",
|
||||
"ℝ",
|
||||
"𝕊",
|
||||
"𝕋",
|
||||
"𝕌",
|
||||
"𝕍",
|
||||
"𝕎",
|
||||
"𝕏",
|
||||
"𝕐",
|
||||
"ℤ",
|
||||
]
|
||||
|
||||
_script_royal = [
|
||||
"𝒶",
|
||||
"𝒷",
|
||||
"𝒸",
|
||||
"𝒹",
|
||||
"𝑒",
|
||||
"𝒻",
|
||||
"𝑔",
|
||||
"𝒽",
|
||||
"𝒾",
|
||||
"𝒿",
|
||||
"𝓀",
|
||||
"𝓁",
|
||||
"𝓂",
|
||||
"𝓃",
|
||||
"𝑜",
|
||||
"𝓅",
|
||||
"𝓆",
|
||||
"𝓇",
|
||||
"𝓈",
|
||||
"𝓉",
|
||||
"𝓊",
|
||||
"𝓋",
|
||||
"𝓌",
|
||||
"𝓍",
|
||||
"𝓎",
|
||||
"𝓏",
|
||||
"𝒜",
|
||||
"ℬ",
|
||||
"𝒞",
|
||||
"𝒟",
|
||||
"ℰ",
|
||||
"ℱ",
|
||||
"𝒢",
|
||||
"ℋ",
|
||||
"ℐ",
|
||||
"𝒥",
|
||||
"𝒦",
|
||||
"ℒ",
|
||||
"ℳ",
|
||||
"𝒩",
|
||||
"𝒪",
|
||||
"𝒫",
|
||||
"𝒬",
|
||||
"ℛ",
|
||||
"𝒮",
|
||||
"𝒯",
|
||||
"𝒰",
|
||||
"𝒱",
|
||||
"𝒲",
|
||||
"𝒳",
|
||||
"𝒴",
|
||||
"𝒵",
|
||||
]
|
||||
|
||||
|
||||
KANGING_STR = [
|
||||
"Using Witchery to kang this sticker...",
|
||||
"Plagiarising hehe...",
|
||||
|
||||
@@ -5,21 +5,17 @@
|
||||
# PLease read the GNU Affero General Public License in
|
||||
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
||||
|
||||
from support import *
|
||||
from pyUltroid.dB.core import *
|
||||
from telethon.errors.rpcerrorlist import BotInlineDisabledError as dis
|
||||
from telethon.errors.rpcerrorlist import BotMethodInvalidError
|
||||
from telethon.errors.rpcerrorlist import BotResponseTimeoutError as rep
|
||||
from telethon.tl.custom import Button
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="help ?(.*)",
|
||||
)
|
||||
async def ult(ult):
|
||||
@ultroid_cmd(pattern="help ?(.*)")
|
||||
async def _help(ult):
|
||||
plug = ult.pattern_match.group(1)
|
||||
tgbot = asst.me.username
|
||||
if plug:
|
||||
try:
|
||||
if plug in HELP:
|
||||
@@ -45,16 +41,16 @@ async def ult(ult):
|
||||
except BaseException:
|
||||
await eor(ult, "Error 🤔 occured.")
|
||||
else:
|
||||
tgbot = asst.me.username
|
||||
try:
|
||||
results = await ultroid_bot.inline_query(tgbot, "ultd")
|
||||
results = await ult.client.inline_query(tgbot, "ultd")
|
||||
except BotMethodInvalidError:
|
||||
z = []
|
||||
for x in LIST.values():
|
||||
for y in x:
|
||||
z.append(y)
|
||||
cmd = len(z) + 10
|
||||
bnn = asst.me.username
|
||||
return await ultroid_bot.send_message(
|
||||
return await ult.client.send_message(
|
||||
ult.chat_id,
|
||||
get_string("inline_4").format(
|
||||
OWNER_NAME,
|
||||
@@ -71,7 +67,11 @@ async def ult(ult):
|
||||
Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
|
||||
Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
|
||||
],
|
||||
[Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{bnn}?start=set")],
|
||||
[
|
||||
Button.url(
|
||||
"⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{tgbot}?start=set"
|
||||
),
|
||||
],
|
||||
[Button.inline("••Cʟᴏꜱᴇ••", data="close")],
|
||||
],
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@ from math import ceil
|
||||
from os import remove
|
||||
|
||||
from git import Repo
|
||||
from pyUltroid.dB.core import *
|
||||
from pyUltroid.misc import owner_and_sudos
|
||||
from support import *
|
||||
from telethon.tl.types import InputBotInlineResult, InputWebDocument
|
||||
@@ -74,7 +75,7 @@ async def inline_alive(o):
|
||||
if len(o.text) == 0:
|
||||
b = o.builder
|
||||
MSG = "• **Ultroid Userbot •**"
|
||||
uptime = grt(time.time() - start_time)
|
||||
uptime = time_formatter((time.time() - start_time) * 1000)
|
||||
MSG += f"\n\n• **Uptime** - `{uptime}`\n"
|
||||
MSG += f"• **OWNER** - `{OWNER_NAME}`"
|
||||
WEB0 = InputWebDocument(
|
||||
@@ -120,35 +121,17 @@ async def inline_handler(event):
|
||||
await event.answer([result], gallery=True)
|
||||
|
||||
|
||||
@in_pattern("paste")
|
||||
@in_pattern("haste")
|
||||
@in_owner
|
||||
async def _(event):
|
||||
ok = event.text.split(" ")[1]
|
||||
link = "https://nekobin.com/"
|
||||
link = "https://hastebin.com/"
|
||||
result = event.builder.article(
|
||||
title="Paste",
|
||||
text="Pᴀsᴛᴇᴅ Tᴏ Nᴇᴋᴏʙɪɴ!",
|
||||
text="Pᴀsᴛᴇᴅ Tᴏ Hᴀsᴛᴇʙɪɴ!",
|
||||
buttons=[
|
||||
[
|
||||
Button.url("NekoBin", url=f"{link}{ok}"),
|
||||
Button.url("Raw", url=f"{link}raw/{ok}"),
|
||||
],
|
||||
],
|
||||
)
|
||||
await event.answer([result])
|
||||
|
||||
|
||||
@in_pattern("dog")
|
||||
@in_owner
|
||||
async def _(event):
|
||||
ok = event.text.split(" ")[1]
|
||||
link = "https://del.dog/"
|
||||
result = event.builder.article(
|
||||
title="Paste",
|
||||
text="Pᴀsᴛᴇᴅ Tᴏ Dᴏɢʙɪɴ!",
|
||||
buttons=[
|
||||
[
|
||||
Button.url("DogBin", url=f"{link}{ok}"),
|
||||
Button.url("HasteBin", url=f"{link}{ok}"),
|
||||
Button.url("Raw", url=f"{link}raw/{ok}"),
|
||||
],
|
||||
],
|
||||
@@ -236,7 +219,7 @@ async def _(event):
|
||||
|
||||
@callback("upp")
|
||||
async def _(event):
|
||||
uptime = grt(time.time() - start_time)
|
||||
uptime = time_formatter((time.time() - start_time) * 1000)
|
||||
pin = f"🙋Uᴘᴛɪᴍᴇ = {uptime}"
|
||||
await event.answer(pin, cache_time=0, alert=True)
|
||||
|
||||
|
||||
@@ -4,27 +4,25 @@
|
||||
# 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 telethon.errors import ChatSendInlineForbiddenError
|
||||
from telethon.errors.rpcerrorlist import BotMethodInvalidError as bmi
|
||||
|
||||
from . import *
|
||||
|
||||
REPOMSG = (
|
||||
"• **ULTROID USERBOT** •\n\n",
|
||||
"• Repo - [Click Here](https://github.com/TeamUltroid/Ultroid)\n",
|
||||
"• Addons - [Click Here](https://github.com/TeamUltroid/UltroidAddons)\n",
|
||||
"• Support - @UltroidSupport",
|
||||
)
|
||||
REPOMSG = """
|
||||
• **ULTROID USERBOT** •\n
|
||||
• Repo - [Click Here](https://github.com/TeamUltroid/Ultroid)
|
||||
• Addons - [Click Here](https://github.com/TeamUltroid/UltroidAddons)
|
||||
• Support - @UltroidSupport
|
||||
"""
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="repo$")
|
||||
@ultroid_cmd(pattern="repo$", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def repify(e):
|
||||
try:
|
||||
q = await ultroid_bot.inline_query(asst.me.username, "repo")
|
||||
q = await e.client.inline_query(asst.me.username, "repo")
|
||||
await q[0].click(e.chat_id)
|
||||
if e.sender_id == ultroid_bot.uid:
|
||||
if e.out:
|
||||
await e.delete()
|
||||
except (ChatSendInlineForbiddenError, bmi):
|
||||
await eor(e, REPOMSG)
|
||||
|
||||
@@ -26,70 +26,69 @@ from . import *
|
||||
),
|
||||
)
|
||||
async def all_messages_catcher(e):
|
||||
if udB.get("TAG_LOG"):
|
||||
try:
|
||||
NEEDTOLOG = int(udB.get("TAG_LOG"))
|
||||
except Exception:
|
||||
return LOGS.info("you given Wrong Grp/Channel ID in TAG_LOG.")
|
||||
x = e.sender
|
||||
if x.bot or x.verified:
|
||||
return
|
||||
y = e.chat
|
||||
where_n = get_display_name(y)
|
||||
who_n = get_display_name(x)
|
||||
where_l = f"https://t.me/c/{y.id}/{e.id}"
|
||||
send = await ultroid_bot.get_messages(e.chat_id, ids=e.id)
|
||||
try:
|
||||
if x.username:
|
||||
who_l = f"https://t.me/{x.username}"
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
send,
|
||||
buttons=[
|
||||
[Button.url(who_n, who_l)],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
else:
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
send,
|
||||
buttons=[
|
||||
[Button.inline(who_n, data=f"who{x.id}")],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
except MediaEmptyError:
|
||||
if x.username:
|
||||
who_l = f"https://t.me/{x.username}"
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
"`Unsupported Media`",
|
||||
buttons=[
|
||||
[Button.url(who_n, who_l)],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
else:
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
"`Unsupported Media`",
|
||||
buttons=[
|
||||
[Button.inline(who_n, data=f"who{x.id}")],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
except PeerIdInvalidError:
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
"The Chat Id You Set In Tag Logger Is Wrong , Please Correct It",
|
||||
)
|
||||
except ChatWriteForbiddenError:
|
||||
await ultroid_bot.send_message(NEEDTOLOG, "Please Give Your Assistant Bot")
|
||||
except Exception as er:
|
||||
LOGS.info(str(er))
|
||||
else:
|
||||
if not udB.get("TAG_LOG"):
|
||||
return
|
||||
try:
|
||||
NEEDTOLOG = int(udB.get("TAG_LOG"))
|
||||
except Exception:
|
||||
return LOGS.info("you given Wrong Grp/Channel ID in TAG_LOG.")
|
||||
x = e.sender
|
||||
if x.bot or x.verified:
|
||||
return
|
||||
y = e.chat
|
||||
where_n = get_display_name(y)
|
||||
who_n = get_display_name(x)
|
||||
where_l = f"https://t.me/c/{y.id}/{e.id}"
|
||||
send = await ultroid_bot.get_messages(e.chat_id, ids=e.id)
|
||||
try:
|
||||
if x.username:
|
||||
who_l = f"https://t.me/{x.username}"
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
send,
|
||||
buttons=[
|
||||
[Button.url(who_n, who_l)],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
else:
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
send,
|
||||
buttons=[
|
||||
[Button.inline(who_n, data=f"who{x.id}")],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
except MediaEmptyError:
|
||||
if x.username:
|
||||
who_l = f"https://t.me/{x.username}"
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
"`Unsupported Media`",
|
||||
buttons=[
|
||||
[Button.url(who_n, who_l)],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
else:
|
||||
await asst.send_message(
|
||||
NEEDTOLOG,
|
||||
"`Unsupported Media`",
|
||||
buttons=[
|
||||
[Button.inline(who_n, data=f"who{x.id}")],
|
||||
[Button.url(where_n, where_l)],
|
||||
],
|
||||
)
|
||||
except PeerIdInvalidError:
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
"The Chat Id You Set In Tag Logger Is Wrong , Please Correct It",
|
||||
)
|
||||
except ChatWriteForbiddenError:
|
||||
await ultroid_bot.send_message(NEEDTOLOG, "Please Give Your Assistant Bot")
|
||||
except Exception as er:
|
||||
LOGS.info(str(er))
|
||||
|
||||
|
||||
@callback(re.compile("who(.*)"))
|
||||
@@ -105,21 +104,22 @@ async def _(e):
|
||||
# log for assistant
|
||||
@asst.on(events.ChatAction)
|
||||
async def when_asst_added_to_chat(event):
|
||||
if event.user_added:
|
||||
user = await event.get_user()
|
||||
chat = await event.get_chat()
|
||||
if chat.username:
|
||||
chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
|
||||
else:
|
||||
chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
|
||||
if not event.user_added:
|
||||
return
|
||||
user = await event.get_user()
|
||||
chat = await event.get_chat()
|
||||
if chat.username:
|
||||
chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
|
||||
else:
|
||||
chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
|
||||
if user.is_self:
|
||||
tmp = event.added_by
|
||||
if user.is_self:
|
||||
buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot")
|
||||
return await asst.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
|
||||
buttons=buttons,
|
||||
)
|
||||
buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|bot")
|
||||
return await asst.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
|
||||
buttons=buttons,
|
||||
)
|
||||
|
||||
|
||||
# log for user's new joins
|
||||
@@ -130,22 +130,22 @@ async def when_ultd_added_to_chat(event):
|
||||
if event.user_added:
|
||||
user = await event.get_user()
|
||||
chat = await event.get_chat()
|
||||
if chat.username:
|
||||
if hasattr(chat, "username") and chat.username:
|
||||
chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
|
||||
else:
|
||||
chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
|
||||
tmp = event.added_by
|
||||
if user.is_self:
|
||||
tmp = event.added_by
|
||||
buttons = Button.inline("Leave Chat", data=f"leave_ch_{event.chat_id}|user")
|
||||
return await asst.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"#ADD_LOG\n\n[{tmp.first_name}](tg://user?id={tmp.id}) just added [{user.first_name}](tg://user?id={user.id}) to {chat}.",
|
||||
f"#ADD_LOG\n\n{inline_mention(tmp)} just added {inline_mention(user)} to {chat}.",
|
||||
buttons=buttons,
|
||||
)
|
||||
elif event.user_joined:
|
||||
user = await event.get_user()
|
||||
chat = await event.get_chat()
|
||||
if chat.username:
|
||||
if hasattr(chat, "username") and chat.username:
|
||||
chat = f"[{chat.title}](https://t.me/{chat.username}/{event.action_message.id})"
|
||||
else:
|
||||
chat = f"[{chat.title}](https://t.me/c/{chat.id}/{event.action_message.id})"
|
||||
|
||||
@@ -41,7 +41,7 @@ async def _(e):
|
||||
put = e.pattern_match.group(1)
|
||||
if put:
|
||||
try:
|
||||
results = await ultroid_bot.inline_query(asst.me.username, f"msg {put}")
|
||||
results = await e.client.inline_query(asst.me.username, f"msg {put}")
|
||||
except rep:
|
||||
return await eor(
|
||||
e,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -44,7 +43,6 @@
|
||||
• `{i}purgeall`
|
||||
Delete all msgs of replied user.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
|
||||
from telethon.errors import BadRequestError
|
||||
@@ -52,15 +50,16 @@ from telethon.errors.rpcerrorlist import ChatNotModifiedError, UserIdInvalidErro
|
||||
from telethon.tl.functions.channels import DeleteUserHistoryRequest, EditAdminRequest
|
||||
from telethon.tl.functions.channels import ExportMessageLinkRequest as ExpLink
|
||||
from telethon.tl.functions.messages import SetHistoryTTLRequest
|
||||
from telethon.tl.types import ChatAdminRights, InputMessagesFilterPinned
|
||||
from telethon.tl.types import Chat, ChatAdminRights, InputMessagesFilterPinned
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="promote ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def prmte(ult):
|
||||
xx = await eor(ult, get_string("com_1"))
|
||||
@@ -71,7 +70,7 @@ async def prmte(ult):
|
||||
if not user:
|
||||
return await xx.edit("`Reply to a user to promote him!`")
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await ult.client(
|
||||
EditAdminRequest(
|
||||
ult.chat_id,
|
||||
user.id,
|
||||
@@ -87,7 +86,7 @@ async def prmte(ult):
|
||||
),
|
||||
)
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) `is now an admin in {ult.chat.title} with title {rank}.`",
|
||||
f"{inline_mention(user)} `is now an admin in {ult.chat.title} with title {rank}.`",
|
||||
)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`I don't have the right to promote you.`")
|
||||
@@ -97,8 +96,9 @@ async def prmte(ult):
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="demote ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def dmote(ult):
|
||||
xx = await eor(ult, get_string("com_1"))
|
||||
@@ -109,7 +109,7 @@ async def dmote(ult):
|
||||
if not user:
|
||||
return await xx.edit("`Reply to a user to demote him!`")
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await ult.client(
|
||||
EditAdminRequest(
|
||||
ult.chat_id,
|
||||
user.id,
|
||||
@@ -125,7 +125,7 @@ async def dmote(ult):
|
||||
),
|
||||
)
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) `is no longer an admin in {ult.chat.title}`",
|
||||
f"{inline_mention(user)} `is no longer an admin in {ult.chat.title}`",
|
||||
)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`I don't have the right to demote you.`")
|
||||
@@ -135,72 +135,71 @@ async def dmote(ult):
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="ban ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def bban(ult):
|
||||
xx = await eor(ult, get_string("com_1"))
|
||||
await ult.get_chat()
|
||||
user, reason = await get_user_info(ult)
|
||||
if not user:
|
||||
return await xx.edit("`Reply to a user or give username to ban him!`")
|
||||
if str(user.id) in DEVLIST:
|
||||
return await xx.edit(" `LoL, I can't Ban my Developer 😂`")
|
||||
try:
|
||||
await ultroid_bot.edit_permissions(ult.chat_id, user.id, view_messages=False)
|
||||
await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=False)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`I don't have the right to ban a user.`")
|
||||
except UserIdInvalidError:
|
||||
await xx.edit("`I couldn't get who he is!`")
|
||||
return await xx.edit("`I couldn't get who he is!`")
|
||||
try:
|
||||
reply = await ult.get_reply_message()
|
||||
if reply:
|
||||
await reply.delete()
|
||||
except BadRequestError:
|
||||
return await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) **was banned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`\n**Reason**: `{reason}`\n**Messages Deleted**: `False`",
|
||||
f"{inline_mention(user)}**was banned by** {inline_mention(ult.sender)} **in** `{ult.chat.title}`\n**Reason**: `{reason}`\n**Messages Deleted**: `False`",
|
||||
)
|
||||
userme = inline_mention(user)
|
||||
senderme = inline_mention(ult.sender)
|
||||
if reason:
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) **was banned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`\n**Reason**: `{reason}`",
|
||||
f"{userme} **was banned by** {senderme}**in** `{ult.chat.title}`\n**Reason**: `{reason}`",
|
||||
)
|
||||
else:
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) **was banned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`",
|
||||
f"{userme} **was banned by** {senderme} **in** `{ult.chat.title}`",
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="unban ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def uunban(ult):
|
||||
xx = await eor(ult, get_string("com_1"))
|
||||
await ult.get_chat()
|
||||
user, reason = await get_user_info(ult)
|
||||
if not user:
|
||||
return await xx.edit("`Reply to a user or give username to unban him!`")
|
||||
try:
|
||||
await ultroid_bot.edit_permissions(ult.chat_id, user.id, view_messages=True)
|
||||
await ult.client.edit_permissions(ult.chat_id, user.id, view_messages=True)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`I don't have the right to unban a user.`")
|
||||
except UserIdInvalidError:
|
||||
await xx.edit("`I couldn't get who he is!`")
|
||||
text = f"{inline_mention(user)} **was unbanned by** {inline_mention(ult.sender)} **in** `{ult.chat.title}`"
|
||||
if reason:
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) **was unbanned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`\n**Reason**: `{reason}`",
|
||||
)
|
||||
else:
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id}) **was unbanned by** [{OWNER_NAME}](tg://user?id={OWNER_ID}) **in** `{ult.chat.title}`",
|
||||
)
|
||||
text += f"\n**Reason**: `{reason}`"
|
||||
await xx.edit(text)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="kick ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def kck(ult):
|
||||
if ult.text == f"{HNDLR}kickme":
|
||||
@@ -212,10 +211,10 @@ async def kck(ult):
|
||||
return await xx.edit("`Kick? Whom? I couldn't get his info...`")
|
||||
if str(user.id) in DEVLIST:
|
||||
return await xx.edit(" `Lol, I can't Kick my Developer`😂")
|
||||
if user.id == ultroid_bot.uid:
|
||||
return await xx.edit("`You Can't kick urself`")
|
||||
if user.id in [ultroid_bot.uid, asst.me.id]:
|
||||
return await xx.edit("`You Can't kick that powerhouse`")
|
||||
try:
|
||||
await ultroid_bot.kick_participant(ult.chat_id, user.id)
|
||||
await ult.client.kick_participant(ult.chat_id, user.id)
|
||||
await asyncio.sleep(0.5)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`I don't have the right to kick a user.`")
|
||||
@@ -223,21 +222,14 @@ async def kck(ult):
|
||||
return await xx.edit(
|
||||
f"`I don't have the right to kick a user.`\n\n**ERROR**:\n`{str(e)}`",
|
||||
)
|
||||
text = f"{inline_mention(user)} **was kicked by** {inline_mention(ult.sender)} **in** `{ult.chat.title}`"
|
||||
if reason:
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id})` was kicked by` [{OWNER_NAME}](tg://user?id={OWNER_ID}) `in {ult.chat.title}`\n**Reason**: `{reason}`",
|
||||
)
|
||||
else:
|
||||
await xx.edit(
|
||||
f"[{user.first_name}](tg://user?id={user.id})` was kicked by` [{OWNER_NAME}](tg://user?id={OWNER_ID}) `in {ult.chat.title}`",
|
||||
)
|
||||
text += f"\n**Reason**: `{reason}`"
|
||||
await xx.edit(text)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="pin ?(.*)",
|
||||
)
|
||||
@ultroid_cmd(pattern="pin ?(.*)", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def pin(msg):
|
||||
mss = "`Pinned.`"
|
||||
xx = msg.reply_to_msg_id
|
||||
tt = msg.text
|
||||
try:
|
||||
@@ -247,35 +239,27 @@ async def pin(msg):
|
||||
except BaseException:
|
||||
pass
|
||||
if not msg.is_reply:
|
||||
return
|
||||
if not msg.is_private:
|
||||
link = (await ultroid_bot(ExpLink(msg.chat_id, xx))).link
|
||||
mss = f"`Pinned` [This Message]({link})"
|
||||
return await eor(msg, "Reply a Message to Pin !")
|
||||
if not msg.client._bot and not msg.is_private and not isinstance(msg.chat, Chat):
|
||||
link = (await msg.client(ExpLink(msg.chat_id, xx))).link
|
||||
f"`Pinned` [This Message]({link})"
|
||||
ch = msg.pattern_match.group(1)
|
||||
if ch != "silent":
|
||||
slnt = True
|
||||
try:
|
||||
await ultroid_bot.pin_message(msg.chat_id, xx, notify=slnt)
|
||||
except BadRequestError:
|
||||
return await eor(msg, "`Hmm.. Guess I have no rights here!`")
|
||||
except Exception as e:
|
||||
return await eor(msg, f"**ERROR:**`{str(e)}`")
|
||||
await eor(msg, mss)
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
await ultroid_bot.pin_message(msg.chat_id, xx, notify=False)
|
||||
except BadRequestError:
|
||||
return await eor(msg, "`Hmm.. Guess I have no rights here!`")
|
||||
except Exception as e:
|
||||
return await eor(msg, f"**ERROR:**`{str(e)}`")
|
||||
try:
|
||||
await msg.delete()
|
||||
except BaseException:
|
||||
pass
|
||||
pass
|
||||
try:
|
||||
await msg.client.pin_message(msg.chat_id, xx, notify=False)
|
||||
except BadRequestError:
|
||||
return await eor(msg, "`Hmm.. Guess I have no rights here!`")
|
||||
except Exception as e:
|
||||
return await eor(msg, f"**ERROR:**`{str(e)}`")
|
||||
if msg.out:
|
||||
await msg.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="unpin($| (.*))",
|
||||
pattern="unpin($| (.*))", type=["official", "manager"], ignore_dualmode=True
|
||||
)
|
||||
async def unp(ult):
|
||||
xx = await eor(ult, get_string("com_1"))
|
||||
@@ -286,14 +270,14 @@ async def unp(ult):
|
||||
msg = ult.reply_to_msg_id
|
||||
if msg and not ch:
|
||||
try:
|
||||
await ultroid_bot.unpin_message(ult.chat_id, msg)
|
||||
await ult.client.unpin_message(ult.chat_id, msg)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`Hmm.. Guess I have no rights here!`")
|
||||
except Exception as e:
|
||||
return await xx.edit(f"**ERROR:**\n`{str(e)}`")
|
||||
elif ch == "all":
|
||||
try:
|
||||
await ultroid_bot.unpin_message(ult.chat_id)
|
||||
await ult.client.unpin_message(ult.chat_id)
|
||||
except BadRequestError:
|
||||
return await xx.edit("`Hmm.. Guess I have no rights here!`")
|
||||
except Exception as e:
|
||||
@@ -305,9 +289,7 @@ async def unp(ult):
|
||||
await xx.edit("`Unpinned!`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="purge ?(.*)",
|
||||
)
|
||||
@ultroid_cmd(pattern="purge ?(.*)", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def fastpurger(purg):
|
||||
chat = await purg.get_input_chat()
|
||||
match = purg.pattern_match.group(1)
|
||||
@@ -317,9 +299,13 @@ async def fastpurger(purg):
|
||||
ABC = None
|
||||
if ABC and purg.text[6] in ["m", "a"]:
|
||||
return
|
||||
if purg.client._bot:
|
||||
return await purg.client.delete_messages(
|
||||
purg.chat_id, [a for a in range(purg.reply_to_msg_id, purg.id)]
|
||||
)
|
||||
if match and not purg.is_reply:
|
||||
p = 0
|
||||
async for msg in ultroid_bot.iter_messages(purg.chat_id, limit=int(match)):
|
||||
async for msg in purg.client.iter_messages(purg.chat_id, limit=int(match)):
|
||||
await msg.delete()
|
||||
p += 0
|
||||
return await eod(purg, f"Purged {p} Messages! ")
|
||||
@@ -327,26 +313,20 @@ async def fastpurger(purg):
|
||||
count = 0
|
||||
if not (purg.reply_to_msg_id or match):
|
||||
return await eod(purg, "`Reply to a message to purge from.`", time=10)
|
||||
async for msg in ultroid_bot.iter_messages(chat, min_id=purg.reply_to_msg_id):
|
||||
async for msg in purg.client.iter_messages(chat, 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)
|
||||
await purg.client.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(len(msgs))
|
||||
+ "` **of** `"
|
||||
+ str(count)
|
||||
+ "` **messages.**",
|
||||
await purg.client.delete_messages(chat, msgs)
|
||||
await eod(
|
||||
purg,
|
||||
"__Fast purge complete!__\n**Purged** `" + str(count) + "` **messages.**",
|
||||
)
|
||||
await asyncio.sleep(5)
|
||||
await done.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -361,7 +341,7 @@ async def fastpurgerme(purg):
|
||||
await eod(purg, "`Give a Valid Input.. `")
|
||||
return
|
||||
mp = 0
|
||||
async for mm in ultroid_bot.iter_messages(
|
||||
async for mm in purg.client.iter_messages(
|
||||
purg.chat_id, limit=nnt, from_user="me"
|
||||
):
|
||||
await mm.delete()
|
||||
@@ -377,7 +357,7 @@ async def fastpurgerme(purg):
|
||||
"`Reply to a message to purge from or use it like ``purgeme <num>`",
|
||||
time=10,
|
||||
)
|
||||
async for msg in ultroid_bot.iter_messages(
|
||||
async for msg in purg.client.iter_messages(
|
||||
chat,
|
||||
from_user="me",
|
||||
min_id=purg.reply_to_msg_id,
|
||||
@@ -390,13 +370,11 @@ async def fastpurgerme(purg):
|
||||
msgs = []
|
||||
|
||||
if msgs:
|
||||
await ultroid_bot.delete_messages(chat, msgs)
|
||||
done = await ultroid_bot.send_message(
|
||||
purg.chat_id,
|
||||
await purg.client.delete_messages(chat, msgs)
|
||||
await eod(
|
||||
purg,
|
||||
"__Fast purge complete!__\n**Purged** `" + str(count) + "` **messages.**",
|
||||
)
|
||||
await asyncio.sleep(5)
|
||||
await done.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -405,54 +383,37 @@ async def fastpurgerme(purg):
|
||||
async def _(e):
|
||||
xx = await eor(e, get_string("com_1"))
|
||||
if e.reply_to_msg_id:
|
||||
input = (await e.get_reply_message()).sender_id
|
||||
name = (await e.client.get_entity(input)).first_name
|
||||
name = (await e.get_reply_message()).sender
|
||||
try:
|
||||
await ultroid_bot(DeleteUserHistoryRequest(e.chat_id, input))
|
||||
await eod(e, f"Successfully Purged All Messages from {name}")
|
||||
await e.client(DeleteUserHistoryRequest(e.chat_id, name.id))
|
||||
await eod(e, f"Successfully Purged All Messages from {name.first_name}")
|
||||
except Exception as er:
|
||||
return await eod(xx, str(er), time=5)
|
||||
return await eod(xx, str(er))
|
||||
else:
|
||||
return await eod(
|
||||
xx,
|
||||
"`Reply to someone's msg to delete.`",
|
||||
time=5,
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="pinned")
|
||||
async def get_pinned(event):
|
||||
x = await eor(event, get_string("com_1"))
|
||||
chat_id = (str(event.chat_id)).replace("-100", "")
|
||||
chat_name = "This Chat"
|
||||
if not event.is_private:
|
||||
chat_name = (await event.get_chat()).title
|
||||
tem = ""
|
||||
c = 0
|
||||
|
||||
async for i in ultroid.iter_messages(
|
||||
event.chat_id, filter=InputMessagesFilterPinned
|
||||
):
|
||||
c += 1
|
||||
tem += f"The pinned message in {chat_name} can be found <a href=https://t.me/c/{chat_id}/{i.id}>here.</a>"
|
||||
if c == 1:
|
||||
return await x.edit(tem, parse_mode="html")
|
||||
|
||||
if tem == "":
|
||||
return await eod(x, "There is no pinned message in chat!", time=5)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listpinned")
|
||||
@ultroid_cmd(
|
||||
pattern="listpinned$",
|
||||
)
|
||||
async def get_all_pinned(event):
|
||||
x = await eor(event, get_string("com_1"))
|
||||
chat_id = (str(event.chat_id)).replace("-100", "")
|
||||
chat_name = (await event.get_chat()).title
|
||||
a = ""
|
||||
c = 1
|
||||
async for i in ultroid.iter_messages(
|
||||
async for i in event.client.iter_messages(
|
||||
event.chat_id, filter=InputMessagesFilterPinned
|
||||
):
|
||||
a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>Go to message.</a>\n"
|
||||
if i.message:
|
||||
t = " ".join(i.message.split()[0:4])
|
||||
txt = "{}....".format(t)
|
||||
else:
|
||||
txt = "Go to message."
|
||||
a += f"{c}. <a href=https://t.me/c/{chat_id}/{i.id}>{txt}</a>\n"
|
||||
c += 1
|
||||
|
||||
if c == 1:
|
||||
@@ -461,12 +422,15 @@ async def get_all_pinned(event):
|
||||
m = f"<b>List of pinned message(s) in {chat_name}:</b>\n\n"
|
||||
|
||||
if a == "":
|
||||
return await eod(x, "There is no message pinned in this group!", time=5)
|
||||
return await eod(x, "There is no message pinned in this group!")
|
||||
|
||||
await x.edit(m + a, parse_mode="html")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="autodelete ?(.*)", groups_only=True, admins_only=True)
|
||||
@ultroid_cmd(
|
||||
pattern="autodelete ?(.*)",
|
||||
admins_only=True,
|
||||
)
|
||||
async def autodelte(ult): # Tg Feature
|
||||
match = ult.pattern_match.group(1)
|
||||
if not match or match not in ["24h", "7d", "off"]:
|
||||
@@ -478,7 +442,7 @@ async def autodelte(ult): # Tg Feature
|
||||
else:
|
||||
tt = 0
|
||||
try:
|
||||
await ultroid_bot(SetHistoryTTLRequest(ult.chat_id, period=tt))
|
||||
await ult.client(SetHistoryTTLRequest(ult.chat_id, period=tt))
|
||||
except ChatNotModifiedError:
|
||||
return await eod(ult, f"Auto Delete Setting is Already same to `{match}`")
|
||||
await eor(ult, f"Auto Delete Status Changed to {match} !")
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
• `{i}afk <optional reason>`
|
||||
AFK means away from keyboard,
|
||||
|
||||
After u active this if Someone tag or msg u then It auto Reply Him/her,
|
||||
(Note : By Reply To any media U can set media afk too).
|
||||
|
||||
@@ -160,9 +161,11 @@ async def on_afk(event):
|
||||
|
||||
@ultroid_cmd(pattern=r"afk ?(.*)")
|
||||
async def _(event):
|
||||
if not is_fullsudo(event.sender_id):
|
||||
return await eor(event, "`This Command Is Sudo Restricted.`")
|
||||
if not event.out and not is_fullsudo(event.sender_id):
|
||||
return await eor(event, "`This Command Is Full Sudo Restricted.`")
|
||||
reply = await event.get_reply_message()
|
||||
if event.client._bot:
|
||||
return await eor(event, "Master, I am a Bot, I cant go AFK..")
|
||||
global USER_AFK
|
||||
global afk_time
|
||||
global last_afk_message
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -17,10 +16,10 @@
|
||||
• `{i}character <character name>`
|
||||
Fetch anime character details.
|
||||
"""
|
||||
|
||||
from os import remove
|
||||
|
||||
import jikanpy
|
||||
from telethon.errors.rpcerrorlist import MediaCaptionTooLongError
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -47,7 +46,26 @@ async def anilist(event):
|
||||
return await eod(x, "`Enter a anime name!`", time=5)
|
||||
banner, title, year, episodes, info = get_anime_src_res(name)
|
||||
msg = f"**{title}**\n{year} | {episodes} Episodes.\n\n{info}"
|
||||
await event.reply(msg, file=banner, link_preview=True)
|
||||
try:
|
||||
await event.reply(msg, file=banner, link_preview=True)
|
||||
except MediaCaptionTooLongError:
|
||||
nm = name.replace(" ", "_")
|
||||
with open(f"{nm}.txt", "w") as f:
|
||||
f.write(msg.replace("*", ""))
|
||||
await bash(f"wget {banner} -O {nm}.jpg")
|
||||
try:
|
||||
await event.reply(file=f"{nm}.txt", thumb=f"{nm}.jpg")
|
||||
except Exception as e:
|
||||
await event.reply(file=f"{nm}.txt")
|
||||
LOGS.warning(str(e))
|
||||
try:
|
||||
remove(f"{nm}.jpg")
|
||||
except BaseException:
|
||||
pass
|
||||
try:
|
||||
remove(f"{nm}.txt")
|
||||
except BaseException:
|
||||
pass
|
||||
await x.delete()
|
||||
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ async def unmuting(e):
|
||||
@ultroid_cmd(
|
||||
pattern="setflood ?(\\d+)",
|
||||
admins_only=True,
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def setflood(e):
|
||||
input = e.pattern_match.group(1)
|
||||
@@ -114,6 +115,7 @@ async def setflood(e):
|
||||
@ultroid_cmd(
|
||||
pattern="remflood$",
|
||||
admins_only=True,
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def remove_flood(e):
|
||||
hmm = rem_flood(e.chat_id)
|
||||
@@ -129,6 +131,7 @@ async def remove_flood(e):
|
||||
@ultroid_cmd(
|
||||
pattern="getflood$",
|
||||
admins_only=True,
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def getflood(e):
|
||||
ok = get_flood_limit(e.chat_id)
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
# 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}ascii <reply image>`
|
||||
Convert replied image into html.
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
|
||||
from img2html.converter import Img2HTMLConverter
|
||||
@@ -33,7 +30,7 @@ async def _(e):
|
||||
html = converter.convert(img)
|
||||
with open("html.html", "w") as t:
|
||||
t.write(html)
|
||||
await e.client.send_file(e.chat_id, "html.html", reply_to=e.reply_to_msg_id)
|
||||
await e.reply(file="html.html")
|
||||
await m.delete()
|
||||
os.remove(img)
|
||||
os.remove("html.html")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -17,7 +16,6 @@
|
||||
•`{i}listcmd`
|
||||
To Get list of all your custom cmd.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from pyUltroid.functions.asstcmd_db import *
|
||||
@@ -38,7 +36,7 @@ async def ac(e):
|
||||
if wt and wt.media:
|
||||
wut = mediainfo(wt.media)
|
||||
if wut.startswith(("pic", "gif")):
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await e.client.download_media(wt.media)
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -46,7 +44,7 @@ async def ac(e):
|
||||
if wt.media.document.size > 8 * 1000 * 1000:
|
||||
return await eod(x, "`Unsupported Media`")
|
||||
else:
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await e.client.download_media(wt.media)
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -48,9 +47,9 @@ async def autopic(e):
|
||||
if not ge == "True":
|
||||
return
|
||||
au = "https://unsplash.com" + lie["href"]
|
||||
et = await ultroid_bot(getweb(au))
|
||||
et = await e.client(getweb(au))
|
||||
try:
|
||||
kar = await ultroid_bot.download_media(et.webpage.photo)
|
||||
kar = await e.client.download_media(et.webpage.photo)
|
||||
except AttributeError:
|
||||
ct = r.get(au).content
|
||||
bsc = bs(ct, "html.parser", from_encoding="utf-8")
|
||||
@@ -58,8 +57,8 @@ async def autopic(e):
|
||||
li = ft[0]["src"]
|
||||
kar = "autopic.png"
|
||||
urllib.request.urlretrieve(li, kar)
|
||||
file = await ultroid_bot.upload_file(kar)
|
||||
await ultroid_bot(UploadProfilePhotoRequest(file))
|
||||
file = await e.client.upload_file(kar)
|
||||
await e.client(UploadProfilePhotoRequest(file))
|
||||
os.remove(kar)
|
||||
await asyncio.sleep(SLEEP_TIME)
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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
|
||||
|
||||
@@ -29,7 +28,6 @@
|
||||
• `{i}shutdown`
|
||||
Turn off your bot.
|
||||
"""
|
||||
|
||||
import time
|
||||
from datetime import datetime as dt
|
||||
from platform import python_version as pyver
|
||||
@@ -47,7 +45,7 @@ from . import *
|
||||
)
|
||||
async def lol(ult):
|
||||
pic = udB.get("ALIVE_PIC")
|
||||
uptime = grt(time.time() - start_time)
|
||||
uptime = time_formatter((time.time() - start_time) * 1000)
|
||||
header = udB.get("ALIVE_TEXT") if udB.get("ALIVE_TEXT") else "Hey, I am alive."
|
||||
y = Repo().active_branch
|
||||
xx = Repo().remotes[0].config_reader.get("url")
|
||||
@@ -67,16 +65,14 @@ async def lol(ult):
|
||||
return await eor(ult, als)
|
||||
elif pic is not None and "telegra" in pic:
|
||||
try:
|
||||
await ultroid_bot.send_message(
|
||||
ult.chat_id, als, file=pic, link_preview=False
|
||||
)
|
||||
await ult.reply(als, file=pic, link_preview=False)
|
||||
await ult.delete()
|
||||
except ChatSendMediaForbiddenError:
|
||||
await eor(ult, als, link_preview=False)
|
||||
else:
|
||||
try:
|
||||
await ultroid_bot.send_message(ult.chat_id, file=pic)
|
||||
await ultroid_bot.send_message(ult.chat_id, als, link_preview=False)
|
||||
await ult.reply(file=pic)
|
||||
await ult.reply(als, link_preview=False)
|
||||
await ult.delete()
|
||||
except ChatSendMediaForbiddenError:
|
||||
await eor(ult, als, link_preview=False)
|
||||
@@ -92,7 +88,7 @@ async def _(event):
|
||||
x = await eor(event, "`Pong !`")
|
||||
end = dt.now()
|
||||
ms = (end - start).microseconds / 1000
|
||||
uptime = grt(time.time() - start_time)
|
||||
uptime = time_formatter((time.time() - start_time) * 1000)
|
||||
await x.edit(get_string("ping").format(ms, uptime))
|
||||
|
||||
|
||||
@@ -116,13 +112,13 @@ async def restartbt(ult):
|
||||
|
||||
@ultroid_cmd(pattern="shutdown$")
|
||||
async def shutdownbot(ult):
|
||||
if not ult.out:
|
||||
if not is_fullsudo(ult.sender_id):
|
||||
return await eod(ult, "`This Command Is Sudo Restricted.`")
|
||||
if not ult.out and not is_fullsudo(ult.sender_id):
|
||||
return await eod(ult, "`This Command Is Sudo Restricted.`")
|
||||
await shutdown(ult)
|
||||
|
||||
|
||||
@ultroid_bot.on(events.NewMessage(pattern=f"\\{HNDLR}logs ?(.*)"))
|
||||
@asst.on(events.NewMessage(pattern="^/{HNDLR}logs ?(.*)"))
|
||||
async def _(event):
|
||||
if event.fwd_from:
|
||||
return
|
||||
@@ -134,7 +130,5 @@ async def _(event):
|
||||
return await def_logs(event)
|
||||
if opt == "heroku":
|
||||
await heroku_logs(event)
|
||||
elif opt == "sys":
|
||||
await def_logs(event)
|
||||
else:
|
||||
await def_logs(event)
|
||||
|
||||
60
plugins/botecho.py
Normal file
60
plugins/botecho.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 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}botecho text (optional -\n[button_text_1](https://t.me/TheUltroid)\n[button_text_2](https://t.me/TeamUltroid))`
|
||||
Send a message from your assistant bot.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from . import *
|
||||
|
||||
regex = r"\[(.*)\]\((\S*)\)"
|
||||
|
||||
|
||||
def generate_url_button(text):
|
||||
btns = []
|
||||
if not text:
|
||||
return None
|
||||
bt_txt = re.sub(regex, "", text) or None
|
||||
matches = re.finditer(regex, text, re.MULTILINE)
|
||||
if not matches:
|
||||
return None
|
||||
for i, match in enumerate(matches):
|
||||
if match.group(2).endswith(":same"):
|
||||
btnurl = match.group(2)[:-5]
|
||||
if i == 0:
|
||||
btns.append([Button.url(text=match.group(1), url=btnurl)])
|
||||
else:
|
||||
btns[-1].append(Button.url(text=match.group(1), url=btnurl))
|
||||
else:
|
||||
btns.append([Button.url(text=match.group(1), url=match.group(2))])
|
||||
if not btns:
|
||||
btns = None
|
||||
return bt_txt, btns
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="botecho")
|
||||
async def button_parser(event):
|
||||
try:
|
||||
text = event.text.split(" ", 1)[1]
|
||||
except IndexError:
|
||||
return await eor(
|
||||
event,
|
||||
f"**Please give some text!**\n**Format:** `{hndlr}botecho text \n[button_text_1](https://t.me/TheUltroid)\n[button_text_2](https://t.me/TeamUltroid)`",
|
||||
)
|
||||
text, buttons = generate_url_button(text)
|
||||
try:
|
||||
if text is None:
|
||||
return await eor(event, "`Please provide a text too!`")
|
||||
await asst.send_message(event.chat_id, text, buttons=buttons)
|
||||
await eor(event, "Done. Message sent.")
|
||||
except Exception as e:
|
||||
await eod(event, "**ERROR:**\n{}".format(str(e)), time=5)
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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
|
||||
|
||||
@@ -23,10 +22,11 @@
|
||||
• `{i}listchannels`
|
||||
To get list of all added chats.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import io
|
||||
|
||||
from pyUltroid.functions.broadcast_db import *
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ async def broadcast_adder(event):
|
||||
await x.edit(get_string("bd_2"))
|
||||
chats = [
|
||||
e.entity
|
||||
for e in await ultroid.get_dialogs()
|
||||
for e in await event.client.get_dialogs()
|
||||
if (e.is_group or e.is_channel)
|
||||
]
|
||||
for i in chats:
|
||||
@@ -53,10 +53,8 @@ async def broadcast_adder(event):
|
||||
new += 1
|
||||
cid = f"-100{i.id}"
|
||||
add_channel(int(cid))
|
||||
else:
|
||||
pass
|
||||
except BaseException:
|
||||
pass
|
||||
except Exception as Ex:
|
||||
LOGS.info(Ex)
|
||||
await x.edit(get_string("bd_3").format(get_no_channels(), new))
|
||||
return
|
||||
if event.reply_to_msg_id:
|
||||
@@ -73,11 +71,8 @@ async def broadcast_adder(event):
|
||||
await event.delete()
|
||||
return
|
||||
chat_id = event.chat_id
|
||||
try:
|
||||
if int(chat_id) == int(udB.get("LOG_CHANNEL")):
|
||||
return
|
||||
except BaseException:
|
||||
pass
|
||||
if int(chat_id) == int(udB.get("LOG_CHANNEL")):
|
||||
return
|
||||
if not is_channel_added(chat_id):
|
||||
xx = add_channel(chat_id)
|
||||
if xx:
|
||||
@@ -133,7 +128,7 @@ async def list_all(event):
|
||||
for channel in channels:
|
||||
name = ""
|
||||
try:
|
||||
name = (await ultroid.get_entity(int(channel))).title
|
||||
name = (await event.client.get_entity(int(channel))).title
|
||||
except BaseException:
|
||||
name = ""
|
||||
msg += f"=> **{name}** [`{channel}`]\n"
|
||||
@@ -142,13 +137,11 @@ async def list_all(event):
|
||||
MSG = msg.replace("*", "").replace("`", "")
|
||||
with io.BytesIO(str.encode(MSG)) as out_file:
|
||||
out_file.name = "channels.txt"
|
||||
await ultroid_bot.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
await event.reply(
|
||||
"Channels in Database",
|
||||
file=out_file,
|
||||
force_document=True,
|
||||
allow_cache=False,
|
||||
caption="Channels in database",
|
||||
reply_to=event,
|
||||
)
|
||||
await x.delete()
|
||||
else:
|
||||
@@ -161,8 +154,8 @@ async def list_all(event):
|
||||
)
|
||||
async def forw(event):
|
||||
if not event.is_reply:
|
||||
await eor(event, "Reply to a message to broadcast.")
|
||||
return
|
||||
return await eor(event, "Reply to a message to broadcast.")
|
||||
ultroid_bot = event.client
|
||||
channels = get_channels()
|
||||
x = await eor(event, "Sending...")
|
||||
if get_no_channels() == 0:
|
||||
@@ -185,25 +178,23 @@ async def forw(event):
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"Error in sending at {channel}.",
|
||||
)
|
||||
except BaseException:
|
||||
pass
|
||||
except Exception as Em:
|
||||
LOGS.info(Em)
|
||||
error_count += 1
|
||||
await x.edit(
|
||||
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
||||
)
|
||||
await x.edit(f"{sent_count} messages sent with {error_count} errors.")
|
||||
if error_count > 0:
|
||||
try:
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")), f"{error_count} Errors"
|
||||
)
|
||||
except BaseException:
|
||||
await x.edit("Set up log channel for checking errors.")
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")), f"{error_count} Errors"
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="broadcast ?(.*)",
|
||||
allow_sudo=False,
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def sending(event):
|
||||
x = await eor(event, "`Processing...`")
|
||||
@@ -228,23 +219,18 @@ async def sending(event):
|
||||
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
||||
)
|
||||
except Exception as error:
|
||||
try:
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"Error in sending at {channel}.\n\n{error}",
|
||||
)
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"Error in sending at {channel}.\n\n{error}",
|
||||
)
|
||||
error_count += 1
|
||||
await x.edit(
|
||||
f"Sent : {sent_count}\nError : {error_count}\nTotal : {len(channels)}",
|
||||
)
|
||||
await x.edit(f"{sent_count} messages sent with {error_count} errors.")
|
||||
if error_count > 0:
|
||||
try:
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"{error_count} Errors",
|
||||
)
|
||||
except BaseException:
|
||||
pass
|
||||
await ultroid_bot.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"{error_count} Errors",
|
||||
)
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
# 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}calc` - Inline Calculator
|
||||
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from . import *
|
||||
@@ -20,7 +18,7 @@ from . import *
|
||||
@ultroid_cmd(pattern="calc")
|
||||
async def icalc(e):
|
||||
udB.delete("calc")
|
||||
results = await ultroid_bot.inline_query(asst.me.username, "calc")
|
||||
results = await e.client.inline_query(asst.me.username, "calc")
|
||||
await results[0].click(e.chat_id, silent=True, hide_via=True)
|
||||
await e.delete()
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -14,7 +13,6 @@
|
||||
• `{i}rcarbon <text/reply to msg/reply to document>`
|
||||
Carbonise the text, with random bg colours.
|
||||
"""
|
||||
|
||||
import random
|
||||
|
||||
import requests
|
||||
@@ -182,7 +180,7 @@ async def crbn(event):
|
||||
if event.reply_to_msg_id:
|
||||
temp = await event.get_reply_message()
|
||||
if temp.media:
|
||||
b = await ultroid_bot.download_media(temp)
|
||||
b = await event.client.download_media(temp)
|
||||
a = open(b)
|
||||
code = a.read()
|
||||
a.close()
|
||||
@@ -199,10 +197,9 @@ async def crbn(event):
|
||||
carbon = Carbon(base_url="https://carbonara.vercel.app/api/cook", code=code)
|
||||
xx = await carbon.memorize("ultroid_carbon")
|
||||
await xxxx.delete()
|
||||
await ultroid_bot.send_file(
|
||||
event.chat_id,
|
||||
xx,
|
||||
caption=f"Carbonised by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
|
||||
await event.reply(
|
||||
f"Carbonised by {inline_mention(event.sender)}",
|
||||
file=xx,
|
||||
)
|
||||
|
||||
|
||||
@@ -214,7 +211,7 @@ async def crbn(event):
|
||||
if event.reply_to_msg_id:
|
||||
temp = await event.get_reply_message()
|
||||
if temp.media:
|
||||
b = await ultroid_bot.download_media(temp)
|
||||
b = await event.client.download_media(temp)
|
||||
a = open(b)
|
||||
code = a.read()
|
||||
a.close()
|
||||
@@ -234,8 +231,7 @@ async def crbn(event):
|
||||
)
|
||||
xx = await carbon.memorize("ultroid_carbon")
|
||||
await xxxx.delete()
|
||||
await ultroid_bot.send_file(
|
||||
event.chat_id,
|
||||
xx,
|
||||
caption=f"Carbonised by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
|
||||
await event.reply(
|
||||
f"Carbonised by {inline_mention(event.sender)}",
|
||||
file=xx,
|
||||
)
|
||||
|
||||
@@ -73,7 +73,7 @@ async def _(e):
|
||||
c = int(a)
|
||||
except Exception:
|
||||
try:
|
||||
c = (await ultroid_bot.get_entity(a)).id
|
||||
c = (await e.client.get_entity(a)).id
|
||||
except Exception:
|
||||
await z.edit("invalid Channel given")
|
||||
return
|
||||
@@ -81,14 +81,14 @@ async def _(e):
|
||||
d = int(b)
|
||||
except Exception:
|
||||
try:
|
||||
d = (await ultroid_bot.get_entity(b)).id
|
||||
d = (await e.client.get_entity(b)).id
|
||||
except Exception:
|
||||
await z.edit("invalid Channel given")
|
||||
return
|
||||
async for msg in ultroid_bot.iter_messages(int(c), reverse=True):
|
||||
async for msg in e.client.iter_messages(int(c), reverse=True):
|
||||
try:
|
||||
await asyncio.sleep(2)
|
||||
await ultroid_bot.send_message(int(d), msg)
|
||||
await e.client.send_message(int(d), msg)
|
||||
except BaseException:
|
||||
pass
|
||||
await z.edit("Done")
|
||||
@@ -115,7 +115,7 @@ async def source(e):
|
||||
@ultroid_cmd(pattern="dsource ?(.*)")
|
||||
async def dd(event):
|
||||
chat_id = event.pattern_match.group(1)
|
||||
x = await eor(event, "processing")
|
||||
x = await eor(event, "`Processing..`")
|
||||
if chat_id == "all":
|
||||
await x.edit("`Removing...`")
|
||||
udB.delete("CH_SOURCE")
|
||||
@@ -125,24 +125,18 @@ async def dd(event):
|
||||
y = int(chat_id)
|
||||
except Exception:
|
||||
try:
|
||||
y = int((await bot.get_entity(chat_id)).id)
|
||||
y = int((await event.client.get_entity(chat_id)).id)
|
||||
except Exception as es:
|
||||
print(es)
|
||||
return
|
||||
if is_source_channel_added(y):
|
||||
rem_source_channel(y)
|
||||
await x.edit("Source removed from database")
|
||||
await asyncio.sleep(3)
|
||||
await x.delete()
|
||||
await eod(x, "Source removed from database", time=3)
|
||||
elif is_source_channel_added(y):
|
||||
rem_source_channel(y)
|
||||
await x.edit("Source removed from database")
|
||||
await asyncio.sleep(3)
|
||||
await x.delete()
|
||||
await eod(x, "Source removed from database")
|
||||
elif not is_source_channel_added(y):
|
||||
await x.edit("Source channel is already removed from database. ")
|
||||
await asyncio.sleep(3)
|
||||
await x.delete()
|
||||
await eod(x, "Source channel is already removed from database. ", time=3)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listsource")
|
||||
@@ -156,7 +150,7 @@ async def list_all(event):
|
||||
for channel in channels:
|
||||
name = ""
|
||||
try:
|
||||
name = (await ultroid.get_entity(int(channel))).title
|
||||
name = (await event.client.get_entity(int(channel))).title
|
||||
except BaseException:
|
||||
name = ""
|
||||
msg += f"=> **{name}** [`{channel}`]\n"
|
||||
@@ -165,7 +159,7 @@ async def list_all(event):
|
||||
MSG = msg.replace("*", "").replace("`", "")
|
||||
with io.BytesIO(str.encode(MSG)) as out_file:
|
||||
out_file.name = "channels.txt"
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
force_document=True,
|
||||
@@ -185,7 +179,7 @@ async def destination(e):
|
||||
y = int(x)
|
||||
except Exception:
|
||||
try:
|
||||
y = int((await bot.get_entity(x)).id)
|
||||
y = int((await e.client.get_entity(x)).id)
|
||||
except Exception as es:
|
||||
print(es)
|
||||
return
|
||||
@@ -209,28 +203,23 @@ async def dd(event):
|
||||
y = int(chat_id)
|
||||
except Exception:
|
||||
try:
|
||||
y = int((await bot.get_entity(chat_id)).id)
|
||||
y = int((await event.client.get_entity(chat_id)).id)
|
||||
except Exception as es:
|
||||
print(es)
|
||||
return
|
||||
if is_destination_added(y):
|
||||
rem_destination(y)
|
||||
await x.edit("Destination removed from database")
|
||||
await asyncio.sleep(3)
|
||||
await x.delete()
|
||||
await eor(x, "Destination removed from database")
|
||||
elif is_destination_added(y):
|
||||
rem_destination(y)
|
||||
await x.edit("Destination removed from database")
|
||||
await asyncio.sleep(3)
|
||||
await x.delete()
|
||||
await eod(x, "Destination removed from database")
|
||||
elif not is_destination_added(y):
|
||||
await x.edit("Destination channel is already removed from database. ")
|
||||
await asyncio.sleep(3)
|
||||
await x.delete()
|
||||
await eod(x, "Destination channel is already removed from database. ")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listdest")
|
||||
async def list_all(event):
|
||||
ultroid_bot = event.client
|
||||
x = await eor(event, "`Calculating...`")
|
||||
channels = get_destinations()
|
||||
num = get_no_destinations()
|
||||
|
||||
88
plugins/chat_bot.py
Normal file
88
plugins/chat_bot.py
Normal file
@@ -0,0 +1,88 @@
|
||||
# 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}addai <reply to user/give username/userid>`
|
||||
Add a AI ChatBot to reply to that user.
|
||||
|
||||
• `{i}remai <reply to user/give username/userid>`
|
||||
Remove the AI ChatBot.
|
||||
|
||||
• `{i}repai <reply to user/give a message>`
|
||||
Reply to the user with a message by an AI.
|
||||
|
||||
• `{i}listai`
|
||||
List the currently AI added users.
|
||||
"""
|
||||
|
||||
from pyUltroid.functions.all import get_chatbot_reply
|
||||
from pyUltroid.functions.chatBot_db import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="repai")
|
||||
async def im_lonely_chat_with_me(event):
|
||||
if event.reply_to_msg_id:
|
||||
message = (await event.get_reply_message()).message
|
||||
else:
|
||||
try:
|
||||
message = event.text.split(" ", 1)[1]
|
||||
except IndexError:
|
||||
return await eod(
|
||||
event, "Give a message or Reply to a User's Message.", time=10
|
||||
)
|
||||
reply_ = get_chatbot_reply(event, message=message)
|
||||
await eor(event, reply_)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="addai")
|
||||
async def add_chatBot(event):
|
||||
await chat_bot_fn(event, type_="add")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="remai")
|
||||
async def rem_chatBot(event):
|
||||
await chat_bot_fn(event, type_="remov")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listai")
|
||||
async def lister(event):
|
||||
users = get_all_added()
|
||||
if udB.get("CHATBOT_USERS") is None:
|
||||
return await eod(event, "`No user has AI added.`")
|
||||
msg = ""
|
||||
for i in users:
|
||||
try:
|
||||
user = await event.client.get_entity(int(i))
|
||||
user = inline_mention(user)
|
||||
except BaseException:
|
||||
user = f"`{i}`"
|
||||
msg += "- {}\n".format(user)
|
||||
await eor(event, msg, link_preview=False)
|
||||
|
||||
|
||||
async def chat_bot_fn(event, type_):
|
||||
if event.reply_to_msg_id:
|
||||
user = (await event.get_reply_message()).sender
|
||||
else:
|
||||
temp = event.text.split(" ", 1)
|
||||
try:
|
||||
usr = temp[1]
|
||||
except IndexError:
|
||||
return await eod(
|
||||
event,
|
||||
"Reply to a user or give me his id/username to add an AI ChatBot!",
|
||||
)
|
||||
user = await event.client.get_entity(usr)
|
||||
if type_ == "add":
|
||||
add_chatbot(user.id)
|
||||
if type_ == "remov":
|
||||
rem_chatbot(user.id)
|
||||
await eor(
|
||||
event, f"**ChatBot:**\n{type_}ed [{user.first_name}](tg://user?id={user.id})`"
|
||||
)
|
||||
@@ -53,6 +53,8 @@ async def _(e):
|
||||
@ultroid_cmd(
|
||||
pattern="getlink$",
|
||||
groups_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Processing...`")
|
||||
|
||||
@@ -28,9 +28,6 @@ from . import *
|
||||
async def _(e):
|
||||
add_clean(e.chat_id)
|
||||
await eod(e, "Added Clean Action Setting For this Chat")
|
||||
async for x in ultroid_bot.iter_messages(e.chat_id, limit=3000):
|
||||
if x.action:
|
||||
await x.delete()
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="remclean$")
|
||||
@@ -47,19 +44,10 @@ async def _(e):
|
||||
o = ""
|
||||
for x in k:
|
||||
try:
|
||||
title = (await ultroid_bot.get_entity(int(x))).title
|
||||
title = e.chat.title
|
||||
except BaseException:
|
||||
title = "`Invalid ID`"
|
||||
o += x + " " + title + "\n"
|
||||
await eor(e, o)
|
||||
else:
|
||||
await eod(e, "`No Chat Added`")
|
||||
|
||||
|
||||
@ultroid_bot.on(events.ChatAction())
|
||||
async def _(event):
|
||||
if is_clean_added(event.chat_id):
|
||||
try:
|
||||
await event.delete()
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
• `{i}compress <reply to video>`
|
||||
optional `crf` and `stream`
|
||||
Example : `{i}compress 27 | stream` or `{i}compress 28`
|
||||
Example : `{i}compress 27 stream` or `{i}compress 28`
|
||||
Encode the replied video according to CRF value.
|
||||
Less CRF == High Quality, More Size
|
||||
More CRF == Low Quality, Less Size
|
||||
@@ -33,12 +33,18 @@ from telethon.tl.types import DocumentAttributeVideo
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="compress ?((\\d+)(.*)|$)")
|
||||
@ultroid_cmd(pattern="compress ?(.*)")
|
||||
async def _(e):
|
||||
crf = e.pattern_match.group(1)
|
||||
if not crf:
|
||||
crf = 27
|
||||
to_stream = e.pattern_match.group(2)
|
||||
cr = e.pattern_match.group(1)
|
||||
crf = 27
|
||||
to_stream = False
|
||||
if cr:
|
||||
k = e.text.split()
|
||||
if len(k) == 2:
|
||||
crf = int(k[1]) if k[1].isdigit() else 27
|
||||
elif len(k) > 2:
|
||||
crf = int(k[1]) if k[1].isdigit() else 27
|
||||
to_stream = True if "stream" in k[2] else False
|
||||
vido = await e.get_reply_message()
|
||||
if vido and vido.media:
|
||||
if "video" in mediainfo(vido.media):
|
||||
@@ -63,7 +69,7 @@ async def _(e):
|
||||
d_time = time.time()
|
||||
diff = time_formatter((d_time - c_time) * 1000)
|
||||
file_name = (file.name).split("/")[-1]
|
||||
out = file_name.replace(file_name.split(".")[-1], " compressed.mkv")
|
||||
out = file_name.replace(file_name.split(".")[-1], "compressed.mkv")
|
||||
await xxx.edit(
|
||||
f"`Downloaded {file.name} of {humanbytes(o_size)} in {diff}.\nNow Compressing...`"
|
||||
)
|
||||
@@ -93,16 +99,17 @@ async def _(e):
|
||||
per = elapse * 100 / int(total_frames)
|
||||
time_diff = time.time() - int(d_time)
|
||||
speed = round(elapse / time_diff, 2)
|
||||
eta = time_formatter(
|
||||
((int(total_frames) - elapse) / speed) * 1000
|
||||
)
|
||||
some_eta = ((int(total_frames) - elapse) / speed) * 1000
|
||||
text = f"`Compressing {file_name} at {crf} CRF.\n`"
|
||||
progress_str = "`[{0}{1}] {2}%\n\n`".format(
|
||||
"".join(["●" for i in range(math.floor(per / 5))]),
|
||||
"".join(["" for i in range(20 - math.floor(per / 5))]),
|
||||
round(per, 2),
|
||||
)
|
||||
e_size = humanbytes(size)
|
||||
e_size = (
|
||||
humanbytes(size) + " of ~" + humanbytes((size / per) * 100)
|
||||
)
|
||||
eta = "~" + time_formatter(some_eta)
|
||||
try:
|
||||
await xxx.edit(
|
||||
text
|
||||
@@ -135,7 +142,7 @@ async def _(e):
|
||||
xxx,
|
||||
"Uploading " + out + "...",
|
||||
)
|
||||
if to_stream and "| stream" in to_stream:
|
||||
if to_stream:
|
||||
metadata = extractMetadata(createParser(out))
|
||||
duration = metadata.get("duration").seconds
|
||||
hi, _ = await bash(f'mediainfo "{out}" | grep "Height"')
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -27,7 +26,6 @@
|
||||
• `{i}thumbnail <reply to image/thumbnail file>`
|
||||
Upload Your file with your custom thumbnail.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
@@ -51,10 +49,10 @@ async def _(e):
|
||||
if not r:
|
||||
return await eor(e, pop)
|
||||
if isinstance(r.media, photu):
|
||||
dl = await ultroid_bot.download_media(r.media)
|
||||
dl = await e.client.download_media(r.media)
|
||||
elif isinstance(r.media, doc):
|
||||
if r.media.document.thumbs:
|
||||
dl = await ultroid_bot.download_media(r, thumb=-1)
|
||||
dl = await e.client.download_media(r, thumb=-1)
|
||||
else:
|
||||
return await eor(e, pop)
|
||||
variable = uf(dl)
|
||||
@@ -76,7 +74,7 @@ async def imak(event):
|
||||
return
|
||||
inp = event.pattern_match.group(1)
|
||||
if not inp:
|
||||
await eor(event, "Give The name nd extension of file")
|
||||
await eor(event, "Give The name and extension of file")
|
||||
return
|
||||
xx = await eor(event, "`Processing...`")
|
||||
if reply.media:
|
||||
@@ -91,13 +89,11 @@ async def imak(event):
|
||||
os.rename(file, inp)
|
||||
k = time.time()
|
||||
xxx = await uploader(inp, inp, k, xx, "Uploading...")
|
||||
await ultroid_bot.send_file(
|
||||
event.chat_id,
|
||||
xxx,
|
||||
await event.reply(
|
||||
f"`{xxx.name}`",
|
||||
file=xxx,
|
||||
force_document=True,
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
caption=f"`{xxx.name}`",
|
||||
reply_to=reply,
|
||||
)
|
||||
os.remove(inp)
|
||||
await xx.delete()
|
||||
@@ -112,7 +108,7 @@ async def imak(event):
|
||||
await eor(event, "Reply to any media.")
|
||||
return
|
||||
xx = await eor(event, "`Processing...`")
|
||||
image = await ultroid_bot.download_media(reply)
|
||||
image = await reply.download_media()
|
||||
file = "ult.png"
|
||||
if image.endswith((".webp", ".png")):
|
||||
c = Image.open(image)
|
||||
@@ -121,7 +117,7 @@ async def imak(event):
|
||||
img = cv2.VideoCapture(image)
|
||||
ult, roid = img.read()
|
||||
cv2.imwrite(file, roid)
|
||||
await ultroid_bot.send_file(event.chat_id, file, reply_to=reply)
|
||||
await event.reply(file=file)
|
||||
await xx.delete()
|
||||
os.remove(file)
|
||||
os.remove(image)
|
||||
@@ -136,7 +132,7 @@ async def smak(event):
|
||||
await eor(event, "Reply to any media.")
|
||||
return
|
||||
xx = await eor(event, "`Processing...`")
|
||||
image = await ultroid_bot.download_media(reply)
|
||||
image = await reply.download_media()
|
||||
file = "ult.webp"
|
||||
if image.endswith((".webp", ".png", ".jpg")):
|
||||
c = Image.open(image)
|
||||
@@ -145,7 +141,7 @@ async def smak(event):
|
||||
img = cv2.VideoCapture(image)
|
||||
ult, roid = img.read()
|
||||
cv2.imwrite(file, roid)
|
||||
await ultroid_bot.send_file(event.chat_id, file, reply_to=reply)
|
||||
await event.reply(file=file)
|
||||
await xx.delete()
|
||||
os.remove(file)
|
||||
os.remove(image)
|
||||
@@ -157,7 +153,7 @@ async def smak(event):
|
||||
async def _(event):
|
||||
input_str = event.pattern_match.group(1)
|
||||
if not input_str:
|
||||
return await eod(event, "`Bsdk Give Name.`")
|
||||
return await eod(event, "`Give The File Name.`")
|
||||
xx = await eor(event, get_string("com_1"))
|
||||
if event.reply_to_msg_id:
|
||||
a = await event.get_reply_message()
|
||||
@@ -168,9 +164,7 @@ async def _(event):
|
||||
b.write(str(a.message))
|
||||
b.close()
|
||||
await xx.edit(f"**Packing into** `{input_str}`")
|
||||
await event.client.send_file(
|
||||
event.chat_id, input_str, thumb="resources/extras/ultroid.jpg"
|
||||
)
|
||||
await event.reply(file=input_str, thumb="resources/extras/ultroid.jpg")
|
||||
await xx.delete()
|
||||
os.remove(input_str)
|
||||
|
||||
@@ -198,12 +192,8 @@ async def _(event):
|
||||
await xx.edit(
|
||||
f"**MESSAGE EXCEEDS TELEGRAM LIMITS**\n\nSo Pasted It On [NEKOBIN](https://nekobin.com/{key})"
|
||||
)
|
||||
elif "dog" in what:
|
||||
await xx.edit(
|
||||
f"**MESSAGE EXCEEDS TELEGRAM LIMITS**\n\nSo Pasted It On [DOGBIN](https://del.dog/{key})"
|
||||
)
|
||||
os.remove(b)
|
||||
else:
|
||||
return await eod(xx, "`Reply to a readable file`", time=5)
|
||||
return await eod(xx, "`Reply to a readable file`")
|
||||
else:
|
||||
return await eod(xx, "`Reply to a readable file`", time=5)
|
||||
return await eod(xx, "`Reply to a readable file`")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -14,7 +13,6 @@
|
||||
import os
|
||||
import time
|
||||
from json.decoder import JSONDecodeError
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
import requests as r
|
||||
from telethon.tl.types import DocumentAttributeAudio
|
||||
@@ -56,8 +54,8 @@ async def siesace(e):
|
||||
singers = k["artist"]["name"]
|
||||
except Exception as ex:
|
||||
return await eod(lol, f"`{str(ex)}`")
|
||||
urlretrieve(urrl, title + "." + quality)
|
||||
urlretrieve(img, title + ".jpg")
|
||||
await download_file(urrl, title + "." + quality)
|
||||
await download_file(img, title + ".jpg")
|
||||
okk = await uploader(
|
||||
title + "." + quality,
|
||||
title + "." + quality,
|
||||
@@ -65,10 +63,9 @@ async def siesace(e):
|
||||
lol,
|
||||
"Uploading " + title + "...",
|
||||
)
|
||||
await ultroid_bot.send_file(
|
||||
e.chat_id,
|
||||
okk,
|
||||
caption="`" + title + "`" + "\n`From Deezer`",
|
||||
await e.reply(
|
||||
"`" + title + "`" + "\n`From Deezer`",
|
||||
file=okk,
|
||||
attributes=[
|
||||
DocumentAttributeAudio(
|
||||
duration=int(duration),
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -27,6 +26,7 @@ import io
|
||||
import sys
|
||||
import traceback
|
||||
from os import remove
|
||||
from pprint import pprint
|
||||
|
||||
from carbonnow import Carbon
|
||||
|
||||
@@ -43,7 +43,7 @@ async def _(e):
|
||||
p = (neo.read()).replace("\n\n", "")
|
||||
ok = Carbon(base_url="https://carbonara.vercel.app/api/cook", code=p)
|
||||
haa = await ok.save("neofetch")
|
||||
await e.client.send_file(e.chat_id, haa)
|
||||
await e.reply(file=haa)
|
||||
await xx.delete()
|
||||
remove("neofetch.jpg")
|
||||
remove("neo.txt")
|
||||
@@ -89,7 +89,7 @@ async def _(event):
|
||||
force_document=True,
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
allow_cache=False,
|
||||
caption=f"`{cmd}`",
|
||||
caption=f"`{cmd}`" if (len(cmd) + 2) < 1000 else None,
|
||||
reply_to=reply_to_id,
|
||||
)
|
||||
await xx.delete()
|
||||
@@ -97,7 +97,7 @@ async def _(event):
|
||||
await xx.edit(OUT)
|
||||
|
||||
|
||||
p = print # ignore: pylint
|
||||
p, pp = print, pprint # ignore: pylint
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -155,7 +155,7 @@ async def _(event):
|
||||
ultd = final_output.replace("`", "").replace("*", "").replace("_", "")
|
||||
with io.BytesIO(str.encode(ultd)) as out_file:
|
||||
out_file.name = "eval.txt"
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
force_document=True,
|
||||
@@ -174,7 +174,7 @@ async def aexec(code, event):
|
||||
f"async def __aexec(e, client): "
|
||||
+ "\n message = event = e"
|
||||
+ "\n reply = await event.get_reply_message()"
|
||||
+ "\n chat = e.chat_id"
|
||||
+ "\n chat = (await event.get_chat()).id"
|
||||
+ "".join(f"\n {l}" for l in code.split("\n")),
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
• `{i}dm <username/id> <reply/type>`
|
||||
Direct Message the User.
|
||||
"""
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@@ -26,22 +25,18 @@ async def dm(e):
|
||||
try:
|
||||
chat_id = await get_user_id(c[0])
|
||||
except Exception as ex:
|
||||
return await eod(e, "`" + str(ex) + "`", time=5)
|
||||
return await eod(e, "`" + str(ex) + "`")
|
||||
msg = ""
|
||||
masg = await e.get_reply_message()
|
||||
if e.reply_to_msg_id:
|
||||
await ultroid_bot.send_message(chat_id, masg)
|
||||
await eod(e, "`⚜️Message Delivered!`", time=4)
|
||||
await e.client.send_message(chat_id, masg)
|
||||
await eod(e, "`⚜️Message Delivered!`")
|
||||
for i in c[1:]:
|
||||
msg += i + " "
|
||||
if msg == "":
|
||||
return
|
||||
try:
|
||||
await ultroid_bot.send_message(chat_id, msg)
|
||||
await eod(e, "`⚜️Message Delivered!⚜️`", time=4)
|
||||
await e.client.send_message(chat_id, msg)
|
||||
await eod(e, "`⚜️Message Delivered!⚜️`")
|
||||
except BaseException:
|
||||
await eod(
|
||||
e,
|
||||
"`{i}help dm`",
|
||||
time=4,
|
||||
)
|
||||
await eod(e, f"Read Usage : `{HNDLR}help dm`")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -19,7 +18,6 @@
|
||||
Reply to file to download.
|
||||
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import time
|
||||
@@ -118,19 +116,96 @@ async def download(event):
|
||||
for kk in kk:
|
||||
try:
|
||||
try:
|
||||
res = await uploader(kk, kk, tt, xx, "Uploading...")
|
||||
res = await uploader(kk, kk, tt, xx, "Uploading {kk}...")
|
||||
except MessageNotModifiedError as err:
|
||||
return await xx.edit(str(err))
|
||||
title = kk.split("/")[-1]
|
||||
if title.endswith((".mp3", ".m4a", ".opus", ".ogg")):
|
||||
if title.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
||||
hmm = " | stream"
|
||||
if " | stream" in hmm:
|
||||
metadata = extractMetadata(createParser(res.name))
|
||||
if not metadata:
|
||||
return await event.reply(file=res, supports_streaming=True)
|
||||
wi = 512
|
||||
hi = 512
|
||||
duration = 0
|
||||
artist = ""
|
||||
try:
|
||||
if metadata.has("width"):
|
||||
wi = metadata.get("width")
|
||||
if metadata.has("height"):
|
||||
hi = metadata.get("height")
|
||||
if metadata.has("duration"):
|
||||
duration = metadata.get("duration").seconds
|
||||
if metadata.has("artist"):
|
||||
artist = metadata.get("artist")
|
||||
else:
|
||||
if udB.get("artist"):
|
||||
artist = udB.get("artist")
|
||||
else:
|
||||
artist = ultroid_bot.first_name
|
||||
except AttributeError:
|
||||
return await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{kk}/{title}`",
|
||||
supports_streaming=True,
|
||||
)
|
||||
if res.name.endswith((".mkv", ".mp4", ".avi")):
|
||||
attributes = [
|
||||
DocumentAttributeVideo(
|
||||
w=wi, h=hi, duration=duration, supports_streaming=True
|
||||
)
|
||||
]
|
||||
elif res.name.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
||||
attributes = [
|
||||
DocumentAttributeAudio(
|
||||
duration=duration,
|
||||
title=title.split(".")[0],
|
||||
performer=artist,
|
||||
)
|
||||
]
|
||||
else:
|
||||
attributes = None
|
||||
try:
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{kk}`",
|
||||
attributes=attributes,
|
||||
supports_streaming=True,
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
except BaseException:
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{kk}`",
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
else:
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{kk}`",
|
||||
force_document=True,
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
except Exception as ve:
|
||||
return await eor(xx, str(ve))
|
||||
else:
|
||||
try:
|
||||
try:
|
||||
res = await uploader(kk, kk, tt, xx, f"Uploading {kk}...")
|
||||
except MessageNotModifiedError as err:
|
||||
return await xx.edit(str(err))
|
||||
if title.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
||||
hmm = " | stream"
|
||||
if " | stream" in hmm:
|
||||
metadata = extractMetadata(createParser(res.name))
|
||||
wi = 512
|
||||
hi = 512
|
||||
duration = 0
|
||||
artist = ""
|
||||
try:
|
||||
if metadata.has("width"):
|
||||
wi = metadata.get("width")
|
||||
if metadata.has("height"):
|
||||
@@ -144,81 +219,20 @@ async def download(event):
|
||||
artist = udB.get("artist")
|
||||
else:
|
||||
artist = ultroid_bot.first_name
|
||||
if res.name.endswith(tuple([".mkv", ".mp4", ".avi"])):
|
||||
attributes = [
|
||||
DocumentAttributeVideo(
|
||||
w=wi, h=hi, duration=duration, supports_streaming=True
|
||||
)
|
||||
]
|
||||
elif res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
|
||||
attributes = [
|
||||
DocumentAttributeAudio(
|
||||
duration=duration,
|
||||
title=title.split(".")[0],
|
||||
performer=artist,
|
||||
)
|
||||
]
|
||||
else:
|
||||
attributes = None
|
||||
try:
|
||||
x = await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{title}`",
|
||||
attributes=attributes,
|
||||
supports_streaming=True,
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
except BaseException:
|
||||
x = await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{title}`",
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
else:
|
||||
x = await event.client.send_file(
|
||||
except AttributeError:
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{title}`",
|
||||
force_document=True,
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
supports_streaming=True,
|
||||
)
|
||||
except Exception as ve:
|
||||
return await eor(xx, str(ve))
|
||||
else:
|
||||
try:
|
||||
try:
|
||||
res = await uploader(kk, kk, tt, xx, "Uploading...")
|
||||
except MessageNotModifiedError as err:
|
||||
return await xx.edit(str(err))
|
||||
if title.endswith((".mp3", ".m4a", ".opus", ".ogg")):
|
||||
hmm = " | stream"
|
||||
if " | stream" in hmm:
|
||||
metadata = extractMetadata(createParser(res.name))
|
||||
wi = 512
|
||||
hi = 512
|
||||
duration = 0
|
||||
if metadata.has("width"):
|
||||
wi = metadata.get("width")
|
||||
if metadata.has("height"):
|
||||
hi = metadata.get("height")
|
||||
if metadata.has("duration"):
|
||||
duration = metadata.get("duration").seconds
|
||||
if metadata.has("artist"):
|
||||
artist = metadata.get("artist")
|
||||
else:
|
||||
if udB.get("artist"):
|
||||
artist = udB.get("artist")
|
||||
else:
|
||||
artist = ultroid_bot.first_name
|
||||
if res.name.endswith(tuple([".mkv", ".mp4", ".avi"])):
|
||||
if res.name.endswith((".mkv", ".mp4", ".avi")):
|
||||
attributes = [
|
||||
DocumentAttributeVideo(
|
||||
w=wi, h=hi, duration=duration, supports_streaming=True
|
||||
)
|
||||
]
|
||||
elif res.name.endswith(tuple([".mp3", ".m4a", ".opus", ".ogg"])):
|
||||
elif res.name.endswith((".mp3", ".m4a", ".opus", ".ogg", ".flac")):
|
||||
attributes = [
|
||||
DocumentAttributeAudio(
|
||||
duration=duration,
|
||||
@@ -229,7 +243,7 @@ async def download(event):
|
||||
else:
|
||||
attributes = None
|
||||
try:
|
||||
x = await event.client.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{title}`",
|
||||
@@ -238,7 +252,7 @@ async def download(event):
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
except BaseException:
|
||||
x = await event.client.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{title}`",
|
||||
@@ -246,7 +260,7 @@ async def download(event):
|
||||
thumb="resources/extras/ultroid.jpg",
|
||||
)
|
||||
else:
|
||||
x = await event.client.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
res,
|
||||
caption=f"`{title}`",
|
||||
@@ -266,7 +280,7 @@ async def download(event):
|
||||
size += os.path.getsize(fp)
|
||||
c = len(os.listdir(kk))
|
||||
await xx.delete()
|
||||
await ultroid_bot.send_message(
|
||||
await event.client.send_message(
|
||||
event.chat_id,
|
||||
f"Uploaded Total - `{c}` files of `{humanbytes(size)}` in `{t}`",
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ async def echo(e):
|
||||
try:
|
||||
user = e.text.split()[1]
|
||||
if user.startswith("@"):
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = ok.id
|
||||
else:
|
||||
user = int(user)
|
||||
@@ -43,7 +43,7 @@ async def echo(e):
|
||||
if check_echo(e.chat_id, user):
|
||||
return await eod(e, "Echo already activated for this user.")
|
||||
add_echo(e.chat_id, user)
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
|
||||
await eor(e, f"Activated Echo For {user}.")
|
||||
|
||||
@@ -57,7 +57,7 @@ async def rm(e):
|
||||
try:
|
||||
user = e.text.split()[1]
|
||||
if user.startswith("@"):
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = ok.id
|
||||
else:
|
||||
user = int(user)
|
||||
@@ -65,7 +65,7 @@ async def rm(e):
|
||||
return await eod(e, "Reply To A User.")
|
||||
if check_echo(e.chat_id, user):
|
||||
rem_echo(e.chat_id, user)
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
|
||||
return await eor(e, f"Deactivated Echo For {user}.")
|
||||
await eor(e, "Echo not activated for this user")
|
||||
@@ -75,8 +75,8 @@ async def rm(e):
|
||||
async def okk(e):
|
||||
if check_echo(e.chat_id, e.sender_id):
|
||||
try:
|
||||
ok = await bot.get_messages(e.chat_id, ids=e.id)
|
||||
return await ultroid_bot.send_message(e.chat_id, ok)
|
||||
ok = await e.client.get_messages(e.chat_id, ids=e.id)
|
||||
return await e.client.send_message(e.chat_id, ok)
|
||||
except Exception as er:
|
||||
LOGS.info(er)
|
||||
|
||||
@@ -87,7 +87,7 @@ async def lstecho(e):
|
||||
if k:
|
||||
user = "**Activated Echo For Users:**\n\n"
|
||||
for x in k:
|
||||
ok = await ultroid_bot.get_entity(int(x))
|
||||
ok = await e.client.get_entity(int(x))
|
||||
kk = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
|
||||
user += "•" + kk + "\n"
|
||||
await eor(e, user)
|
||||
|
||||
@@ -4,22 +4,20 @@
|
||||
# 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}evaljs <javaScriptCommands>`
|
||||
Evaluate JavaScript code and upload.
|
||||
"""
|
||||
|
||||
# Inbuilt
|
||||
import os
|
||||
import time
|
||||
from threading import Thread
|
||||
|
||||
# Ultroid
|
||||
from . import *
|
||||
|
||||
|
||||
# Ultroid
|
||||
async def evalJs(
|
||||
event,
|
||||
startTime: float,
|
||||
@@ -34,14 +32,14 @@ async def evalJs(
|
||||
scriptFile.close()
|
||||
os.system(f"node ./src/ecmaHelper/eval.d.js")
|
||||
if os.path.exists("./src/ecmaHelper/evalJs.result.d.txt"):
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
"./src/ecmaHelper/evalJs.result.d.txt",
|
||||
force_document=True,
|
||||
caption=f"**☞ evalJS\n\n• Command:**\n`{command}` \n\n**• TimeTaken:**\n`{time.time() - startTime:.2f}s` \n\n**• Result:**\n`[Info]: Uploaded File For Better Visualisation Of Indents.`",
|
||||
)
|
||||
else:
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
"./src/ecmaHelper/evalJs.result.d.txt",
|
||||
force_document=True,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -20,7 +19,6 @@
|
||||
• `{i}reply`
|
||||
Reply the last sent msg to replied user.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
|
||||
from telethon.events import NewMessage as NewMsg
|
||||
@@ -51,11 +49,7 @@ async def delete_it(delme):
|
||||
await msg_src.delete()
|
||||
await delme.delete()
|
||||
except Exception as e:
|
||||
await eod(
|
||||
delme,
|
||||
f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`",
|
||||
time=5,
|
||||
)
|
||||
await eod(delme, f"Couldn't delete the message.\n\n**ERROR:**\n`{str(e)}`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -68,7 +62,7 @@ async def copy(e):
|
||||
await eor(e, reply.text)
|
||||
else:
|
||||
await reply.reply(reply)
|
||||
if e.sender_id == ultroid_bot.uid:
|
||||
if e.out:
|
||||
await e.delete()
|
||||
else:
|
||||
await eod(e, "`Reply To any message`")
|
||||
@@ -90,7 +84,7 @@ async def editer(edit):
|
||||
pass
|
||||
else:
|
||||
i = 1
|
||||
async for message in ultroid_bot.iter_messages(chat, ultroid_bot.uid):
|
||||
async for message in edit.client.iter_messages(chat, ultroid_bot.uid):
|
||||
if i == 2:
|
||||
await message.edit(string)
|
||||
await edit.delete()
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
• `{i}fgame <time/in secs>`
|
||||
`Show Fake Game Playing Action in current chat. `
|
||||
|
||||
• `{i}stopaction`
|
||||
`Stop any ongoing Chat Action going in Chat.`
|
||||
"""
|
||||
|
||||
from . import *
|
||||
@@ -94,3 +97,10 @@ async def _(e):
|
||||
await eod(e, f"Starting Fake Game Playing For {t} sec.")
|
||||
async with e.client.action(e.chat_id, "game"):
|
||||
await asyncio.sleep(t)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="stopaction")
|
||||
async def do_it(e):
|
||||
async with e.client.action(e.chat_id, "cancel"):
|
||||
pass
|
||||
await e.reply("Fake Action Stopped.")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -22,7 +21,6 @@ Specify FBan Group and Feds to exclude in the assistant.
|
||||
• `{i}fedinfo <(fedid)>`
|
||||
Collect federation info of the given fed id, or of the fed you own, from Rose.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
@@ -33,13 +31,13 @@ from . import *
|
||||
bot = "@MissRose_bot"
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="superfban ?(.*)")
|
||||
@ultroid_cmd(pattern="superfban ?(.*)", ignore_dualmode=True)
|
||||
async def _(event):
|
||||
msg = await eor(event, "Starting a Mass-FedBan...")
|
||||
if event.reply_to_msg_id:
|
||||
previous_message = await event.get_reply_message()
|
||||
if previous_message.media:
|
||||
downloaded_file_name = await ultroid.download_media(
|
||||
downloaded_file_name = await event.client.download_media(
|
||||
previous_message,
|
||||
"fedlist",
|
||||
)
|
||||
@@ -85,7 +83,7 @@ async def _(event):
|
||||
except BaseException:
|
||||
return await msg.edit("Give username or id.")
|
||||
try:
|
||||
x = await ultroid_bot.get_entity(usr)
|
||||
x = await event.client.get_entity(usr)
|
||||
uid = x.id
|
||||
except BaseException:
|
||||
return await msg.edit("Incorrect user was designated.")
|
||||
@@ -100,7 +98,7 @@ async def _(event):
|
||||
fedList = []
|
||||
if not len(fedList):
|
||||
for a in range(3):
|
||||
async with ultroid.conversation("@MissRose_bot") as bot_conv:
|
||||
async with event.client.conversation("@MissRose_bot") as bot_conv:
|
||||
await bot_conv.send_message("/start")
|
||||
await asyncio.sleep(3)
|
||||
await bot_conv.send_message("/myfeds")
|
||||
@@ -175,9 +173,9 @@ async def _(event):
|
||||
await ultroid.send_message(chat, f"{fed} Excluded.")
|
||||
exCount += 1
|
||||
continue
|
||||
await ultroid.send_message(chat, f"/joinfed {fed}")
|
||||
await event.client.send_message(chat, f"/joinfed {fed}")
|
||||
await asyncio.sleep(3)
|
||||
await ultroid.send_message(chat, f"/fban {uid} {REASON}")
|
||||
await event.client.send_message(chat, f"/fban {uid} {REASON}")
|
||||
await asyncio.sleep(3)
|
||||
try:
|
||||
os.remove("fedlist")
|
||||
@@ -188,7 +186,7 @@ async def _(event):
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="superunfban ?(.*)")
|
||||
@ultroid_cmd(pattern="superunfban ?(.*)", ignore_dualmode=True)
|
||||
async def _(event):
|
||||
msg = await eor(event, "Starting a Mass-UnFedBan...")
|
||||
fedList = []
|
||||
@@ -241,7 +239,7 @@ async def _(event):
|
||||
chat = await event.get_chat()
|
||||
if not len(fedList):
|
||||
for a in range(3):
|
||||
async with ultroid.conversation("@MissRose_bot") as bot_conv:
|
||||
async with event.client.conversation("@MissRose_bot") as bot_conv:
|
||||
await bot_conv.send_message("/start")
|
||||
await asyncio.sleep(3)
|
||||
await bot_conv.send_message("/myfeds")
|
||||
@@ -301,7 +299,7 @@ async def _(event):
|
||||
return
|
||||
await msg.edit(f"UnFBaning in {len(fedList)} feds.")
|
||||
try:
|
||||
await ultroid.send_message(chat, f"/start")
|
||||
await event.client.send_message(chat, f"/start")
|
||||
except BaseException:
|
||||
await msg.edit("Specified FBan Group ID is incorrect.")
|
||||
return
|
||||
@@ -313,7 +311,7 @@ async def _(event):
|
||||
exCount = 0
|
||||
for fed in fedList:
|
||||
if udB.get("EXCLUDE_FED") and fed in excludeFed:
|
||||
await ultroid.send_message(chat, f"{fed} Excluded.")
|
||||
await event.client.send_message(chat, f"{fed} Excluded.")
|
||||
exCount += 1
|
||||
continue
|
||||
await ultroid.send_message(chat, f"/joinfed {fed}")
|
||||
@@ -329,7 +327,7 @@ async def _(event):
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="fstat ?(.*)")
|
||||
@ultroid_cmd(pattern="fstat ?(.*)", ignore_dualmode=True)
|
||||
async def _(event):
|
||||
ok = await eor(event, "`Checking...`")
|
||||
if event.reply_to_msg_id:
|
||||
@@ -347,7 +345,7 @@ async def _(event):
|
||||
)
|
||||
return
|
||||
else:
|
||||
async with ultroid.conversation(bot) as conv:
|
||||
async with event.client.conversation(bot) as conv:
|
||||
try:
|
||||
await conv.send_message("/start")
|
||||
await conv.get_response()
|
||||
@@ -361,7 +359,7 @@ async def _(event):
|
||||
await audio.click(0)
|
||||
await asyncio.sleep(2)
|
||||
audio = await conv.get_response()
|
||||
await ultroid.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
audio,
|
||||
caption=f"List of feds {user} has been banned in.\n\nCollected using Ultroid.",
|
||||
@@ -376,11 +374,11 @@ async def _(event):
|
||||
await ok.edit("**Error**\n `Unblock` @MissRose_Bot `and try again!")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="fedinfo ?(.*)")
|
||||
@ultroid_cmd(pattern="fedinfo ?(.*)", ignore_dualmode=True)
|
||||
async def _(event):
|
||||
ok = await event.edit("`Extracting information...`")
|
||||
sysarg = event.pattern_match.group(1)
|
||||
async with ultroid.conversation(bot) as conv:
|
||||
async with event.client.conversation(bot) as conv:
|
||||
try:
|
||||
await conv.send_message("/start")
|
||||
await conv.get_response()
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from pyUltroid.functions.filter_db import *
|
||||
from telegraph import upload_file as uf
|
||||
@@ -38,14 +39,14 @@ async def af(e):
|
||||
if wt and wt.media:
|
||||
wut = mediainfo(wt.media)
|
||||
if wut.startswith(("pic", "gif")):
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await wt.download_media()
|
||||
variable = uf(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
elif wut == "video":
|
||||
if wt.media.document.size > 8 * 1000 * 1000:
|
||||
return await eod(x, "`Unsupported Media`")
|
||||
else:
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await wt.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -88,22 +89,11 @@ async def fl(e):
|
||||
chat = e.chat_id
|
||||
x = get_filter(int(chat))
|
||||
if x:
|
||||
if " " in xx:
|
||||
xx = xx.split(" ")
|
||||
kk = ""
|
||||
for c in xx:
|
||||
if c in x:
|
||||
k = get_reply(int(chat), c)
|
||||
if k:
|
||||
kk = k
|
||||
if kk:
|
||||
msg = k["msg"]
|
||||
media = k["media"]
|
||||
await e.reply(msg, file=media)
|
||||
|
||||
else:
|
||||
k = get_reply(chat, xx)
|
||||
if k:
|
||||
msg = k["msg"]
|
||||
media = k["media"]
|
||||
await e.reply(msg, file=media)
|
||||
for c in x:
|
||||
pat = r"( |^|[^\w])" + re.escape(c) + r"( |$|[^\w])"
|
||||
if re.search(pat, xx):
|
||||
k = get_reply(int(chat), c)
|
||||
if k:
|
||||
msg = k["msg"]
|
||||
media = k["media"]
|
||||
await e.reply(msg, file=media)
|
||||
|
||||
@@ -6,7 +6,13 @@
|
||||
To get list of fonts
|
||||
"""
|
||||
|
||||
from . import _default, _double_stroke, _monospace, _small_caps
|
||||
from resources.extras.fonts import (
|
||||
_default,
|
||||
_double_stroke,
|
||||
_monospace,
|
||||
_script_royal,
|
||||
_small_caps,
|
||||
)
|
||||
|
||||
fonts = ["small caps ", "monospace ", "double stroke ", "script royal"]
|
||||
|
||||
@@ -16,6 +22,7 @@ fonts = ["small caps ", "monospace ", "double stroke ", "script royal"]
|
||||
)
|
||||
async def _(e):
|
||||
input = e.pattern_match.group(1)
|
||||
reply = await e.get_reply_message()
|
||||
if not input:
|
||||
m = "**Available Fonts**\n\n"
|
||||
for x in fonts:
|
||||
@@ -23,9 +30,15 @@ async def _(e):
|
||||
return await eod(e, m)
|
||||
try:
|
||||
font = input.split(":", maxsplit=1)[0]
|
||||
text = input.split(":", maxsplit=1)[1]
|
||||
except BaseException:
|
||||
except IndexError:
|
||||
return await eod(e, "`fonts small caps : Your Message`")
|
||||
if reply:
|
||||
text = reply.message
|
||||
else:
|
||||
try:
|
||||
text = input.split(":", maxsplit=1)[1]
|
||||
except IndexError:
|
||||
return await eod(e, "`fonts small caps : Your Message`")
|
||||
if font not in fonts:
|
||||
return await eod(e, f"`{font} not in font list`.")
|
||||
if font == "small caps ":
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
import re
|
||||
|
||||
from pyUltroid.functions.forcesub_db import *
|
||||
from telethon import events
|
||||
from telethon.errors.rpcerrorlist import UserNotParticipantError
|
||||
from telethon.tl.custom import Button
|
||||
from telethon.tl.functions.channels import GetParticipantRequest
|
||||
@@ -35,28 +34,6 @@ from telethon.tl.functions.messages import ExportChatInviteRequest
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_bot.on(events.ChatAction())
|
||||
async def forcesub(ult):
|
||||
if not udB.get("FORCESUB"):
|
||||
return
|
||||
if not (ult.user_joined or ult.user_added):
|
||||
return
|
||||
if not get_forcesetting(ult.chat_id):
|
||||
return
|
||||
user = await ult.get_user()
|
||||
if user.bot:
|
||||
return
|
||||
joinchat = get_forcesetting(ult.chat_id)
|
||||
try:
|
||||
await ultroid_bot(GetParticipantRequest(int(joinchat), user.id))
|
||||
except UserNotParticipantError:
|
||||
await ultroid_bot.edit_permissions(ult.chat_id, user.id, send_messages=False)
|
||||
res = await ultroid_bot.inline_query(
|
||||
asst.me.username, f"fsub {user.id}_{joinchat}"
|
||||
)
|
||||
await res[0].click(ult.chat_id, reply_to=ult.action_message.id)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="fsub ?(.*)", admins_only=True, groups_only=True)
|
||||
async def addfor(e):
|
||||
match = e.pattern_match.group(1)
|
||||
@@ -70,7 +47,7 @@ async def addfor(e):
|
||||
except BaseException:
|
||||
return await eod(e, "Give Correct Channel Username or id")
|
||||
try:
|
||||
match = (await ultroid_bot.get_entity(ch)).id
|
||||
match = (await e.client.get_entity(ch)).id
|
||||
except BaseException:
|
||||
return await eod(e, "Give Correct Channel Username or id")
|
||||
if not str(match).startswith("-100"):
|
||||
@@ -92,7 +69,7 @@ async def getfsr(e):
|
||||
res = get_forcesetting(e.chat_id)
|
||||
if not res:
|
||||
return await eod(e, "ForceSub is Not Active In This Chat !")
|
||||
cha = await ultroid_bot.get_entity(int(res))
|
||||
cha = await e.client.get_entity(int(res))
|
||||
await eor(e, f"**ForceSub Status** : `Active`\n- **{cha.title}** `({res})`")
|
||||
|
||||
|
||||
@@ -101,12 +78,12 @@ async def getfsr(e):
|
||||
async def fcall(e):
|
||||
match = e.pattern_match.group(1)
|
||||
spli = match.split("_")
|
||||
user = await ultroid_bot.get_entity(int(spli[0]))
|
||||
cl = await ultroid_bot.get_entity(int(spli[1]))
|
||||
user = await e.client.get_entity(int(spli[0]))
|
||||
cl = await e.client.get_entity(int(spli[1]))
|
||||
text = f"Hi [{user.first_name}](tg://user?id={user.id}), You Need to Join"
|
||||
text += f" {cl.title} in order to Chat in this Group."
|
||||
if not cl.username:
|
||||
el = (await ultroid_bot(ExportChatInviteRequest(cl))).link
|
||||
el = (await e.client(ExportChatInviteRequest(cl))).link
|
||||
else:
|
||||
el = "https://t.me/" + cl.username
|
||||
res = [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -12,7 +11,6 @@
|
||||
Gadget Search from Telegram.
|
||||
|
||||
"""
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup as bs
|
||||
|
||||
@@ -44,8 +42,8 @@ async def mobs(e):
|
||||
ty = fp.findNext()
|
||||
out += f"- **{ty.text}** - `{ty.findNext().text}`\n"
|
||||
out += "_"
|
||||
await ultroid_bot.send_file(e.chat_id, file=imu, caption=out)
|
||||
if e.sender_id == ultroid_bot.uid:
|
||||
await e.reply(out, file=imu)
|
||||
if e.out:
|
||||
await bt.delete()
|
||||
except Exception as a:
|
||||
print(a)
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
• `{i}getaddons <raw link to code>`
|
||||
Load Plugins from the given raw link.
|
||||
"""
|
||||
|
||||
import requests
|
||||
from pyUltroid.utils import load_addons
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -39,7 +41,7 @@ async def get_the_addons_lol(event):
|
||||
shortname = name_of_it.split(".")[0]
|
||||
try:
|
||||
load_addons(shortname)
|
||||
await eod(xx, f"**Sᴜᴄᴄᴇssғᴜʟʟʏ Lᴏᴀᴅᴇᴅ** `{shortname}`", time=3)
|
||||
await eod(xx, f"**Sᴜᴄᴄᴇssғᴜʟʟʏ Lᴏᴀᴅᴇᴅ** `{shortname}`")
|
||||
except Exception as e:
|
||||
await eod(
|
||||
xx,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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
|
||||
|
||||
@@ -21,8 +20,6 @@
|
||||
•`{i}gif <query>`
|
||||
Send video regarding to query.
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
import random
|
||||
import time
|
||||
@@ -40,7 +37,7 @@ async def igif(e):
|
||||
if "gif" not in wut:
|
||||
return await eod(e, "`Reply To Gif Only`")
|
||||
xx = await eor(e, "`Processing...`")
|
||||
z = await ultroid_bot.download_media(a.media)
|
||||
z = await a.download_media()
|
||||
try:
|
||||
await bash(f'ffmpeg -i "{z}" -vf format=gray ult.gif -y')
|
||||
await e.client.send_file(e.chat_id, "ult.gif", support_stream=True)
|
||||
@@ -60,7 +57,7 @@ async def igif(e):
|
||||
if "gif" not in wut:
|
||||
return await eod(e, "`Reply To Gif Only`")
|
||||
xx = await eor(e, "`Processing...`")
|
||||
z = await ultroid_bot.download_media(a.media)
|
||||
z = await a.download_media()
|
||||
try:
|
||||
await bash(
|
||||
f'ffmpeg -i "{z}" -vf lutyuv="y=negval:u=negval:v=negval" ult.gif -y'
|
||||
@@ -84,9 +81,9 @@ async def gifs(ult):
|
||||
except BaseException:
|
||||
pass
|
||||
if not get:
|
||||
return await eor(ult, "`{i}gif <query>`")
|
||||
return await eor(ult, f"`{HNDLR}gif <query>`")
|
||||
m = await eor(ult, "`Searching gif ...`")
|
||||
gifs = await ultroid_bot.inline_query("gif", get)
|
||||
gifs = await ult.client.inline_query("gif", get)
|
||||
if not n:
|
||||
await gifs[xx].click(
|
||||
ult.chat.id, reply_to=ult.reply_to_msg_id, silent=True, hide_via=True
|
||||
@@ -111,7 +108,7 @@ async def vtogif(e):
|
||||
dur = a.media.document.attributes[0].duration
|
||||
tt = time.time()
|
||||
if int(dur) < 120:
|
||||
z = await ultroid_bot.download_media(a.media)
|
||||
z = await a.download_media()
|
||||
await bash(
|
||||
f'ffmpeg -i {z} -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ult.gif -y'
|
||||
)
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
# 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}github <username>`
|
||||
Get full information of the users github profile.
|
||||
"""
|
||||
|
||||
|
||||
import requests
|
||||
|
||||
from . import *
|
||||
@@ -59,9 +56,4 @@ async def gitsearch(event):
|
||||
**Following** - {ufollowing}
|
||||
"""
|
||||
await xx.delete()
|
||||
await ultroid_bot.send_file(
|
||||
event.chat_id,
|
||||
upic,
|
||||
caption=fullusr,
|
||||
link_preview=False,
|
||||
)
|
||||
await event.reply(fullusr, file=upic)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
@@ -13,7 +12,6 @@
|
||||
gives a glitchy gif.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from . import *
|
||||
@@ -28,12 +26,10 @@ async def _(e):
|
||||
if not wut.startswith(("pic", "sticker")):
|
||||
return await eor(e, "`Unsupported Media`")
|
||||
xx = await eor(e, "`Gliching...`")
|
||||
ok = await bot.download_media(reply.media)
|
||||
ok = await e.client.download_media(reply.media)
|
||||
cmd = f"glitch_me gif --line_count 200 -f 10 -d 50 '{ok}' ult.gif"
|
||||
stdout, stderr = await bash(cmd)
|
||||
await ultroid_bot.send_file(
|
||||
e.chat_id, "ult.gif", force_document=False, reply_to=reply
|
||||
)
|
||||
await e.reply(file="ult.gif", force_document=False)
|
||||
await xx.delete()
|
||||
os.remove(ok)
|
||||
os.remove("ult.gif")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -31,6 +30,12 @@
|
||||
• `{i}gucast <Message>`
|
||||
Globally Send that msg in all Ur Chat Users.
|
||||
|
||||
• `{i} gblacklist <chat id/username/nothing (for current chat)`
|
||||
Add chat to blacklist and not send global broadcasts there.
|
||||
|
||||
• `{i} ungblacklist <chat id/username/nothing (for current chat)`
|
||||
Remove the chat from blacklist adn continue sending global broadcasts there.
|
||||
|
||||
•`{i}gpromote <reply to user> <channel/group/all> <rank>`
|
||||
globally promote user where you are admin.
|
||||
You can also set where To promote only groups or only channels or in all.
|
||||
@@ -40,10 +45,10 @@
|
||||
•`{i}gdemote`
|
||||
Same function as gpromote.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from telethon import events
|
||||
from pyUltroid.functions.gban_mute_db import *
|
||||
from pyUltroid.functions.gcast_blacklist_db import *
|
||||
from telethon.tl.functions.channels import EditAdminRequest
|
||||
from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
|
||||
from telethon.tl.types import ChatAdminRights
|
||||
@@ -76,6 +81,7 @@ async def _(e):
|
||||
if not e.out and not is_fullsudo(e.sender_id):
|
||||
return await eod(e, "`This Command Is Sudo Restricted.`")
|
||||
x = e.pattern_match.group(1)
|
||||
ultroid_bot = e.client
|
||||
if not x:
|
||||
return await eod(e, "`Incorrect Format`")
|
||||
user = await e.get_reply_message()
|
||||
@@ -94,11 +100,11 @@ async def _(e):
|
||||
user.id = user.peer_id.user_id
|
||||
else:
|
||||
user.id = user.from_id.user_id
|
||||
async for x in ultroid_bot.iter_dialogs():
|
||||
async for x in e.client.iter_dialogs():
|
||||
if "group" in key.lower():
|
||||
if x.is_group:
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await e.client(
|
||||
EditAdminRequest(
|
||||
x.id,
|
||||
user.id,
|
||||
@@ -112,7 +118,7 @@ async def _(e):
|
||||
elif "channel" in key.lower():
|
||||
if x.is_channel:
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await e.client(
|
||||
EditAdminRequest(
|
||||
x.id,
|
||||
user.id,
|
||||
@@ -126,7 +132,7 @@ async def _(e):
|
||||
else:
|
||||
if x.is_group or x.is_channel:
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await e.client(
|
||||
EditAdminRequest(
|
||||
x.id,
|
||||
user.id,
|
||||
@@ -146,7 +152,7 @@ async def _(e):
|
||||
if user.isdigit():
|
||||
user = int(user)
|
||||
try:
|
||||
name = await ultroid_bot.get_entity(user)
|
||||
name = await e.client.get_entity(user)
|
||||
except BaseException:
|
||||
return await eod(e, f"`No User Found Regarding {user}`")
|
||||
ev = await eor(e, f"`Promoting {name.first_name} globally.`")
|
||||
@@ -158,7 +164,7 @@ async def _(e):
|
||||
if len(k) > 3:
|
||||
rank = k[3]
|
||||
c = 0
|
||||
async for x in ultroid_bot.iter_dialogs():
|
||||
async for x in e.client.iter_dialogs():
|
||||
if "group" in key.lower():
|
||||
if x.is_group:
|
||||
try:
|
||||
@@ -211,6 +217,7 @@ async def _(e):
|
||||
if not e.out and not is_fullsudo(e.sender_id):
|
||||
return await eod(e, "`This Command Is Sudo Restricted.`")
|
||||
x = e.pattern_match.group(1)
|
||||
ultroid_bot = e.client
|
||||
if not x:
|
||||
return await eod(e, "`Incorrect Format`")
|
||||
user = await e.get_reply_message()
|
||||
@@ -227,7 +234,7 @@ async def _(e):
|
||||
key = ok[1]
|
||||
rank = "Not AdMin"
|
||||
c = 0
|
||||
async for x in ultroid_bot.iter_dialogs():
|
||||
async for x in e.client.iter_dialogs():
|
||||
if "group" in key.lower():
|
||||
if x.is_group:
|
||||
try:
|
||||
@@ -444,14 +451,15 @@ async def gcast(event):
|
||||
kk = await eor(event, "`Globally Broadcasting Msg...`")
|
||||
er = 0
|
||||
done = 0
|
||||
async for x in ultroid_bot.iter_dialogs():
|
||||
async for x in event.client.iter_dialogs():
|
||||
if x.is_group:
|
||||
chat = x.id
|
||||
try:
|
||||
done += 1
|
||||
await ultroid_bot.send_message(chat, msg)
|
||||
except BaseException:
|
||||
er += 1
|
||||
if not is_gblacklisted(chat):
|
||||
try:
|
||||
done += 1
|
||||
await ultroid_bot.send_message(chat, msg)
|
||||
except BaseException:
|
||||
er += 1
|
||||
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
||||
|
||||
|
||||
@@ -469,14 +477,15 @@ async def gucast(event):
|
||||
kk = await eor(event, "`Globally Broadcasting Msg...`")
|
||||
er = 0
|
||||
done = 0
|
||||
async for x in ultroid_bot.iter_dialogs():
|
||||
async for x in event.client.iter_dialogs():
|
||||
if x.is_user and not x.entity.bot:
|
||||
chat = x.id
|
||||
try:
|
||||
done += 1
|
||||
await ultroid_bot.send_message(chat, msg)
|
||||
except BaseException:
|
||||
er += 1
|
||||
if not is_gblacklisted(chat):
|
||||
try:
|
||||
done += 1
|
||||
await ultroid_bot.send_message(chat, msg)
|
||||
except BaseException:
|
||||
er += 1
|
||||
await kk.edit(f"Done in {done} chats, error in {er} chat(s)")
|
||||
|
||||
|
||||
@@ -502,7 +511,7 @@ async def gkick(e):
|
||||
async for gkick in e.client.iter_dialogs():
|
||||
if gkick.is_group or gkick.is_channel:
|
||||
try:
|
||||
await ultroid_bot.kick_participant(gkick.id, userid)
|
||||
await e.client.kick_participant(gkick.id, userid)
|
||||
chats += 1
|
||||
except BaseException:
|
||||
pass
|
||||
@@ -571,29 +580,6 @@ async def _(e):
|
||||
await xx.edit(f"`Ungmuted` [{name}](tg://user?id={userid}) `in {chats} chats.`")
|
||||
|
||||
|
||||
@ultroid_bot.on(events.ChatAction)
|
||||
async def _(e):
|
||||
if e.user_joined or e.added_by:
|
||||
user = await e.get_user()
|
||||
chat = await e.get_chat()
|
||||
if is_gbanned(str(user.id)):
|
||||
if chat.admin_rights:
|
||||
try:
|
||||
await e.client.edit_permissions(
|
||||
chat.id,
|
||||
user.id,
|
||||
view_messages=False,
|
||||
)
|
||||
reason = get_gban_reason(user.id)
|
||||
gban_watch = f"#GBanned_User Joined.\n\n**User** - [{user.first_name}](tg://user?id={user.id})\n"
|
||||
if reason is not None:
|
||||
gban_watch += f"**Reason**: {reason}\n\n"
|
||||
gban_watch += f"`User Banned.`"
|
||||
await e.reply(gban_watch)
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="listgban",
|
||||
)
|
||||
@@ -621,7 +607,7 @@ async def list_gengbanned(event):
|
||||
f.close()
|
||||
await x.reply(
|
||||
file="gbanned.txt",
|
||||
caption=f"List of users GBanned by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
|
||||
message=f"List of users GBanned by [{OWNER_NAME}](tg://user?id={OWNER_ID})",
|
||||
)
|
||||
os.remove("gbanned.txt")
|
||||
await x.delete()
|
||||
@@ -664,3 +650,30 @@ async def gstat_(e):
|
||||
else:
|
||||
msg += "not Globally Banned.**"
|
||||
await xx.edit(msg)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="gblacklist")
|
||||
async def blacklist_(event):
|
||||
await gblacker(event, "add")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="ungblacklist")
|
||||
async def ungblacker(event):
|
||||
await glacker(event, "remove")
|
||||
|
||||
|
||||
async def gblacker(event, type_):
|
||||
chat = (await event.get_chat()).id
|
||||
try:
|
||||
chat = int(event.text.split(" ", 1)[1])
|
||||
except IndexError:
|
||||
pass
|
||||
try:
|
||||
chat_id = (await ultroid.get_entity(chat)).id
|
||||
except Exception as e:
|
||||
return await eor(event, "**ERROR**\n`{}`".format(str(e)))
|
||||
if type_ == "add":
|
||||
add_gblacklist(chat_id)
|
||||
elif type_ == "remove":
|
||||
rem_gblacklist(chat_id)
|
||||
await eor(event, "Global Broadcasts: \n{}ed {}".format(type_, chat))
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -18,7 +17,6 @@
|
||||
• `{i}reverse <query>`
|
||||
Reply an Image or sticker to find its sauce.
|
||||
"""
|
||||
|
||||
import os
|
||||
from shutil import rmtree
|
||||
|
||||
@@ -34,7 +32,7 @@ from strings import get_string
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="google ?(.*)")
|
||||
@ultroid_cmd(pattern="google ?(.*)", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def google(event):
|
||||
inp = event.pattern_match.group(1)
|
||||
if not inp:
|
||||
@@ -46,17 +44,20 @@ async def google(event):
|
||||
except GoglError as e:
|
||||
return await eor(event, str(e))
|
||||
out = ""
|
||||
for i in range(len(res["links"])):
|
||||
text = res["titles"][i]
|
||||
url = res["links"][i]
|
||||
des = res["descriptions"][i]
|
||||
out += f" 👉🏻 [{text}]({url})\n`{des}`\n\n"
|
||||
try:
|
||||
for i in range(len(res["links"])):
|
||||
text = res["titles"][i]
|
||||
url = res["links"][i]
|
||||
des = res["descriptions"][i]
|
||||
out += f" 👉🏻 [{text}]({url})\n`{des}`\n\n"
|
||||
except TypeError:
|
||||
return await eod(event, f"`Can't find anything about {inp}`")
|
||||
omk = f"**Google Search Query:**\n`{inp}`\n\n**Results:**\n{out}"
|
||||
opn = []
|
||||
for bkl in range(0, len(omk), 4095):
|
||||
opn.append(omk[bkl : bkl + 4095])
|
||||
for bc in opn:
|
||||
await ultroid_bot.send_message(event.chat_id, bc, link_preview=False)
|
||||
await event.respond(bc, link_preview=False)
|
||||
await x.delete()
|
||||
opn.clear()
|
||||
|
||||
@@ -86,7 +87,7 @@ async def goimg(event):
|
||||
ok = pth[0][query]
|
||||
except BaseException:
|
||||
return await nn.edit("No Results Found :(")
|
||||
await event.client.send_file(event.chat_id, ok, caption=query, album=True)
|
||||
await event.reply(file=ok, message=query, album=True)
|
||||
rmtree(f"./resources/downloads/{query}/")
|
||||
await nn.delete()
|
||||
|
||||
@@ -97,7 +98,7 @@ async def reverse(event):
|
||||
if not reply:
|
||||
return await eor(event, "`Reply to an Image`")
|
||||
ult = await eor(event, "`Processing...`")
|
||||
dl = await bot.download_media(reply)
|
||||
dl = await reply.download_media()
|
||||
img = Image.open(dl)
|
||||
x, y = img.size
|
||||
file = {"encoded_image": (dl, open(dl, "rb"))}
|
||||
|
||||
@@ -28,12 +28,14 @@
|
||||
• `{i}getgoodbye`
|
||||
Get the goodbye message in the current chat.
|
||||
|
||||
• `{i}thankmembers on/off`
|
||||
Send a thank you sticker on hitting a members count of 100*x in your groups.
|
||||
"""
|
||||
import os
|
||||
|
||||
from pyUltroid.functions.greetings_db import *
|
||||
from telegraph import upload_file as uf
|
||||
from telethon.utils import get_display_name, pack_bot_file_id
|
||||
from telethon.utils import pack_bot_file_id
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -49,7 +51,7 @@ async def setwel(event):
|
||||
if r and r.media:
|
||||
wut = mediainfo(r.media)
|
||||
if wut.startswith(("pic", "gif")):
|
||||
dl = await bot.download_media(r.media)
|
||||
dl = await r.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -57,7 +59,7 @@ async def setwel(event):
|
||||
if r.media.document.size > 8 * 1000 * 1000:
|
||||
return await eod(x, "`Unsupported Media`")
|
||||
else:
|
||||
dl = await bot.download_media(r.media)
|
||||
dl = await r.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -105,7 +107,7 @@ async def setgb(event):
|
||||
if r and r.media:
|
||||
wut = mediainfo(r.media)
|
||||
if wut.startswith(("pic", "gif")):
|
||||
dl = await bot.download_media(r.media)
|
||||
dl = await r.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -113,7 +115,7 @@ async def setgb(event):
|
||||
if r.media.document.size > 8 * 1000 * 1000:
|
||||
return await eod(x, "`Unsupported Media`")
|
||||
else:
|
||||
dl = await bot.download_media(r.media)
|
||||
dl = await r.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -152,84 +154,23 @@ async def listgd(event):
|
||||
await event.delete()
|
||||
|
||||
|
||||
@ultroid_bot.on(events.ChatAction())
|
||||
async def _(event):
|
||||
if event.user_left or event.user_kicked:
|
||||
wel = get_goodbye(event.chat_id)
|
||||
if wel:
|
||||
user = await event.get_user()
|
||||
chat = await event.get_chat()
|
||||
title = chat.title if chat.title else "this chat"
|
||||
pp = await event.client.get_participants(chat)
|
||||
count = len(pp)
|
||||
mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
|
||||
name = user.first_name
|
||||
last = user.last_name
|
||||
if last:
|
||||
fullname = f"{name} {last}"
|
||||
else:
|
||||
fullname = name
|
||||
uu = user.username
|
||||
if uu:
|
||||
username = f"@{uu}"
|
||||
else:
|
||||
username = mention
|
||||
msgg = wel["goodbye"]
|
||||
med = wel["media"]
|
||||
userid = user.id
|
||||
if msgg:
|
||||
await event.reply(
|
||||
msgg.format(
|
||||
mention=mention,
|
||||
group=title,
|
||||
count=count,
|
||||
name=name,
|
||||
fullname=fullname,
|
||||
username=username,
|
||||
userid=userid,
|
||||
),
|
||||
file=med,
|
||||
)
|
||||
else:
|
||||
await event.reply(file=med)
|
||||
elif event.user_joined or event.user_added:
|
||||
wel = get_welcome(event.chat_id)
|
||||
if wel:
|
||||
user = await event.get_user()
|
||||
chat = await event.get_chat()
|
||||
title = chat.title if chat.title else "this chat"
|
||||
pp = await event.client.get_participants(chat)
|
||||
count = len(pp)
|
||||
mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
|
||||
name = user.first_name
|
||||
last = user.last_name
|
||||
if last:
|
||||
fullname = f"{name} {last}"
|
||||
else:
|
||||
fullname = name
|
||||
uu = user.username
|
||||
if uu:
|
||||
username = f"@{uu}"
|
||||
else:
|
||||
username = mention
|
||||
msgg = wel["welcome"]
|
||||
med = wel["media"]
|
||||
userid = user.id
|
||||
if msgg:
|
||||
await event.reply(
|
||||
msgg.format(
|
||||
mention=mention,
|
||||
group=title,
|
||||
count=count,
|
||||
name=name,
|
||||
fullname=fullname,
|
||||
username=username,
|
||||
userid=userid,
|
||||
),
|
||||
file=med,
|
||||
)
|
||||
else:
|
||||
await event.reply(file=med)
|
||||
|
||||
|
||||
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}" + Note})
|
||||
@ultroid_cmd(pattern="thankmembers (on|off)")
|
||||
async def thank_set(event):
|
||||
type_ = event.pattern_match.group(1)
|
||||
if not type_ or type_ == "":
|
||||
await eor(
|
||||
event,
|
||||
f"**Current Chat Settings:**\n**Thanking Members:** `{must_thank(event.chat_id)}`\n\nUse `{hndlr}thankmembers on` or `{hndlr}thankmembers off` to toggle current settings!",
|
||||
)
|
||||
return
|
||||
chat = event.chat_id
|
||||
if not str(chat).startswith("-"):
|
||||
return await eod(event, "`Please use this command in a group!`", time=10)
|
||||
if type_.lower() == "on":
|
||||
add_thanks(chat)
|
||||
elif type_.lower() == "off":
|
||||
remove_thanks(chat)
|
||||
await eor(
|
||||
event,
|
||||
f"**Done! Thank you members has been turned** `{type_.lower()}` **for this chat**!",
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -17,8 +16,6 @@
|
||||
• `{i}rmusers`
|
||||
Remove users specifically.
|
||||
"""
|
||||
|
||||
|
||||
from telethon.tl.functions.channels import EditBannedRequest, EditPhotoRequest
|
||||
from telethon.tl.types import (
|
||||
ChannelParticipantsKicked,
|
||||
@@ -39,12 +36,15 @@ async def _(ult):
|
||||
if not ult.is_reply:
|
||||
return await eod(ult, "`Reply to a Media..`")
|
||||
reply_message = await ult.get_reply_message()
|
||||
replfile = await reply_message.download_media()
|
||||
file = await ultroid_bot.upload_file(replfile)
|
||||
try:
|
||||
replfile = await reply_message.download_media()
|
||||
except AttributeError:
|
||||
return await eor(ult, "Reply to a Photo..")
|
||||
file = await ult.client.upload_file(replfile)
|
||||
mediain = mediainfo(reply_message.media)
|
||||
try:
|
||||
if "pic" in mediain:
|
||||
await ultroid_bot(EditPhotoRequest(ult.chat_id, file))
|
||||
await ult.client(EditPhotoRequest(ult.chat_id, file))
|
||||
else:
|
||||
return await eod(ult, "`Invalid MEDIA Type !`")
|
||||
await eod(ult, "`Group Photo has Successfully Changed !`")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -45,7 +44,6 @@
|
||||
example : `{i}csample red`
|
||||
`{i}csample #ffffff`
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
@@ -97,7 +95,7 @@ async def sketch(e):
|
||||
inverted_blurred_img = 255 - blurred_img
|
||||
pencil_sketch_IMG = cv2.divide(gray_image, inverted_blurred_img, scale=256.0)
|
||||
cv2.imwrite("ultroid.png", pencil_sketch_IMG)
|
||||
await e.client.send_file(e.chat_id, file="ultroid.png")
|
||||
await e.reply(file="ultroid.png")
|
||||
await xx.delete()
|
||||
os.remove(file)
|
||||
os.remove("ultroid.png")
|
||||
@@ -109,7 +107,7 @@ async def _(event):
|
||||
if not reply.media:
|
||||
return await eor(event, "`Reply To a Black nd White Image`")
|
||||
xx = await eor(event, "`Coloring image 🎨🖌️...`")
|
||||
image = await ultroid_bot.download_media(reply.media)
|
||||
image = await reply.download_media()
|
||||
img = cv2.VideoCapture(image)
|
||||
ret, frame = img.read()
|
||||
cv2.imwrite("ult.jpg", frame)
|
||||
@@ -129,7 +127,7 @@ async def _(event):
|
||||
r.json()["status"] + "\nGet api nd set `{i}setredis DEEP_API key`"
|
||||
)
|
||||
r_json = r.json()["output_url"]
|
||||
await ultroid_bot.send_file(event.chat_id, r_json, reply_to=reply)
|
||||
await event.client.send_file(event.chat_id, r_json, reply_to=reply)
|
||||
await xx.delete()
|
||||
|
||||
|
||||
@@ -509,7 +507,7 @@ async def sampl(ult):
|
||||
try:
|
||||
try:
|
||||
await ult.delete()
|
||||
await ultroid_bot.send_message(
|
||||
await ult.client.send_message(
|
||||
ult.chat_id, f"Colour Sample for `{color}` !", file="csample.png"
|
||||
)
|
||||
except MessageDeleteForbiddenError:
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -15,34 +14,45 @@
|
||||
UNLOCK the Used Setting in Used Group.
|
||||
|
||||
"""
|
||||
|
||||
from pyUltroid.functions.all import lucks, unlucks
|
||||
from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="lock ?(.*)", groups_only=True, admins_only=True)
|
||||
@ultroid_cmd(
|
||||
pattern="lock ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def lockho(e):
|
||||
mat = e.pattern_match.group(1)
|
||||
if not mat:
|
||||
return await eod(e, "`What to Lock ?`")
|
||||
return await eod(e, "`Give some Proper Input..`")
|
||||
try:
|
||||
ml = lucks(mat)
|
||||
except BaseException:
|
||||
return await eod(e, "`Incorrect Input`")
|
||||
await ultroid_bot(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
|
||||
await e.client(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
|
||||
await eor(e, f"Locked - `{mat}` ! ")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="unlock ?(.*)", groups_only=True, admins_only=True)
|
||||
@ultroid_cmd(
|
||||
pattern="unlock ?(.*)",
|
||||
groups_only=True,
|
||||
admins_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def unlckho(e):
|
||||
mat = e.pattern_match.group(1)
|
||||
if not mat:
|
||||
return await eod(e, "`What to Lock ?`")
|
||||
return await eod(e, "`Give some Proper Input..`")
|
||||
try:
|
||||
ml = unlucks(mat)
|
||||
except BaseException:
|
||||
return await eod(e, "`Incorrect Input`")
|
||||
await ultroid_bot(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
|
||||
await e.client(EditChatDefaultBannedRightsRequest(e.chat_id, ml))
|
||||
await eor(e, f"Unlocked - `{mat}` ! ")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -14,7 +13,6 @@
|
||||
Or Reply To Font File, To write with that font.
|
||||
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import random
|
||||
@@ -44,7 +42,7 @@ async def logo_gen(event):
|
||||
bg_ = await temp.download_media()
|
||||
else:
|
||||
pics = []
|
||||
async for i in ultroid.iter_messages(
|
||||
async for i in event.client.iter_messages(
|
||||
"@UltroidLogos", filter=InputMessagesFilterPhotos
|
||||
):
|
||||
pics.append(i)
|
||||
@@ -54,7 +52,7 @@ async def logo_gen(event):
|
||||
font_ = random.choice(fpath_)
|
||||
if not bg_:
|
||||
pics = []
|
||||
async for i in ultroid.iter_messages(
|
||||
async for i in event.client.iter_messages(
|
||||
"@UltroidLogos", filter=InputMessagesFilterPhotos
|
||||
):
|
||||
pics.append(i)
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
# 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}mediainfo <reply to media>`
|
||||
To get info about it.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime as dt
|
||||
@@ -47,7 +45,7 @@ async def mi(e):
|
||||
)
|
||||
naam = dl.name
|
||||
else:
|
||||
naam = await ultroid_bot.download_media(r.media)
|
||||
naam = await r.download_media()
|
||||
out, er = await bash(f"mediainfo '{naam}' --Output=HTML")
|
||||
urll = make_html_telegraph("Mediainfo", "Ultroid", out)
|
||||
if er:
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
# 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}megadl <link>`
|
||||
It Downloads and Upload Files from mega.nz links.
|
||||
"""
|
||||
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
@@ -35,7 +33,7 @@ async def _(e):
|
||||
for kk in ok:
|
||||
try:
|
||||
res = await uploader(kk, kk, tt, xx, "Uploading...")
|
||||
await ultroid_bot.send_file(
|
||||
await e.client.send_file(
|
||||
e.chat_id,
|
||||
res,
|
||||
caption="`" + kk.split("/")[-1] + "`",
|
||||
@@ -53,7 +51,7 @@ async def _(e):
|
||||
fp = os.path.join(path, f)
|
||||
size += os.path.getsize(fp)
|
||||
await xx.delete()
|
||||
await ultroid_bot.send_message(
|
||||
await e.client.send_message(
|
||||
e.chat_id,
|
||||
f"Downloaded And Uploaded Total - `{c}` files of `{humanbytes(size)}` in `{t}`",
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -27,8 +26,6 @@
|
||||
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
|
||||
@@ -74,9 +71,7 @@ async def startmute(event):
|
||||
pass
|
||||
else:
|
||||
return await eor(xx, "`No proper admin rights...`", time=5)
|
||||
elif "creator" in vars(chat):
|
||||
pass
|
||||
elif private:
|
||||
elif "creator" in vars(chat) or private:
|
||||
pass
|
||||
else:
|
||||
return await eod(xx, "`No proper admin rights...`", time=5)
|
||||
@@ -90,7 +85,7 @@ async def startmute(event):
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="undmute ?(.*)",
|
||||
pattern="undmute ?(.*)", type=["official", "manager"], ignore_dualmode=True
|
||||
)
|
||||
async def endmute(event):
|
||||
xx = await eor(event, "`Unmuting...`")
|
||||
@@ -125,6 +120,8 @@ async def endmute(event):
|
||||
@ultroid_cmd(
|
||||
pattern="tmute",
|
||||
groups_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Muting...`")
|
||||
@@ -175,6 +172,8 @@ async def _(e):
|
||||
@ultroid_cmd(
|
||||
pattern="unmute ?(.*)",
|
||||
groups_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Unmuting...`")
|
||||
@@ -214,6 +213,8 @@ async def _(e):
|
||||
@ultroid_cmd(
|
||||
pattern="mute ?(.*)",
|
||||
groups_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def _(e):
|
||||
xx = await eor(e, "`Muting...`")
|
||||
@@ -246,7 +247,6 @@ async def _(e):
|
||||
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)}`")
|
||||
|
||||
158
plugins/nightmode.py
Normal file
158
plugins/nightmode.py
Normal file
@@ -0,0 +1,158 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 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 -
|
||||
|
||||
At Night it will turn off everyone permission to send message in an all groups which you added via `{i}addnight`
|
||||
And Turn On auto at morning
|
||||
|
||||
• `{i}addnm`
|
||||
Add NightMode
|
||||
To Add Group To Auto Night Mode.
|
||||
|
||||
• `{i}remnm`
|
||||
Remove NightMode
|
||||
To remove Group From Auto Night Mode
|
||||
|
||||
• `{i}listnm`
|
||||
List NightMode
|
||||
To Get All List of Groups where NightMode Active.
|
||||
|
||||
• `{i}nmtime <close hour> <close min> <open hour> <open min>
|
||||
NightMode Time
|
||||
By Default Its close 00:00 , open 07:00
|
||||
Use 24hr format
|
||||
Ex- `nmtime 01 00 06 30`
|
||||
"""
|
||||
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from pyUltroid.functions.night_db import *
|
||||
from telethon.tl.functions.messages import EditChatDefaultBannedRightsRequest
|
||||
from telethon.tl.types import ChatBannedRights
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="nmtime ?(.*)")
|
||||
async def set_time(e):
|
||||
if not e.pattern_match.group(1):
|
||||
return await eor(e, "Give Time in correct format")
|
||||
try:
|
||||
ok = e.text.split(maxsplit=1)[1].split()
|
||||
if not len(ok) == 4:
|
||||
return await eor(e, "Give Time in correct format")
|
||||
tm = []
|
||||
for x in ok:
|
||||
tm.append(int(x))
|
||||
udB.set("NIGHT_TIME", str(tm))
|
||||
await eor(e, "Setted time successfully")
|
||||
except BaseException:
|
||||
await eor(e, "Give Time in correct format")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="addnm ?(.*)")
|
||||
async def add_grp(e):
|
||||
pat = e.pattern_match.group(1)
|
||||
if pat:
|
||||
try:
|
||||
add_night((await bot.get_entity(pat)).id)
|
||||
return await eor(e, f"Done, Added {pat} To Night Mode.")
|
||||
except BaseException:
|
||||
return await eod(e, "Something Went Wrong")
|
||||
add_night(e.chat_id)
|
||||
await eor(e, "Done, Added Current Chat To Night Mode")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="remnm ?(.*)")
|
||||
async def rem_grp(e):
|
||||
pat = e.pattern_match.group(1)
|
||||
if pat:
|
||||
try:
|
||||
rem_night((await bot.get_entity(pat)).id)
|
||||
return await eor(e, f"Done, Removed {pat} To Night Mode.")
|
||||
except BaseException:
|
||||
return await eod(e, "Something Went Wrong")
|
||||
rem_night(e.chat_id)
|
||||
await eor(e, "Done, Added Current Chat To Night Mode")
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listnm$")
|
||||
async def rem_grp(e):
|
||||
chats = night_grps()
|
||||
name = "NightMode Groups Are-:\n\n"
|
||||
for x in chats:
|
||||
try:
|
||||
ok = await ultroid_bot.get_entity(x)
|
||||
if ok.username:
|
||||
name += "@" + ok.username
|
||||
else:
|
||||
name += ok.title
|
||||
except BaseException:
|
||||
name += str(x)
|
||||
await eor(e, name)
|
||||
|
||||
|
||||
async def open_grp():
|
||||
chats = night_grps()
|
||||
for chat in chats:
|
||||
try:
|
||||
await ultroid_bot(
|
||||
EditChatDefaultBannedRightsRequest(
|
||||
chat,
|
||||
banned_rights=ChatBannedRights(
|
||||
until_date=None,
|
||||
send_messages=False,
|
||||
send_media=False,
|
||||
send_stickers=False,
|
||||
send_gifs=False,
|
||||
send_games=False,
|
||||
send_inline=False,
|
||||
send_polls=False,
|
||||
),
|
||||
)
|
||||
)
|
||||
await ultroid_bot.send_message(chat, "**NightMode Off**\n\nGroup Opened 🥳.")
|
||||
except Exception as er:
|
||||
LOGS.info(er)
|
||||
|
||||
|
||||
async def close_grp():
|
||||
chats = night_grps()
|
||||
h1, m1, h2, m2 = 0, 0, 7, 0
|
||||
if udB.get("NIGHT_TIME"):
|
||||
h1, m1, h2, m2 = eval(udB["NIGHT_TIME"])
|
||||
for chat in chats:
|
||||
try:
|
||||
await ultroid_bot(
|
||||
EditChatDefaultBannedRightsRequest(
|
||||
chat,
|
||||
banned_rights=ChatBannedRights(
|
||||
until_date=None,
|
||||
send_messages=True,
|
||||
),
|
||||
)
|
||||
)
|
||||
await ultroid_bot.send_message(
|
||||
chat, f"**NightMode : Group Closed**\n\nGroup Will Open At `{h2}:{m2}`"
|
||||
)
|
||||
except Exception as er:
|
||||
LOGS.info(er)
|
||||
|
||||
|
||||
if night_grps():
|
||||
try:
|
||||
h1, m1, h2, m2 = 0, 0, 7, 0
|
||||
if udB.get("NIGHT_TIME"):
|
||||
h1, m1, h2, m2 = eval(udB["NIGHT_TIME"])
|
||||
sch = AsyncIOScheduler()
|
||||
sch.add_job(close_grp, trigger="cron", hour=h1, minute=m1)
|
||||
sch.add_job(open_grp, trigger="cron", hour=h2, minute=m2)
|
||||
sch.start()
|
||||
except Exception as er:
|
||||
LOGS.info(er)
|
||||
@@ -42,7 +42,7 @@ async def an(e):
|
||||
if wt and wt.media:
|
||||
wut = mediainfo(wt.media)
|
||||
if wut.startswith(("pic", "gif")):
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await wt.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -50,7 +50,7 @@ async def an(e):
|
||||
if wt.media.document.size > 8 * 1000 * 1000:
|
||||
return await eod(x, "`Unsupported Media`")
|
||||
else:
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await wt.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
|
||||
@@ -9,16 +9,17 @@
|
||||
✘ Commands Available -
|
||||
|
||||
•`{i}addnsfw <ban/mute/kick>`
|
||||
If someone sends 18+ content it will delete and takes action.
|
||||
If someone sends 18+ content it will be deleted and action will be taken.
|
||||
|
||||
•`{i}remnsfw`
|
||||
Remove Chat from nsfw filter.
|
||||
Remove Chat from nsfw filtering.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import requests
|
||||
from ProfanityDetector import detector
|
||||
from pyUltroid.functions.nsfw_db import *
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -54,7 +55,7 @@ async def checknsfw(e):
|
||||
if action and udB.get("DEEP_API") and e.media:
|
||||
pic, name, nsfw = "", "", 0
|
||||
try:
|
||||
pic = await ultroid_bot.download_media(e.media, thumb=-1)
|
||||
pic = await e.download_media(thumb=-1)
|
||||
except BaseException:
|
||||
pass
|
||||
if e.file:
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -25,7 +24,6 @@
|
||||
• `{i}pdsend `
|
||||
Merge nd send the Pdf to collected from .pdsave.
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
@@ -38,6 +36,7 @@ import PIL
|
||||
from imutils.perspective import four_point_transform
|
||||
from PyPDF2 import PdfFileMerger, PdfFileReader, PdfFileWriter
|
||||
from skimage.filters import threshold_local
|
||||
from telethon.errors.rpcerrorlist import PhotoSaveFileInvalidError
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -90,10 +89,8 @@ async def pdfseimg(event):
|
||||
pw.addPage(pdf.getPage(o))
|
||||
with open(os.path.join("ult.png"), "wb") as f:
|
||||
pw.write(f)
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
"ult.png",
|
||||
reply_to=event.reply_to_msg_id,
|
||||
await event.reply(
|
||||
file="ult.png",
|
||||
)
|
||||
os.remove("ult.png")
|
||||
os.remove(pdfp)
|
||||
@@ -104,11 +101,10 @@ async def pdfseimg(event):
|
||||
with open(os.path.join("ult.png"), "wb") as f:
|
||||
pw.write(f)
|
||||
os.remove(pdfp)
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
"ult.png",
|
||||
reply_to=event.reply_to_msg_id,
|
||||
)
|
||||
try:
|
||||
await event.reply(file="ult.png")
|
||||
except PhotoSaveFileInvalidError:
|
||||
await event.reply(file="ult.png", force_document=True)
|
||||
os.remove("ult.png")
|
||||
|
||||
|
||||
@@ -299,7 +295,7 @@ async def savepdf(event):
|
||||
os.remove("o.png")
|
||||
elif ultt.endswith(".pdf"):
|
||||
a = dani_ck("pdf/scan.pdf")
|
||||
await ultroid_bot.download_media(ok, a)
|
||||
await event.client.download_media(ok, a)
|
||||
await eor(
|
||||
event,
|
||||
f"Done, Now Reply Another Image/pdf if completed then use {hndlr}pdsend to merge nd send all as pdf",
|
||||
|
||||
@@ -34,12 +34,17 @@
|
||||
|
||||
• `{i}cleararchive`
|
||||
Unarchive all chats.
|
||||
|
||||
• `{i}listapproved`
|
||||
List all approved PMs.
|
||||
"""
|
||||
|
||||
import re
|
||||
from os import remove
|
||||
|
||||
from pyUltroid.functions.logusers_db import *
|
||||
from pyUltroid.functions.pmpermit_db import *
|
||||
from tabulate import tabulate
|
||||
from telethon import events
|
||||
from telethon.tl.functions.contacts import BlockRequest, UnblockRequest
|
||||
from telethon.tl.functions.messages import ReportSpamRequest
|
||||
@@ -50,6 +55,8 @@ from . import *
|
||||
# ========================= CONSTANTS =============================
|
||||
COUNT_PM = {}
|
||||
LASTMSG = {}
|
||||
WARN_MSGS = {}
|
||||
U_WARNS = {}
|
||||
if Redis("PMPIC"):
|
||||
PMPIC = Redis("PMPIC")
|
||||
else:
|
||||
@@ -60,13 +67,16 @@ UND = get_string("pmperm_1")
|
||||
if not Redis("PM_TEXT"):
|
||||
UNAPPROVED_MSG = """
|
||||
**PMSecurity of {ON}!**
|
||||
|
||||
{UND}
|
||||
|
||||
You have {warn}/{twarn} warnings!"""
|
||||
else:
|
||||
UNAPPROVED_MSG = (
|
||||
"""
|
||||
**PMSecurity of {ON}!**"""
|
||||
f"""
|
||||
|
||||
{Redis("PM_TEXT")}
|
||||
"""
|
||||
"""
|
||||
@@ -93,6 +103,16 @@ PMCMDS = [
|
||||
]
|
||||
|
||||
_not_approved = {}
|
||||
sett = Redis("PMSETTING")
|
||||
if not sett:
|
||||
sett = "False"
|
||||
t_in = udB.get("INLINE_PM")
|
||||
inline_pm = "True"
|
||||
if not t_in or t_in == "True":
|
||||
inline_pm = "True"
|
||||
elif t_in == "False":
|
||||
inline_pm = "False"
|
||||
my_bot = asst.me.username
|
||||
# =================================================================
|
||||
|
||||
|
||||
@@ -102,12 +122,12 @@ _not_approved = {}
|
||||
async def _(e):
|
||||
if not e.is_private:
|
||||
return await eod(e, "`Use me in Private.`", time=3)
|
||||
if is_logger(str(e.chat_id)):
|
||||
nolog_user(str(e.chat_id))
|
||||
return await eod(e, "`Now I Will log msgs from here.`", time=3)
|
||||
else:
|
||||
if not is_logger(str(e.chat_id)):
|
||||
return await eod(e, "`Wasn't logging msgs from here.`", time=3)
|
||||
|
||||
nolog_user(str(e.chat_id))
|
||||
return await eod(e, "`Now I Will log msgs from here.`", time=3)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="nologpm$",
|
||||
@@ -115,12 +135,12 @@ async def _(e):
|
||||
async def _(e):
|
||||
if not e.is_private:
|
||||
return await eod(e, "`Use me in Private.`", time=3)
|
||||
if not is_logger(str(e.chat_id)):
|
||||
log_user(str(e.chat_id))
|
||||
return await eod(e, "`Now I Won't log msgs from here.`", time=3)
|
||||
else:
|
||||
if is_logger(str(e.chat_id)):
|
||||
return await eod(e, "`Wasn't logging msgs from here.`", time=3)
|
||||
|
||||
log_user(str(e.chat_id))
|
||||
return await eod(e, "`Now I Won't log msgs from here.`", time=3)
|
||||
|
||||
|
||||
@ultroid_bot.on(
|
||||
events.NewMessage(
|
||||
@@ -141,9 +161,6 @@ async def permitpm(event):
|
||||
await event.forward_to(int(udB.get("LOG_CHANNEL")))
|
||||
|
||||
|
||||
sett = Redis("PMSETTING")
|
||||
if sett is None:
|
||||
sett = True
|
||||
if sett == "True":
|
||||
|
||||
@ultroid_bot.on(
|
||||
@@ -163,10 +180,7 @@ if sett == "True":
|
||||
return
|
||||
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()
|
||||
async for message in e.client.iter_messages(e.chat_id, search=UNS):
|
||||
await message.delete()
|
||||
await delete_pm_warn_msgs(e.chat_id)
|
||||
try:
|
||||
await ultroid_bot.edit_folder(e.chat_id, folder=0)
|
||||
except BaseException:
|
||||
@@ -200,10 +214,7 @@ if sett == "True":
|
||||
if event.media:
|
||||
await event.delete()
|
||||
name = user.first_name
|
||||
if user.last_name:
|
||||
fullname = f"{name} {user.last_name}"
|
||||
else:
|
||||
fullname = name
|
||||
fullname = f"{name} {user.last_name}" if user.last_name else name
|
||||
username = f"@{user.username}"
|
||||
mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
|
||||
count = len(get_approved())
|
||||
@@ -231,19 +242,9 @@ if sett == "True":
|
||||
if user.id in LASTMSG:
|
||||
prevmsg = LASTMSG[user.id]
|
||||
if event.text != prevmsg:
|
||||
if "PMSecurity" in event.text:
|
||||
if "PMSecurity" in event.text or "**PMSecurity" in event.text:
|
||||
return
|
||||
async for message in ultroid.iter_messages(
|
||||
user.id,
|
||||
search=UND,
|
||||
):
|
||||
await message.delete()
|
||||
|
||||
async for message in ultroid.iter_messages(
|
||||
user.id,
|
||||
search=UNS,
|
||||
):
|
||||
await message.delete()
|
||||
await delete_pm_warn_msgs(user.id)
|
||||
message_ = UNAPPROVED_MSG.format(
|
||||
ON=OWNER_NAME,
|
||||
warn=wrn,
|
||||
@@ -255,17 +256,23 @@ if sett == "True":
|
||||
count=count,
|
||||
mention=mention,
|
||||
)
|
||||
await ultroid.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=message_,
|
||||
)
|
||||
elif event.text == prevmsg:
|
||||
async for message in ultroid.iter_messages(
|
||||
user.id,
|
||||
search=UND,
|
||||
):
|
||||
await message.delete()
|
||||
update_pm(user.id, message_, wrn)
|
||||
if inline_pm == "False":
|
||||
await ultroid.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=message_,
|
||||
)
|
||||
else:
|
||||
results = await ultroid.inline_query(my_bot, f"ip_{user.id}")
|
||||
try:
|
||||
await results[0].click(
|
||||
user.id, reply_to=event.id, hide_via=True
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
else:
|
||||
await delete_pm_warn_msgs(user.id)
|
||||
message_ = UNAPPROVED_MSG.format(
|
||||
ON=OWNER_NAME,
|
||||
warn=wrn,
|
||||
@@ -277,15 +284,26 @@ if sett == "True":
|
||||
count=count,
|
||||
mention=mention,
|
||||
)
|
||||
await ultroid.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=message_,
|
||||
)
|
||||
update_pm(user.id, message_, wrn)
|
||||
if inline_pm == "False":
|
||||
await ultroid.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=message_,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
results = await ultroid.inline_query(
|
||||
my_bot, f"ip_{user.id}"
|
||||
)
|
||||
await results[0].click(
|
||||
user.id, reply_to=event.id, hide_via=True
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
LASTMSG.update({user.id: event.text})
|
||||
else:
|
||||
async for message in ultroid.iter_messages(user.id, search=UND):
|
||||
await message.delete()
|
||||
await delete_pm_warn_msgs(user.id)
|
||||
message_ = UNAPPROVED_MSG.format(
|
||||
ON=OWNER_NAME,
|
||||
warn=wrn,
|
||||
@@ -297,19 +315,28 @@ if sett == "True":
|
||||
count=count,
|
||||
mention=mention,
|
||||
)
|
||||
await ultroid.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=message_,
|
||||
)
|
||||
LASTMSG.update({user.id: event.text})
|
||||
update_pm(user.id, message_, wrn)
|
||||
if inline_pm == "False":
|
||||
await ultroid.send_file(
|
||||
user.id,
|
||||
PMPIC,
|
||||
caption=message_,
|
||||
)
|
||||
else:
|
||||
try:
|
||||
results = await ultroid.inline_query(my_bot, f"ip_{user.id}")
|
||||
await results[0].click(
|
||||
user.id, reply_to=event.id, hide_via=True
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
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:
|
||||
async for message in ultroid.iter_messages(user.id, search=UND):
|
||||
await message.delete()
|
||||
await delete_pm_warn_msgs(user.id)
|
||||
await event.respond(UNS)
|
||||
try:
|
||||
del COUNT_PM[user.id]
|
||||
@@ -398,10 +425,7 @@ if sett == "True":
|
||||
except BaseException:
|
||||
pass
|
||||
await eod(apprvpm, f"[{name0}](tg://user?id={uid}) `approved to PM!`")
|
||||
async for message in apprvpm.client.iter_messages(user.id, search=UND):
|
||||
await message.delete()
|
||||
async for message in apprvpm.client.iter_messages(user.id, search=UNS):
|
||||
await message.delete()
|
||||
await delete_pm_warn_msgs(user.id)
|
||||
try:
|
||||
await asst.edit_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
@@ -443,7 +467,7 @@ if sett == "True":
|
||||
if is_approved(aname):
|
||||
disapprove_user(aname)
|
||||
await e.edit(
|
||||
f"[{name0}](tg://user?id={replied_user.id}) `Disaproved to PM!`",
|
||||
f"[{name0}](tg://user?id={replied_user.id}) `Disapproved to PM!`",
|
||||
)
|
||||
await asyncio.sleep(5)
|
||||
await e.delete()
|
||||
@@ -473,7 +497,7 @@ if sett == "True":
|
||||
name0 = str(aname.first_name)
|
||||
if is_approved(bbb.id):
|
||||
disapprove_user(bbb.id)
|
||||
await e.edit(f"[{name0}](tg://user?id={bbb.id}) `Disaproved to PM!`")
|
||||
await e.edit(f"[{name0}](tg://user?id={bbb.id}) `Disapproved to PM!`")
|
||||
await asyncio.sleep(5)
|
||||
await e.delete()
|
||||
try:
|
||||
@@ -503,9 +527,7 @@ if sett == "True":
|
||||
await e.edit(NO_REPLY)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="block ?(.*)",
|
||||
)
|
||||
@ultroid_cmd(pattern="block ?(.*)", ignore_dualmode=True)
|
||||
async def blockpm(block):
|
||||
match = block.pattern_match.group(1)
|
||||
if block.is_reply:
|
||||
@@ -534,19 +556,21 @@ async def blockpm(block):
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
_not_approved[user],
|
||||
f"#BLOCKED\n\n[{aname.first_name}](tg://user?id={user}) has been **blocked**.",
|
||||
buttons=Button.inline("UnBlock", data=f"unblock_{user}"),
|
||||
buttons=[
|
||||
Button.inline("UnBlock", data=f"unblock_{user}"),
|
||||
],
|
||||
)
|
||||
except KeyError:
|
||||
_not_approved[user] = await asst.send_message(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
f"#BLOCKED\n\n[{aname.first_name}](tg://user?id={user}) has been **blocked**.",
|
||||
buttons=Button.inline("UnBlock", data=f"unblock_{user}"),
|
||||
buttons=[
|
||||
Button.inline("UnBlock", data=f"unblock_{user}"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="unblock ?(.*)",
|
||||
)
|
||||
@ultroid_cmd(pattern="unblock ?(.*)", ignore_dualmode=True)
|
||||
async def unblockpm(unblock):
|
||||
match = unblock.pattern_match.group(1)
|
||||
if unblock.is_reply:
|
||||
@@ -569,7 +593,6 @@ async def unblockpm(unblock):
|
||||
f"#UNBLOCKED\n\n[{aname.first_name}](tg://user?id={user}) has been **unblocked**.",
|
||||
buttons=[
|
||||
Button.inline("Block", data=f"block_{user}"),
|
||||
Button.inline("Close", data="deletedissht"),
|
||||
],
|
||||
)
|
||||
except KeyError:
|
||||
@@ -578,11 +601,33 @@ async def unblockpm(unblock):
|
||||
f"#UNBLOCKED\n\n[{aname.first_name}](tg://user?id={user}) has been **unblocked**.",
|
||||
buttons=[
|
||||
Button.inline("Block", data=f"block_{user}"),
|
||||
Button.inline("Close", data="deletedissht"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="listapproved")
|
||||
async def list_approved(event):
|
||||
xx = await eor(event, get_string("com_1"))
|
||||
if udB.get("PMPERMIT") is None:
|
||||
return await eod(xx, "`You haven't approved anyone yet!`")
|
||||
users = []
|
||||
for i in [int(x) for x in udB.get("PMPERMIT").split(" ")]:
|
||||
try:
|
||||
name = (await ultroid.get_entity(i)).first_name
|
||||
except BaseException:
|
||||
name = ""
|
||||
users.append([name.strip(), str(i)])
|
||||
with open("approved_pms.txt", "w") as list_appr:
|
||||
list_appr.write(
|
||||
tabulate(users, headers=["UserName", "UserID"], showindex="always")
|
||||
)
|
||||
await event.reply(
|
||||
"List of users approved by [{}](tg://user?id={})".format(OWNER_NAME, OWNER_ID),
|
||||
file="approved_pms.txt",
|
||||
)
|
||||
remove("approved_pms.txt")
|
||||
|
||||
|
||||
@callback(
|
||||
re.compile(
|
||||
b"approve_(.*)",
|
||||
@@ -606,24 +651,22 @@ async def apr_in(event):
|
||||
await event.edit(
|
||||
f"#APPROVED\n\n[{user_name}](tg://user?id={uid}) `approved to PM!`",
|
||||
buttons=[
|
||||
Button.inline("Disapprove PM", data=f"disapprove_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
[
|
||||
Button.inline("Disapprove PM", data=f"disapprove_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
],
|
||||
],
|
||||
)
|
||||
async for message in ultroid.iter_messages(uid, search=UND):
|
||||
await message.delete()
|
||||
async for message in ultroid.iter_messages(uid, search=UNS):
|
||||
await message.delete()
|
||||
await delete_pm_warn_msgs(uid)
|
||||
await event.answer("Approved.")
|
||||
x = await ultroid.send_message(uid, "You have been approved to PM me!")
|
||||
await asyncio.sleep(5)
|
||||
await x.delete()
|
||||
else:
|
||||
await event.edit(
|
||||
"`User may already be approved.`",
|
||||
buttons=[
|
||||
Button.inline("Disapprove PM", data=f"disapprove_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
[
|
||||
Button.inline("Disapprove PM", data=f"disapprove_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
],
|
||||
],
|
||||
)
|
||||
|
||||
@@ -645,20 +688,21 @@ async def disapr_in(event):
|
||||
await event.edit(
|
||||
f"#DISAPPROVED\n\n[{user_name}](tg://user?id={uid}) `disapproved from PMs!`",
|
||||
buttons=[
|
||||
Button.inline("Approve PM", data=f"approve_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
[
|
||||
Button.inline("Approve PM", data=f"approve_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
],
|
||||
],
|
||||
)
|
||||
await event.answer("DisApproved.")
|
||||
x = await ultroid.send_message(uid, "You have been disapproved from PMing me!")
|
||||
await asyncio.sleep(5)
|
||||
await x.delete()
|
||||
else:
|
||||
await event.edit(
|
||||
"`User was never approved!`",
|
||||
buttons=[
|
||||
Button.inline("Disapprove PM", data=f"disapprove_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
[
|
||||
Button.inline("Disapprove PM", data=f"disapprove_{uid}"),
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
],
|
||||
],
|
||||
)
|
||||
|
||||
@@ -679,7 +723,9 @@ async def blck_in(event):
|
||||
await event.answer("Blocked.")
|
||||
await event.edit(
|
||||
f"#BLOCKED\n\n[{user_name}](tg://user?id={uid}) has been **blocked!**",
|
||||
buttons=Button.inline("UnBlock", data=f"unblock_{uid}"),
|
||||
buttons=[
|
||||
Button.inline("UnBlock", data=f"unblock_{uid}"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -701,12 +747,121 @@ async def unblck_in(event):
|
||||
f"#UNBLOCKED\n\n[{user_name}](tg://user?id={uid}) has been **unblocked!**",
|
||||
buttons=[
|
||||
Button.inline("Block", data=f"block_{uid}"),
|
||||
Button.inline("Close", data="deletedissht"),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@callback("deletedissht")
|
||||
async def ytfuxist(e):
|
||||
await e.answer("Deleted.")
|
||||
await e.delete()
|
||||
try:
|
||||
await e.answer("Deleted.")
|
||||
await e.delete()
|
||||
except BaseException:
|
||||
try:
|
||||
await ultroid.delete_messages(e.chat_id, e.id)
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
|
||||
@asst.on(events.InlineQuery(pattern=re.compile("ip_(.*)")))
|
||||
@in_owner
|
||||
async def in_pm_ans(event):
|
||||
from_user = int(event.pattern_match.group(1))
|
||||
try:
|
||||
warns = U_WARNS[from_user]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
warns = "?"
|
||||
wrns = f"{warns}/{WARNS}"
|
||||
await event.answer(
|
||||
[
|
||||
await event.builder.article(
|
||||
title="Inline PMPermit.",
|
||||
text=f"**PMSecurity of {OWNER_NAME}!**",
|
||||
buttons=[
|
||||
[
|
||||
Button.inline("Warns", data=f"admin_only{from_user}"),
|
||||
Button.inline(wrns, data="do_nothing"),
|
||||
],
|
||||
[Button.inline("Message 📫", data=f"m_{from_user}")],
|
||||
],
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@callback(re.compile("admin_only(.*)"))
|
||||
async def _admin_tools(event):
|
||||
if event.sender_id != OWNER_ID:
|
||||
return await event.answer()
|
||||
chat = int(event.pattern_match.group(1))
|
||||
await event.edit(
|
||||
"Owner Tools.",
|
||||
buttons=[
|
||||
[
|
||||
Button.inline("Approve PM", data=f"approve_{chat}"),
|
||||
Button.inline("Block PM", data=f"block_{chat}"),
|
||||
],
|
||||
[Button.inline("« Back", data=f"pmbk_{chat}")],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@callback("do_nothing")
|
||||
async def _mejik(e):
|
||||
await e.answer() # ensure there is no white clock.
|
||||
|
||||
|
||||
@callback(re.compile("m_(.*)"))
|
||||
async def _rep(event):
|
||||
from_user = int(event.pattern_match.group(1))
|
||||
try:
|
||||
msg_ = WARN_MSGS[from_user]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
msg_ = "Missing."
|
||||
await event.edit(msg_, buttons=[Button.inline("« Back", data=f"pmbk_{from_user}")])
|
||||
|
||||
|
||||
@callback(re.compile("pmbk_(.*)"))
|
||||
async def edt(event):
|
||||
from_user = int(event.pattern_match.group(1))
|
||||
try:
|
||||
warns = U_WARNS[from_user]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
warns = "?"
|
||||
wrns = f"{warns}/{WARNS}"
|
||||
await event.edit(
|
||||
f"**PMSecurity of {OWNER_NAME}!**",
|
||||
buttons=[
|
||||
[
|
||||
Button.inline("Warns", data=f"admin_only{from_user}"),
|
||||
Button.inline(wrns, data="do_nothing"),
|
||||
],
|
||||
[Button.inline("Message 📫", data=f"m_{from_user}")],
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
def update_pm(userid, message, warns_given):
|
||||
try:
|
||||
WARN_MSGS.update({userid: message})
|
||||
except KeyError as e:
|
||||
print(e)
|
||||
try:
|
||||
U_WARNS.update({userid: warns_given})
|
||||
except KeyError as e:
|
||||
print(e)
|
||||
|
||||
|
||||
async def delete_pm_warn_msgs(chat: int):
|
||||
async for i in ultroid_bot.iter_messages(chat, from_user="me"):
|
||||
tx = i.text
|
||||
if tx and tx.startswith(
|
||||
("**PMSecurity", "#APPROVED", "#DISAPPROVED", "#UNBLOCKED", "#BLOCKED")
|
||||
):
|
||||
if tx.startswith("#"):
|
||||
# sleep for a while once approved, we need the menu open!
|
||||
await asyncio.sleep(4)
|
||||
await i.delete()
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -19,7 +18,6 @@
|
||||
Get the quiz poll where answerno is the number of option which is correct
|
||||
|
||||
"""
|
||||
|
||||
from telethon.tl.types import InputMediaPoll, Poll, PollAnswer
|
||||
|
||||
from . import *
|
||||
@@ -61,7 +59,7 @@ async def uri_poll(e):
|
||||
OUT = []
|
||||
for on in range(len(option)):
|
||||
OUT.append(PollAnswer(option[on], str(on).encode()))
|
||||
await ultroid_bot.send_file(
|
||||
await e.client.send_file(
|
||||
e.chat_id,
|
||||
InputMediaPoll(
|
||||
Poll(20, ques, OUT, multiple_choice=mpp, public_voters=publ, quiz=quizo),
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
|
||||
from ProfanityDetector import detector
|
||||
from pyUltroid.functions.nsfw_db import is_profan, profan_chat, rem_profan
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="addprofanity$", admins_only=True)
|
||||
async def addp(e):
|
||||
# action features not added yet or not needed ig 😂😂
|
||||
profan_chat(e.chat_id, "mute")
|
||||
await eod(e, "`Added This Chat for Profanity Filtering!`", time=10)
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -23,7 +22,6 @@
|
||||
• `{i}poto <username>`
|
||||
Upload the photo of Chat/User if Available.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
@@ -51,7 +49,7 @@ async def _(ult):
|
||||
ok = await eor(ult, "...")
|
||||
set = ult.pattern_match.group(1)
|
||||
try:
|
||||
await ultroid_bot(UpdateProfileRequest(about=set))
|
||||
await ult.client(UpdateProfileRequest(about=set))
|
||||
await ok.edit(f"Profile bio changed to\n`{set}`")
|
||||
except Exception as ex:
|
||||
await ok.edit("Error occured.\n`{}`".format(str(ex)))
|
||||
@@ -75,7 +73,7 @@ async def _(ult):
|
||||
if "//" in names:
|
||||
first_name, last_name = names.split("//", 1)
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await ult.client(
|
||||
UpdateProfileRequest(
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
@@ -102,13 +100,13 @@ async def _(ult):
|
||||
reply_message = await ult.get_reply_message()
|
||||
ok = await eor(ult, "...")
|
||||
replfile = await reply_message.download_media()
|
||||
file = await ultroid_bot.upload_file(replfile)
|
||||
file = await ult.client.upload_file(replfile)
|
||||
mediain = mediainfo(reply_message.media)
|
||||
try:
|
||||
if "pic" in mediain:
|
||||
await ultroid_bot(UploadProfilePhotoRequest(file))
|
||||
await ult.client(UploadProfilePhotoRequest(file))
|
||||
elif "gif" or "video" in mediain:
|
||||
await ultroid_bot(UploadProfilePhotoRequest(video=file))
|
||||
await ult.client(UploadProfilePhotoRequest(video=file))
|
||||
else:
|
||||
return await ok.edit("`Invalid MEDIA Type !`")
|
||||
await ok.edit("`My Profile Photo has Successfully Changed !`")
|
||||
@@ -136,7 +134,7 @@ async def remove_profilepic(delpfp):
|
||||
lim = int(group)
|
||||
else:
|
||||
lim = 1
|
||||
pfplist = await ultroid_bot(
|
||||
pfplist = await delpfp.client(
|
||||
GetUserPhotosRequest(user_id=delpfp.from_id, offset=0, max_id=0, limit=lim),
|
||||
)
|
||||
input_photos = []
|
||||
@@ -148,7 +146,7 @@ async def remove_profilepic(delpfp):
|
||||
file_reference=sep.file_reference,
|
||||
),
|
||||
)
|
||||
await ultroid_bot(DeletePhotosRequest(id=input_photos))
|
||||
await delpfp.client(DeletePhotosRequest(id=input_photos))
|
||||
await ok.edit(f"`Successfully deleted {len(input_photos)} profile picture(s).`")
|
||||
await asyncio.sleep(10)
|
||||
await ok.delete()
|
||||
@@ -164,13 +162,13 @@ async def gpoto(e):
|
||||
if not (ult or e.is_reply):
|
||||
ult = e.chat_id
|
||||
try:
|
||||
okla = await ultroid_bot.download_profile_photo(
|
||||
okla = await e.client.download_profile_photo(
|
||||
ult,
|
||||
"profile.jpg",
|
||||
download_big=True,
|
||||
)
|
||||
await a.delete()
|
||||
await ultroid_bot.send_message(e.chat_id, file=okla)
|
||||
await e.reply(file=okla)
|
||||
os.remove(okla)
|
||||
except Exception as er:
|
||||
await eor(e, f"ERROR - {str(er)}")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -17,8 +16,6 @@
|
||||
•`qrdecode <reply to qrcode>`
|
||||
It decodes the qrcode.
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
|
||||
import cv2
|
||||
@@ -41,10 +38,10 @@ async def cd(e):
|
||||
else:
|
||||
return await eod(e, "`Give Some Text or Reply")
|
||||
kk = await eor(e, "`processing`")
|
||||
pfp = await ultroid_bot.get_profile_photos(ultroid_bot.uid)
|
||||
pfp = await e.client.get_profile_photos(ultroid_bot.uid)
|
||||
img = "resources/extras/teamultroid.jpg"
|
||||
if len(pfp) >= 1:
|
||||
img = await ultroid_bot.download_media(pfp[0])
|
||||
img = await e.client.download_media(pfp[0])
|
||||
ok = Image.open(img)
|
||||
logo = ok.resize((60, 60))
|
||||
cod = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)
|
||||
@@ -54,7 +51,7 @@ async def cd(e):
|
||||
pstn = ((imgg.size[0] - logo.size[0]) // 2, (imgg.size[1] - logo.size[1]) // 2)
|
||||
imgg.paste(logo, pstn)
|
||||
imgg.save(img)
|
||||
await ultroid_bot.send_file(e.chat_id, img, support_stream=True)
|
||||
await e.client.send_file(e.chat_id, img, supports_streaming=True)
|
||||
await kk.delete()
|
||||
os.remove(img)
|
||||
|
||||
@@ -67,9 +64,9 @@ async def qrwater(e):
|
||||
return await eod(e, "`Reply Any Media and Give Text`")
|
||||
kk = await eor(e, "`processing`")
|
||||
if isinstance(r.media, photu):
|
||||
dl = await ultroid_bot.download_media(r.media)
|
||||
dl = await e.client.download_media(r.media)
|
||||
elif isinstance(r.media, doc):
|
||||
dl = await ultroid_bot.download_media(r, thumb=-1)
|
||||
dl = await e.client.download_media(r, thumb=-1)
|
||||
else:
|
||||
return
|
||||
img_bg = Image.open(dl)
|
||||
@@ -80,7 +77,7 @@ async def qrwater(e):
|
||||
pos = (img_bg.size[0] - img_qr.size[0], img_bg.size[1] - img_qr.size[1])
|
||||
img_bg.paste(img_qr, pos)
|
||||
img_bg.save(dl)
|
||||
await ultroid_bot.send_file(e.chat_id, dl, support_stream=True)
|
||||
await e.client.send_file(e.chat_id, dl, supports_streaming=True)
|
||||
await kk.delete()
|
||||
os.remove(dl)
|
||||
|
||||
@@ -92,9 +89,9 @@ async def decod(e):
|
||||
return await eod(e, "`Reply to Qrcode Media`")
|
||||
kk = await eor(e, "`processing`")
|
||||
if isinstance(r.media, photu):
|
||||
dl = await ultroid_bot.download_media(r.media)
|
||||
dl = await r.download_media()
|
||||
elif isinstance(r.media, doc):
|
||||
dl = await ultroid_bot.download_media(r, thumb=-1)
|
||||
dl = await r.download_media(thumb=-1)
|
||||
else:
|
||||
return
|
||||
im = cv2.imread(dl)
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
# 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}randomuser`
|
||||
Generate details about a random user.
|
||||
"""
|
||||
|
||||
from . import *
|
||||
|
||||
|
||||
@@ -19,5 +17,5 @@ from . import *
|
||||
async def _gen_data(event):
|
||||
x = await eor(event, get_string("com_1"))
|
||||
msg, pic = get_random_user_data()
|
||||
await ultroid_bot.send_file(event.chat_id, file=pic, caption=msg)
|
||||
await event.reply(file=pic, message=msg)
|
||||
await x.delete()
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -15,7 +14,6 @@
|
||||
To resize image on x, y axis.
|
||||
eg. `{i}resize 690 960`
|
||||
"""
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from . import *
|
||||
@@ -28,9 +26,9 @@ async def size(e):
|
||||
return await eor(e, "`Reply To image`")
|
||||
k = await eor(e, "`Processing...`")
|
||||
if hasattr(r.media, "document"):
|
||||
img = await ultroid_bot.download_media(r, thumb=-1)
|
||||
img = await e.client.download_media(r, thumb=-1)
|
||||
else:
|
||||
img = await ultroid_bot.download_media(r.media)
|
||||
img = await r.download_media()
|
||||
im = Image.open(img)
|
||||
x, y = im.size
|
||||
await k.edit(f"Dimension Of This Image Is\n`{x} x {y}`")
|
||||
@@ -47,9 +45,9 @@ async def size(e):
|
||||
return await eod(f"Give Some Size To Resize, Like `{HNDLR}resize 720 1080` ")
|
||||
k = await eor(e, "`Processing...`")
|
||||
if hasattr(r.media, "document"):
|
||||
img = await ultroid_bot.download_media(r, thumb=-1)
|
||||
img = await e.client.download_media(r, thumb=-1)
|
||||
else:
|
||||
img = await ultroid_bot.download_media(r.media)
|
||||
img = await r.download_media()
|
||||
sz = sz.split()
|
||||
if not len(sz) == 2:
|
||||
return await eod(f"Give Some Size To Resize, Like `{HNDLR}resize 720 1080` ")
|
||||
@@ -57,6 +55,6 @@ async def size(e):
|
||||
im = Image.open(img)
|
||||
ok = im.resize((x, y))
|
||||
ok.save(img, format="PNG", optimize=True)
|
||||
await ultroid_bot.send_file(e.chat_id, img)
|
||||
await e.reply(file=img)
|
||||
os.remove(img)
|
||||
await k.delete()
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -12,7 +11,6 @@
|
||||
Download songs from Saavn
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from urllib.request import urlretrieve
|
||||
@@ -53,10 +51,9 @@ async def siesace(e):
|
||||
okk = await uploader(
|
||||
title + ".mp3", title + ".mp3", hmm, lol, "Uploading " + title + "..."
|
||||
)
|
||||
await ultroid_bot.send_file(
|
||||
e.chat_id,
|
||||
okk,
|
||||
caption="`" + title + "`" + "\n`From Saavn`",
|
||||
await e.reply(
|
||||
file=okk,
|
||||
message="`" + title + "`" + "\n`From Saavn`",
|
||||
attributes=[
|
||||
DocumentAttributeAudio(
|
||||
duration=int(duration),
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -24,10 +23,10 @@ async def saf(e):
|
||||
return await eod(
|
||||
e, "Reply to Any Message to save it to ur saved messages", time=5
|
||||
)
|
||||
if e.sender_id == ultroid_bot.uid:
|
||||
await ultroid_bot.send_message("me", x)
|
||||
if e.out:
|
||||
await e.client.send_message("me", x)
|
||||
else:
|
||||
await ultroid_bot.send_message(e.sender_id, x)
|
||||
await e.client.send_message(e.sender_id, x)
|
||||
await eod(e, "Message saved to Your Pm/Saved Messages.", time=5)
|
||||
|
||||
|
||||
@@ -38,7 +37,7 @@ async def saf(e):
|
||||
return await eod(
|
||||
e, "Reply to Any Message to save it to ur saved messages", time=5
|
||||
)
|
||||
if e.sender_id == ultroid_bot.uid:
|
||||
if e.out:
|
||||
await x.forward_to("me")
|
||||
else:
|
||||
await x.forward_to(e.sender_id)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -13,7 +12,6 @@
|
||||
eg. `{i}schedule Hello 100` It deliver msg after 100 sec.
|
||||
eg. `{i}schedule Hello 1h` It deliver msg after an hour.
|
||||
"""
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from . import *
|
||||
@@ -29,14 +27,14 @@ async def _(e):
|
||||
y = x.split(" ")[-1]
|
||||
k = x.replace(y, "")
|
||||
if y.isdigit():
|
||||
await ultroid_bot.send_message(
|
||||
await e.client.send_message(
|
||||
e.chat_id, k, schedule=timedelta(seconds=int(y))
|
||||
)
|
||||
await eod(e, "`Scheduled msg Succesfully`")
|
||||
else:
|
||||
try:
|
||||
z = await ban_time(e, y)
|
||||
await ultroid_bot.send_message(e.chat_id, k, schedule=z)
|
||||
await e.client.send_message(e.chat_id, k, schedule=z)
|
||||
await eod(e, "`Scheduled msg Succesfully`")
|
||||
except BaseException:
|
||||
await eod(e, "`Incorrect Format`")
|
||||
@@ -49,7 +47,7 @@ async def _(e):
|
||||
else:
|
||||
try:
|
||||
z = await ban_time(e, x)
|
||||
await ultroid_bot.send_message(e.chat_id, xx, schedule=z)
|
||||
await e.client.send_message(e.chat_id, xx, schedule=z)
|
||||
await eod(e, "`Scheduled msg Succesfully`")
|
||||
except BaseException:
|
||||
await eod(e, "`Incorrect Format`")
|
||||
|
||||
@@ -40,7 +40,7 @@ async def an(e):
|
||||
if wt and wt.media:
|
||||
wut = mediainfo(wt.media)
|
||||
if wut.startswith(("pic", "gif")):
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await wt.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -48,7 +48,7 @@ async def an(e):
|
||||
if wt.media.document.size > 8 * 1000 * 1000:
|
||||
return await eod(x, "`Unsupported Media`")
|
||||
else:
|
||||
dl = await bot.download_media(wt.media)
|
||||
dl = await wt.download_media()
|
||||
variable = uf(dl)
|
||||
os.remove(dl)
|
||||
m = "https://telegra.ph" + variable[0]
|
||||
@@ -84,8 +84,10 @@ async def lsnote(e):
|
||||
await eor(e, "No Snips Found Here")
|
||||
|
||||
|
||||
@ultroid_bot.on(events.NewMessage(outgoing=True))
|
||||
@ultroid_bot.on(events.NewMessage())
|
||||
async def notes(e):
|
||||
if not e.out and not str(e.sender_id) in sudoers():
|
||||
return
|
||||
xx = (e.text).lower()
|
||||
if not xx.startswith("$"):
|
||||
return
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -26,7 +25,6 @@
|
||||
• `{i}wall <query>`
|
||||
Search Hd Wallpaper as Per ur Wish..
|
||||
"""
|
||||
|
||||
import os
|
||||
from datetime import datetime as dt
|
||||
from random import choice
|
||||
@@ -96,7 +94,7 @@ async def hbd(event):
|
||||
return await eor(event, "`Put input in dd/mm/yyyy format`")
|
||||
if event.reply_to_msg_id:
|
||||
kk = await event.get_reply_message()
|
||||
nam = await ultroid_bot.get_entity(kk.from_id)
|
||||
nam = await event.client.get_entity(kk.from_id)
|
||||
name = nam.first_name
|
||||
else:
|
||||
name = ultroid_bot.me.first_name
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -30,7 +29,6 @@
|
||||
paste text on random stickers.
|
||||
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import io
|
||||
import os
|
||||
@@ -90,7 +88,7 @@ async def waifu(animu):
|
||||
waifus = [32, 33, 37, 40, 41, 42, 58, 20]
|
||||
finalcall = "#" + (str(random.choice(waifus)))
|
||||
try:
|
||||
sticcers = await ultroid_bot.inline_query(
|
||||
sticcers = await animu.client.inline_query(
|
||||
"stickerizerbot",
|
||||
f"{finalcall}{(deEmojify(text))}",
|
||||
)
|
||||
@@ -153,7 +151,7 @@ async def pack_kangish(_):
|
||||
if _e and _e.media and _e.media.document.mime_type == "image/webp":
|
||||
_id = _e.media.document.attributes[1].stickerset.id
|
||||
_hash = _e.media.document.attributes[1].stickerset.access_hash
|
||||
_get_stiks = await ultroid_bot(
|
||||
_get_stiks = await _.client(
|
||||
functions.messages.GetStickerSetRequest(
|
||||
stickerset=types.InputStickerSetID(id=_id, access_hash=_hash)
|
||||
)
|
||||
@@ -181,7 +179,7 @@ async def pack_kangish(_):
|
||||
functions.stickers.CreateStickerSetRequest(
|
||||
user_id=_.sender_id,
|
||||
title=_packname,
|
||||
short_name=f"ult_{_.sender_id}_{pack}_by_{(await tgbot.get_me()).username}",
|
||||
short_name=f"u{_.sender_id}_{pack}_by_{(await tgbot.get_me()).username}",
|
||||
stickers=stiks,
|
||||
)
|
||||
)
|
||||
@@ -194,7 +192,7 @@ async def pack_kangish(_):
|
||||
functions.stickers.CreateStickerSetRequest(
|
||||
user_id=_.sender_id,
|
||||
title=_packname,
|
||||
short_name=f"ult_{_.sender_id}_{pack}_by_{(await tgbot.get_me()).username}",
|
||||
short_name=f"u{_.sender_id}_{pack}_by_{(await tgbot.get_me()).username}",
|
||||
stickers=stiks,
|
||||
)
|
||||
)
|
||||
@@ -212,6 +210,7 @@ async def pack_kangish(_):
|
||||
pattern="kang",
|
||||
)
|
||||
async def hehe(args):
|
||||
ultroid_bot = args.client
|
||||
xx = await eor(args, "`Processing...`")
|
||||
user = await ultroid_bot.get_me()
|
||||
if not user.username:
|
||||
@@ -264,8 +263,9 @@ async def hehe(args):
|
||||
|
||||
if photo:
|
||||
splat = args.text.split()
|
||||
emoji = "🏵"
|
||||
pack = 1
|
||||
if not emoji:
|
||||
emoji = "🏵"
|
||||
if len(splat) == 3:
|
||||
pack = splat[2] # User sent ultroid_both
|
||||
emoji = splat[1]
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -17,7 +16,6 @@
|
||||
• `{i}listsudo`
|
||||
List all sudo users.
|
||||
"""
|
||||
|
||||
from pyUltroid.misc import sudoers
|
||||
|
||||
from . import *
|
||||
@@ -36,40 +34,33 @@ async def _(ult):
|
||||
mmm = ""
|
||||
if ult.reply_to_msg_id:
|
||||
replied_to = await ult.get_reply_message()
|
||||
id = await get_user_id(replied_to.sender_id)
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
if id == ultroid_bot.me.id:
|
||||
mmm += "You cant add yourself as Sudo User..."
|
||||
elif is_sudo(id):
|
||||
mmm += f"[{name}](tg://user?id={id}) `is already a SUDO User ...`"
|
||||
elif add_sudo(id):
|
||||
udB.set("SUDO", "True")
|
||||
mmm += f"**Added [{name}](tg://user?id={id}) as SUDO User**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
sender = replied_to.sender
|
||||
id = sender.id
|
||||
name = sender.first_name
|
||||
elif inputs:
|
||||
id = await get_user_id(inputs)
|
||||
try:
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
except BaseException:
|
||||
name = ""
|
||||
if id == ultroid_bot.me.id:
|
||||
mmm += "You cant add yourself as Sudo User..."
|
||||
elif is_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"[{name}](tg://user?id={id}) `is already a SUDO User ...`"
|
||||
else:
|
||||
mmm += f"`{id} is already a SUDO User...`"
|
||||
elif add_sudo(id):
|
||||
udB.set("SUDO", "True")
|
||||
if name != "":
|
||||
mmm += f"**Added [{name}](tg://user?id={id}) as SUDO User**"
|
||||
else:
|
||||
mmm += f"**Added **`{id}`** as SUDO User**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
else:
|
||||
mmm += "`Reply to a msg or add it's id/username.`"
|
||||
return await eod(ult, "`Reply to a msg or add it's id/username.`")
|
||||
|
||||
if id == ultroid_bot.me.id:
|
||||
mmm += "You cant add yourself as Sudo User..."
|
||||
elif is_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"[{name}](tg://user?id={id}) `is already a SUDO User ...`"
|
||||
else:
|
||||
mmm += f"`{id} is already a SUDO User...`"
|
||||
elif add_sudo(id):
|
||||
udB.set("SUDO", "True")
|
||||
if name != "":
|
||||
mmm += f"**Added [{name}](tg://user?id={id}) as SUDO User**"
|
||||
else:
|
||||
mmm += f"**Added **`{id}`** as SUDO User**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
await eod(ok, mmm)
|
||||
|
||||
|
||||
@@ -89,34 +80,28 @@ async def _(ult):
|
||||
mmm = ""
|
||||
if ult.reply_to_msg_id:
|
||||
replied_to = await ult.get_reply_message()
|
||||
id = await get_user_id(replied_to.sender_id)
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
if not is_sudo(id):
|
||||
mmm += f"[{name}](tg://user?id={id}) `wasn't a SUDO User ...`"
|
||||
elif del_sudo(id):
|
||||
mmm += f"**Removed [{name}](tg://user?id={id}) from SUDO User(s)**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
id = replied_to.sender_id
|
||||
name = replied_to.sender.first_name
|
||||
elif inputs:
|
||||
id = await get_user_id(inputs)
|
||||
try:
|
||||
name = (await ult.client.get_entity(int(id))).first_name
|
||||
except BaseException:
|
||||
name = ""
|
||||
if not is_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"[{name}](tg://user?id={id}) `wasn't a SUDO User ...`"
|
||||
else:
|
||||
mmm += f"`{id} wasn't a SUDO User...`"
|
||||
elif del_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"**Removed [{name}](tg://user?id={id}) from SUDO User(s)**"
|
||||
else:
|
||||
mmm += f"**Removed **`{id}`** from SUDO User(s)**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
else:
|
||||
mmm += "`Reply to a msg or add it's id/username.`"
|
||||
return await eod(ult, "`Reply to a msg or add it's id/username.`")
|
||||
if not is_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"[{name}](tg://user?id={id}) `wasn't a SUDO User ...`"
|
||||
else:
|
||||
mmm += f"`{id} wasn't a SUDO User...`"
|
||||
elif del_sudo(id):
|
||||
if name != "":
|
||||
mmm += f"**Removed [{name}](tg://user?id={id}) from SUDO User(s)**"
|
||||
else:
|
||||
mmm += f"**Removed **`{id}`** from SUDO User(s)**"
|
||||
else:
|
||||
mmm += "`SEEMS LIKE THIS FUNCTION CHOOSE TO BREAK ITSELF`"
|
||||
await eod(ok, mmm)
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -32,7 +31,6 @@
|
||||
Get translated message.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from asyncio.exceptions import TimeoutError
|
||||
@@ -51,9 +49,7 @@ from . import *
|
||||
from . import humanbytes as hb
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="tr",
|
||||
)
|
||||
@ultroid_cmd(pattern="tr", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def _(event):
|
||||
if len(event.text) > 3:
|
||||
if not event.text[3] == " ":
|
||||
@@ -79,9 +75,7 @@ async def _(event):
|
||||
await eod(xx, str(exc), time=10)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="id ?(.*)",
|
||||
)
|
||||
@ultroid_cmd(pattern="id ?(.*)", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def _(event):
|
||||
if event.reply_to_msg_id:
|
||||
await event.get_input_chat()
|
||||
@@ -119,14 +113,11 @@ async def _(event):
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="bots ?(.*)",
|
||||
groups_only=True,
|
||||
type=["official", "manager"],
|
||||
ignore_dualmode=True,
|
||||
)
|
||||
async def _(ult):
|
||||
await ult.edit("`...`")
|
||||
if ult.is_private:
|
||||
user = await ult.get_chat()
|
||||
if not user.bot:
|
||||
return await ult.edit("`Seariously ?`")
|
||||
|
||||
mentions = "**Bots in this Chat**: \n"
|
||||
input_str = ult.pattern_match.group(1)
|
||||
to_write_chat = await ult.get_input_chat()
|
||||
@@ -136,12 +127,12 @@ async def _(ult):
|
||||
else:
|
||||
mentions = f"**Bots in **{input_str}: \n"
|
||||
try:
|
||||
chat = await ultroid_bot.get_entity(input_str)
|
||||
chat = await ult.client.get_entity(input_str)
|
||||
except Exception as e:
|
||||
await eor(ult, str(e))
|
||||
return None
|
||||
try:
|
||||
async for x in ultroid_bot.iter_participants(
|
||||
async for x in ult.client.iter_participants(
|
||||
chat,
|
||||
filter=ChannelParticipantsBots,
|
||||
):
|
||||
@@ -367,7 +358,7 @@ async def lastname(steal):
|
||||
id = f"/search_id {user_id}"
|
||||
lol = await eor(steal, "`Processing !...`")
|
||||
try:
|
||||
async with ultroid_bot.conversation(chat) as conv:
|
||||
async with steal.client.conversation(chat) as conv:
|
||||
try:
|
||||
msg = await conv.send_message(id)
|
||||
response = await conv.get_response()
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -12,8 +11,6 @@
|
||||
Unsplash Image Search.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import urllib
|
||||
|
||||
import requests as r
|
||||
@@ -50,7 +47,7 @@ async def searchunsl(ult):
|
||||
urllib.request.urlretrieve(ft, Hp)
|
||||
CL.append(Hp)
|
||||
nl += 1
|
||||
await bot.send_file(
|
||||
await ult.client.send_file(
|
||||
ult.chat_id, CL, caption=f"Uploaded {len(qas)} Images\n", album=True
|
||||
)
|
||||
await tep.delete()
|
||||
|
||||
@@ -28,14 +28,17 @@ async def _(e):
|
||||
m = await updater()
|
||||
branch = (Repo.init()).active_branch
|
||||
if m:
|
||||
x = await ultroid_bot.asst.send_file(
|
||||
x = await asst.send_file(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
ULTPIC,
|
||||
caption="• **Update Available** •",
|
||||
force_document=False,
|
||||
buttons=Button.inline("Changelogs", data="changes"),
|
||||
)
|
||||
Link = (await ultroid_bot(GetLink(x.chat_id, x.id))).link
|
||||
if not e.client._bot:
|
||||
Link = (await e.client(GetLink(x.chat_id, x.id))).link
|
||||
else:
|
||||
Link = f"https://t.me/{x.chat.id}/{x.id}"
|
||||
await xx.edit(
|
||||
f'<strong><a href="{Link}">[ChangeLogs]</a></strong>',
|
||||
parse_mode="html",
|
||||
@@ -53,7 +56,7 @@ async def _(e):
|
||||
@owner
|
||||
async def updava(event):
|
||||
await event.delete()
|
||||
await ultroid_bot.asst.send_file(
|
||||
await asst.send_file(
|
||||
int(udB.get("LOG_CHANNEL")),
|
||||
ULTPIC,
|
||||
caption="• **Update Available** •",
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 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
|
||||
|
||||
@@ -41,17 +48,41 @@ async def usage_finder(event):
|
||||
try:
|
||||
opt = event.text.split(" ", maxsplit=1)[1]
|
||||
except IndexError:
|
||||
return await x.edit(get_full_usage())
|
||||
return await x.edit(simple_usage())
|
||||
|
||||
if opt == "redis":
|
||||
return await x.edit(redis_usage())
|
||||
elif opt == "heroku":
|
||||
is_hk, hk = heroku_usage()
|
||||
await x.edit(hk)
|
||||
elif opt == "full":
|
||||
await x.edit(get_full_usage())
|
||||
else:
|
||||
await eor(x, "`The what?`", time=5)
|
||||
|
||||
|
||||
def simple_usage():
|
||||
total, used, free = shutil.disk_usage(".")
|
||||
cpuUsage = psutil.cpu_percent()
|
||||
memory = psutil.virtual_memory().percent
|
||||
disk = psutil.disk_usage("/").percent
|
||||
upload = humanbytes(psutil.net_io_counters().bytes_sent)
|
||||
down = humanbytes(psutil.net_io_counters().bytes_recv)
|
||||
TOTAL = humanbytes(total)
|
||||
USED = humanbytes(used)
|
||||
FREE = humanbytes(free)
|
||||
return get_string("usage_simple").format(
|
||||
TOTAL,
|
||||
USED,
|
||||
FREE,
|
||||
upload,
|
||||
down,
|
||||
cpuUsage,
|
||||
memory,
|
||||
disk,
|
||||
)
|
||||
|
||||
|
||||
def heroku_usage():
|
||||
if HEROKU_API is None and HEROKU_APP_NAME is None:
|
||||
return False, "You do not use heroku, bruh!"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -53,8 +52,9 @@
|
||||
• `{i}pst`
|
||||
Paste the copied message, with formatting.
|
||||
|
||||
• `{i}thumb <reply to file>`
|
||||
Download the thumbnail of the replied file.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import calendar
|
||||
import html
|
||||
@@ -64,6 +64,7 @@ import time
|
||||
from datetime import datetime as dt
|
||||
|
||||
import requests
|
||||
from pyUltroid.functions.gban_mute_db import *
|
||||
from telegraph import Telegraph
|
||||
from telegraph import upload_file as uf
|
||||
from telethon.events import NewMessage
|
||||
@@ -79,9 +80,10 @@ from telethon.tl.functions.photos import GetUserPhotosRequest
|
||||
from telethon.tl.types import Channel, Chat, InputMediaPoll, Poll, PollAnswer, User
|
||||
from telethon.utils import get_input_location
|
||||
|
||||
# =================================================================#
|
||||
from . import *
|
||||
|
||||
# =================================================================#
|
||||
|
||||
TMP_DOWNLOAD_DIRECTORY = "resources/downloads/"
|
||||
|
||||
# Telegraph Things
|
||||
@@ -100,7 +102,7 @@ async def leave(ult):
|
||||
if not ult.out and not is_fullsudo(e.sender_id):
|
||||
return await eod(ult, "`This Command Is Sudo Restricted.`")
|
||||
await eor(ult, f"`{ultroid_bot.me.first_name} has left this group, bye!!.`")
|
||||
await ultroid_bot(LeaveChannelRequest(ult.chat_id))
|
||||
await ult.client(LeaveChannelRequest(ult.chat_id))
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
@@ -125,17 +127,13 @@ async def info(event):
|
||||
await ok.edit(caption, parse_mode="html")
|
||||
except Exception as e:
|
||||
print("Exception:", e)
|
||||
await ok.edit(f"`An unexpected error has occurred. {e}`")
|
||||
await asyncio.sleep(5)
|
||||
await ok.delete()
|
||||
await eod(ok, f"`An unexpected error has occurred. {e}`")
|
||||
return
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="listreserved$",
|
||||
)
|
||||
@ultroid_cmd(pattern="listreserved$", ignore_dualmode=True)
|
||||
async def _(event):
|
||||
result = await ultroid_bot(GetAdminedPublicChannelsRequest())
|
||||
result = await event.client(GetAdminedPublicChannelsRequest())
|
||||
output_str = ""
|
||||
r = result.chats
|
||||
for channel_obj in r:
|
||||
@@ -165,7 +163,7 @@ async def stats(
|
||||
unread_mentions = 0
|
||||
unread = 0
|
||||
dialog: Dialog
|
||||
async for dialog in ultroid_bot.iter_dialogs():
|
||||
async for dialog in event.client.iter_dialogs():
|
||||
entity = dialog.entity
|
||||
if isinstance(entity, Channel):
|
||||
if entity.broadcast:
|
||||
@@ -198,7 +196,7 @@ async def stats(
|
||||
unread += dialog.unread_count
|
||||
stop_time = time.time() - start_time
|
||||
try:
|
||||
ct = (await ultroid_bot(GetBlockedRequest(1, 0))).count
|
||||
ct = (await event.client(GetBlockedRequest(1, 0))).count
|
||||
except AttributeError:
|
||||
ct = 0
|
||||
try:
|
||||
@@ -231,7 +229,7 @@ async def stats(
|
||||
pattern="paste( (.*)|$)",
|
||||
)
|
||||
async def _(event):
|
||||
xx = await eor(event, "` 《 Pasting to nekobin... 》 `")
|
||||
xx = await eor(event, "` 《 Pasting... 》 `")
|
||||
input_str = "".join(event.text.split(maxsplit=1)[1:])
|
||||
if not (input_str or event.is_reply):
|
||||
return await xx.edit("`Reply to a Message/Document or Give me Some Text !`")
|
||||
@@ -265,20 +263,18 @@ async def _(event):
|
||||
if "neko" in what:
|
||||
q = f"paste {key}"
|
||||
reply_text = f"• **Pasted to Nekobin :** [Neko](https://nekobin.com/{key})\n• **Raw Url :** : [Raw](https://nekobin.com/raw/{key})"
|
||||
elif "dog" in what:
|
||||
q = f"dog {key}"
|
||||
reply_text = f"• **Pasted to Dog Bin :** [Dog](https://del.dog/{key})\n• **Raw Url :** : [Raw](https://del.dog/raw/{key})"
|
||||
elif "haste" in what:
|
||||
q = f"haste {key}"
|
||||
reply_text = f"• **Pasted to HasteBin :** [Haste](https://hastebin.com/{key})\n• **Raw Url :** : [Raw](https://hastebin.com/raw/{key})"
|
||||
try:
|
||||
ok = await ultroid_bot.inline_query(asst.me.username, q)
|
||||
ok = await event.client.inline_query(asst.me.username, q)
|
||||
await ok[0].click(event.chat_id, reply_to=event.reply_to_msg_id, hide_via=True)
|
||||
await xx.delete()
|
||||
except BaseException:
|
||||
await xx.edit(reply_text)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="info ?(.*)",
|
||||
)
|
||||
@ultroid_cmd(pattern="info ?(.*)", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def _(event):
|
||||
xx = await eor(event, "`Processing...`")
|
||||
replied_user, error_i_a = await get_full_user(event)
|
||||
@@ -373,7 +369,7 @@ async def _(ult):
|
||||
if not ult.is_channel and ult.is_group:
|
||||
for user_id in to_add_users.split(" "):
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await ult.client(
|
||||
AddChatUserRequest(
|
||||
chat_id=ult.chat_id,
|
||||
user_id=user_id,
|
||||
@@ -386,7 +382,7 @@ async def _(ult):
|
||||
else:
|
||||
for user_id in to_add_users.split(" "):
|
||||
try:
|
||||
await ultroid_bot(
|
||||
await ult.client(
|
||||
InviteToChannelRequest(
|
||||
channel=ult.chat_id,
|
||||
users=[user_id],
|
||||
@@ -409,7 +405,7 @@ async def rmbg(event):
|
||||
)
|
||||
if event.reply_to_msg_id:
|
||||
reply = await event.get_reply_message()
|
||||
dl = await ultroid_bot.download_media(reply.media)
|
||||
dl = await event.client.download_media(reply.media)
|
||||
if not dl.endswith(("webp", "jpg", "png", "jpeg")):
|
||||
os.remove(dl)
|
||||
return await xx.edit("`Unsupported Media`")
|
||||
@@ -435,13 +431,13 @@ async def rmbg(event):
|
||||
if zz.mode != "RGB":
|
||||
zz.convert("RGB")
|
||||
zz.save("ult.webp", "webp")
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
rmbgp,
|
||||
force_document=True,
|
||||
reply_to=reply,
|
||||
)
|
||||
await ultroid_bot.send_file(event.chat_id, "ult.webp", reply_to=reply)
|
||||
await event.client.send_file(event.chat_id, "ult.webp", reply_to=reply)
|
||||
os.remove(rmbgp)
|
||||
os.remove("ult.webp")
|
||||
await xx.delete()
|
||||
@@ -451,6 +447,7 @@ async def rmbg(event):
|
||||
pattern="telegraph ?(.*)",
|
||||
)
|
||||
async def telegraphcmd(event):
|
||||
ultroid_bot = event.client
|
||||
input_str = event.pattern_match.group(1)
|
||||
if event.reply_to_msg_id:
|
||||
getmsg = await event.get_reply_message()
|
||||
@@ -515,7 +512,7 @@ async def _(event):
|
||||
if len(the_real_message) > 4096:
|
||||
with io.BytesIO(str.encode(the_real_message)) as out_file:
|
||||
out_file.name = "json-ult.txt"
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
force_document=True,
|
||||
@@ -532,7 +529,7 @@ async def sugg(event):
|
||||
if await event.get_reply_message():
|
||||
msgid = (await event.get_reply_message()).id
|
||||
try:
|
||||
await ultroid.send_message(
|
||||
await event.client.send_message(
|
||||
event.chat_id,
|
||||
file=InputMediaPoll(
|
||||
poll=Poll(
|
||||
@@ -633,7 +630,10 @@ async def colgate(event):
|
||||
async def toothpaste(event):
|
||||
try:
|
||||
await event.client.send_message(event.chat_id, _copied_msg["CLIPBOARD"])
|
||||
await event.delete()
|
||||
try:
|
||||
await event.delete()
|
||||
except BaseException:
|
||||
pass
|
||||
except KeyError:
|
||||
return await eod(
|
||||
event,
|
||||
@@ -641,3 +641,18 @@ async def toothpaste(event):
|
||||
)
|
||||
except Exception as ex:
|
||||
return await eod(str(ex))
|
||||
|
||||
|
||||
@ultroid_cmd(pattern="thumb$")
|
||||
async def thumb_dl(event):
|
||||
if not event.reply_to_msg_id:
|
||||
return await eod(
|
||||
event, "`Please reply to a file to download its thumbnail!`", time=5
|
||||
)
|
||||
xx = await eor(event, get_string("com_1"))
|
||||
x = await event.get_reply_message()
|
||||
m = await event.client.download_media(x, thumb=-1)
|
||||
await event.reply(file=m)
|
||||
await xx.edit("`Thumbnail sent, if available.`")
|
||||
await asyncio.sleep(5)
|
||||
await xx.delete()
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 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 -
|
||||
|
||||
@@ -77,7 +84,7 @@ async def get_var(event):
|
||||
if val is not None:
|
||||
return await x.edit(f"**Key** - `{varname}`\n**Value**: `{val}`")
|
||||
else:
|
||||
return await eod(x, "No such key!", time=5)
|
||||
return await eod(x, "No such key!")
|
||||
|
||||
elif opt == "keys":
|
||||
keys = sorted(udB.keys())
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
• `{i}stopvc`
|
||||
Stop Group Call in a group.
|
||||
|
||||
• `{i}playvc`
|
||||
Start Voice Chat Bot to receive Commands.
|
||||
|
||||
• `{i}vcinvite`
|
||||
Invite all members of group in Group Call.
|
||||
(You must be joined)
|
||||
@@ -27,15 +24,10 @@
|
||||
• `{i}rmvcaccess <id/username/reply to msg>`
|
||||
Remove access of Voice Chat Bot.
|
||||
|
||||
• **Voice Chat - Bot Commands**
|
||||
`/play ytsearch : song-name`
|
||||
`/play youtube link`
|
||||
`/current`
|
||||
`/skip`
|
||||
`/exitVc`
|
||||
• `{i}listvcaccess`
|
||||
Gwt The List of People having vc access.
|
||||
"""
|
||||
|
||||
from os import remove
|
||||
|
||||
from pyUltroid.functions.vc_sudos import add_vcsudo, del_vcsudo, get_vcsudos, is_vcsudo
|
||||
from telethon.tl.functions.channels import GetFullChannelRequest as getchat
|
||||
@@ -71,26 +63,6 @@ async def _(e):
|
||||
await eor(e, f"`{str(ex)}`")
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="playvc$",
|
||||
)
|
||||
async def _(e):
|
||||
zz = await eor(e, "`VC bot started...`")
|
||||
er, out = await bash("python vcstarter.py & sleep 10 && npm start")
|
||||
LOGS.info(er)
|
||||
LOGS.info(out)
|
||||
if er:
|
||||
msg = f"Failed {er}\n\n{out}"
|
||||
if len(msg) > 4096:
|
||||
with open("vc-error.txt", "w") as f:
|
||||
f.write(msg.replace("`", ""))
|
||||
await e.reply(file="vc-error.txt")
|
||||
await zz.delete()
|
||||
remove("vc-error.txt")
|
||||
return
|
||||
await zz.edit(msg)
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="vcinvite$",
|
||||
groups_only=True,
|
||||
@@ -33,6 +33,7 @@ from . import *
|
||||
|
||||
@ultroid_cmd(pattern="warn ?(.*)", groups_only=True, admins_only=True)
|
||||
async def warn(e):
|
||||
ultroid_bot = e.client
|
||||
reply = await e.get_reply_message()
|
||||
if len(e.text) > 5:
|
||||
if " " not in e.text[5]:
|
||||
@@ -114,14 +115,14 @@ async def rwarn(e):
|
||||
try:
|
||||
user = e.text.split()[1]
|
||||
if user.startswith("@"):
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = ok.id
|
||||
else:
|
||||
user = int(user)
|
||||
except BaseException:
|
||||
return await eor(e, "Reply To user")
|
||||
reset_warn(e.chat_id, user)
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
|
||||
await eor(e, f"Cleared All Warns of {user}.")
|
||||
|
||||
@@ -135,7 +136,7 @@ async def twarns(e):
|
||||
try:
|
||||
user = e.text.split()[1]
|
||||
if user.startswith("@"):
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = ok.id
|
||||
else:
|
||||
user = int(user)
|
||||
@@ -143,7 +144,7 @@ async def twarns(e):
|
||||
return await eod(e, "Reply To A User")
|
||||
c, r = warns(e.chat_id, user)
|
||||
if c and r:
|
||||
ok = await ultroid_bot.get_entity(user)
|
||||
ok = await e.client.get_entity(user)
|
||||
user = f"[{get_display_name(ok)}](tg://user?id={ok.id})"
|
||||
r = r.split("|$|")
|
||||
text = f"User {user} Got {c} Warns.\n\n"
|
||||
|
||||
@@ -47,9 +47,9 @@ async def _(event):
|
||||
except BaseException:
|
||||
file_name = await event.client.download_media(bb)
|
||||
else:
|
||||
return await eod(xx, "`Reply to media file`", time=5)
|
||||
return await eod(xx, "`Reply to media file`")
|
||||
try:
|
||||
results = await ultroid_bot.inline_query(
|
||||
results = await event.client.inline_query(
|
||||
asst.me.username,
|
||||
f"fl2lnk {file_name}",
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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 -
|
||||
|
||||
@@ -20,7 +19,6 @@
|
||||
• `{i}ud <word>`
|
||||
Fetch word defenition from urbandictionary.
|
||||
"""
|
||||
|
||||
import asyncurban
|
||||
from PyDictionary import PyDictionary
|
||||
|
||||
@@ -29,11 +27,9 @@ from . import *
|
||||
dictionary = PyDictionary()
|
||||
|
||||
|
||||
@ultroid_cmd(
|
||||
pattern="meaning",
|
||||
)
|
||||
@ultroid_cmd(pattern="meaning", type=["official", "manager"], ignore_dualmode=True)
|
||||
async def mean(event):
|
||||
evid = event.message.id
|
||||
event.message.id
|
||||
xx = await eor(event, get_string("com_1"))
|
||||
wrd = event.text.split(" ", maxsplit=1)[1]
|
||||
ok = dictionary.meaning(wrd)
|
||||
@@ -49,13 +45,10 @@ async def mean(event):
|
||||
if len(x) > 4096:
|
||||
with io.BytesIO(str.encode(x)) as fle:
|
||||
fle.name = f"{wrd}-meanings.txt"
|
||||
await ultroid_bot.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
await event.reply(
|
||||
file=out_file,
|
||||
force_document=True,
|
||||
allow_cache=False,
|
||||
caption=f"Meanings of {wrd}",
|
||||
reply_to=evid,
|
||||
)
|
||||
await xx.delete()
|
||||
else:
|
||||
@@ -79,7 +72,7 @@ async def mean(event):
|
||||
if len(x) > 4096:
|
||||
with io.BytesIO(str.encode(x)) as fle:
|
||||
fle.name = f"{wrd}-synonyms.txt"
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
force_document=True,
|
||||
@@ -111,7 +104,7 @@ async def mean(event):
|
||||
if len(x) > 4096:
|
||||
with io.BytesIO(str.encode(x)) as fle:
|
||||
fle.name = f"{wrd}-antonyms.txt"
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
out_file,
|
||||
force_document=True,
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2021 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 -
|
||||
|
||||
@@ -13,7 +19,6 @@
|
||||
• `{i}ytsv <(youtube) search query>`
|
||||
Search and download video from youtube.
|
||||
"""
|
||||
|
||||
from pyUltroid.functions.ytdl import *
|
||||
|
||||
from . import *
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
# 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
|
||||
|
||||
@@ -21,7 +20,6 @@
|
||||
upload batch zip the files u added from `{i}azip`
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
@@ -49,7 +47,7 @@ async def zipp(event):
|
||||
await bash(f"zip -r {inp} {file}")
|
||||
k = time.time()
|
||||
xxx = await uploader(inp, inp, k, xx, "Uploading...")
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
xxx,
|
||||
force_document=True,
|
||||
@@ -94,7 +92,7 @@ async def unzipp(event):
|
||||
for x in ok:
|
||||
k = time.time()
|
||||
xxx = await uploader(x, x, k, xx, "Uploading...")
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
xxx,
|
||||
force_document=True,
|
||||
@@ -138,7 +136,7 @@ async def do_zip(event):
|
||||
await bash(f"zip -r ultroid.zip zip/*")
|
||||
k = time.time()
|
||||
xxx = await uploader("ultroid.zip", "ultroid.zip", k, xx, "Uploading...")
|
||||
await ultroid_bot.send_file(
|
||||
await event.client.send_file(
|
||||
event.chat_id,
|
||||
xxx,
|
||||
force_document=True,
|
||||
|
||||
Reference in New Issue
Block a user