File size: 2,374 Bytes
1f26706 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# Ultroid - UserBot
# Copyright (C) 2021-2025 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}send <username/id> <reply/type>`
send message to User/Chat.
• `{i}fwdreply <reply to msg>`
Reply to someone's msg by forwarding it in private.
• `{i}save <reply message>`
Save that replied msg to ur saved messages box.
• `{i}fsave <reply message>`
Forward that replied msg to ur saved messages.
"""
from . import HNDLR, eod, get_string, ultroid_cmd
@ultroid_cmd(pattern="(send|dm)( (.*)|$)", fullsudo=True)
async def dm(e):
if len(e.text.split()) <= 1:
return await e.eor(get_string("dm_1"), time=5)
chat = e.text.split()[1]
try:
chat_id = await e.client.parse_id(chat)
except Exception as ex:
return await e.eor(f"`{ex}`", time=5)
if len(e.text.split()) > 2:
msg = e.text.split(maxsplit=2)[2]
elif e.reply_to:
msg = await e.get_reply_message()
else:
return await e.eor(get_string("dm_2"), time=5)
try:
_ = await e.client.send_message(chat_id, msg)
n_, time = get_string("dm_3"), None
if not _.is_private:
n_ = f"[{n_}]({_.message_link})"
await e.eor(n_, time=time)
except Exception as m:
await e.eor(get_string("dm_4").format(m, HNDLR), time=5)
@ultroid_cmd(pattern="fwdreply( (.*)|$)", fullsudo=True)
async def _(e):
message = e.pattern_match.group(1).strip()
if not e.reply_to_msg_id:
return await e.eor(get_string("ex_1"), time=5)
if not message:
return await e.eor(get_string("dm_6"), time=5)
msg = await e.get_reply_message()
fwd = await msg.forward_to(msg.sender_id)
await fwd.reply(message)
await e.eor(get_string("dm_5"), time=5)
@ultroid_cmd(pattern="(f|)save$")
async def saf(e):
x = await e.get_reply_message()
if not x:
return await eod(
e, "Reply to Any Message to save it to ur saved messages", time=5
)
if e.pattern_match.group(1).strip() == "f":
await x.forward_to(e.sender_id)
else:
await e.client.send_message(e.sender_id, x)
await e.eor("Message saved to Your Pm/Saved Messages.", time=5)
|