Skip to content

Commit

Permalink
🍎
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince-Mendiratta authored Oct 17, 2019
1 parent 8cedf81 commit e008dd7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions userbot/plugins/schd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Schedule Plugin for @UniBorg
Syntax: .schd <time_in_seconds> ;=; <message to send>"""
from telethon import events
import asyncio
from userbot.utils import admin_cmd


@register(admin_cmd("schd ?(.*)"))
async def _(event):
if event.fwd_from:
return
input_str = event.pattern_match.group(1)
ttl = 0
message = "SYNTAX: `.schd <time_in_seconds> = <message to send>`"
if input_str:
await event.delete()
if "=" in input_str:
ttl, message = input_str.split("=")
elif event.reply_to_msg_id:
await event.delete()
ttl = int(input_str)
message = await event.get_reply_message()
await asyncio.sleep(int(ttl))
await event.respond(message)
else:
await event.edit(message)

0 comments on commit e008dd7

Please sign in to comment.