-
Notifications
You must be signed in to change notification settings - Fork 1
/
autoend.py
33 lines (30 loc) · 1.25 KB
/
autoend.py
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
from pyrogram import filters
import config
from strings import get_command
from AnonX import app
from AnonX.misc import SUDOERS
from AnonX.utils.database import autoend_off, autoend_on
from AnonX.utils.decorators.language import language
from strings.filters import command
# Commands
AUTOEND_COMMAND = get_command("AUTOEND_COMMAND")
@app.on_message(
command(AUTOEND_COMMAND)
& SUDOERS
)
async def auto_end_stream(client, message):
usage = "**ᴜsᴀɢᴇ:**\n\n/autoend [enable|disable]"
if len(message.command) != 2:
return await message.reply_text(usage)
state = message.text.split(None, 1)[1].strip()
state = state.lower()
if state == "enable":
await autoend_on()
await message.reply_text(
"ᴀᴜᴛᴏ ᴇɴᴅ sᴛʀᴇᴀᴍ ᴇɴᴀʙʟᴇᴅ.\n\nᴀssɪsᴛᴀɴᴛ ᴡɪʟʟ ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ʟᴇᴀᴠᴇ ᴛʜᴇ ᴠɪᴅᴇᴏᴄʜᴀᴛ ᴀғᴛᴇʀ ғᴇᴡ ᴍɪɴs ᴡʜᴇɴ ɴᴏ ᴏɴᴇ ɪs ʟɪsᴛᴇɴɪɴɢ ᴡɪᴛʜ ᴀ ᴡᴀʀɴɪɴɢ ᴍᴇssᴀɢᴇ."
)
elif state == "disable":
await autoend_off()
await message.reply_text("ᴀᴜᴛᴏ ᴇɴᴅ sᴛʀᴇᴀᴍ ᴅɪsᴀʙʟᴇᴅ.")
else:
await message.reply_text(usage)