forked from sultansq/kiu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaintenance.py
49 lines (46 loc) · 1.65 KB
/
maintenance.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from pyrogram import filters
from pyrogram.types import Message
from strings.filters import command
from strings import get_command, get_string
from AnonX import app
from AnonX.misc import SUDOERS
from AnonX.utils.database import (get_lang, is_maintenance,
maintenance_off,
maintenance_on)
from AnonX.utils.decorators.language import language
# Commands
MAINTENANCE_COMMAND = get_command("MAINTENANCE_COMMAND")
@app.on_message(
command(MAINTENANCE_COMMAND)
& SUDOERS
)
async def maintenance(client, message: Message):
try:
language = await get_lang(message.chat.id)
_ = get_string(language)
except:
_ = get_string("en")
usage = _["maint_1"]
if len(message.command) != 2:
return await message.reply_text(usage)
message.chat.id
state = message.text.split(None, 1)[1].strip()
state = state.lower()
if state == "enable":
if await is_maintenance() is False:
await message.reply_text(
"ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ ᴍᴏᴅᴇ ɪs ᴀʟʀᴇᴀᴅʏ ᴇɴᴀʙʟᴇᴅ."
)
else:
await maintenance_on()
await message.reply_text(_["maint_2"])
elif state == "disable":
if await is_maintenance() is False:
await maintenance_off()
await message.reply_text(_["maint_3"])
else:
await message.reply_text(
"ɪ ᴅᴏɴ'ᴛ ʀᴇᴍᴇᴍʙᴇʀ ᴛʜᴀᴛ ʏᴏᴜ ᴇɴᴀʙʟᴇᴅ ᴍᴀɪɴᴛᴇɴᴀɴᴄᴇ ᴍᴏᴅᴇ."
)
else:
await message.reply_text(usage)