Team Ai
Apppublic

azils3/bash

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
schedulemsg.py54 linesDownload Raw Back to plugins
1# Ultroid - UserBot2# Copyright (C) 2021-2025 TeamUltroid3#4# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >5# PLease read the GNU Affero General Public License in6# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.7"""8✘ Commands Available -9 10•`{i}schedule <text/reply to msg> <time>`11    In time u can use second as number, or like 1h or 1m12    eg. `{i}schedule Hello 100` It deliver msg after 100 sec.13    eg. `{i}schedule Hello 1h` It deliver msg after an hour.14"""15from datetime import timedelta16 17from pyUltroid.fns.admins import ban_time18 19from . import get_string, ultroid_cmd20 21 22@ultroid_cmd(pattern="schedule( (.*)|$)", fullsudo=True)23async def _(e):24    x = e.pattern_match.group(1).strip()25    xx = await e.get_reply_message()26    if x and not xx:27        y = x.split(" ")[-1]28        k = x.replace(y, "")29        if y.isdigit():30            await e.client.send_message(31                e.chat_id, k, schedule=timedelta(seconds=int(y))32            )33            await e.eor(get_string("schdl_1"), time=5)34        else:35            try:36                z = ban_time(y)37                await e.respond(k, schedule=z)38                await e.eor(get_string("schdl_1"), time=5)39            except BaseException:40                await e.eor(get_string("schdl_2"), time=5)41    elif xx and x:42        if x.isdigit():43            await e.respond(xx, schedule=timedelta(seconds=int(x)))44            await e.eor(get_string("schdl_1"), time=5)45        else:46            try:47                z = ban_time(x)48                await e.respond(xx, schedule=z)49                await e.eor(get_string("schdl_1"), time=5)50            except BaseException:51                await e.eor(get_string("schdl_2"), time=5)52    else:53        return await e.eor(get_string("schdl_2"), time=5)54