Files
Ultroid-fork/plugins/dm.py
Danish bef7479be0 Bug fixes V0.0.5
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Danish <danish@ultroid.tech>
Co-authored-by: buddhhu <buddhuu@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>
Co-authored-by: New-dev0 <New-dev0@notavailable.live>
2021-04-15 18:37:02 +05:30

49 lines
1.3 KiB
Python
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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}dm <username/id> <reply/type>`
Direct Message the User.
"""
from . import *
@ultroid_cmd(pattern="dm ?(.*)")
async def dm(e):
if len(e.text) > 3:
if not e.text[3] == " ": # weird fix
return
d = e.pattern_match.group(1)
c = d.split(" ")
try:
chat_id = await get_user_id(c[0])
except Exception as ex:
return await eod(e, "`" + str(ex) + "`", time=5)
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)
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)
except BaseException:
await eod(
e,
"`{i}help dm`",
time=4,
)
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})