forked from sultansq/kiu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlanguage.py
56 lines (47 loc) · 1.83 KB
/
language.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
50
51
52
53
54
55
56
from strings import get_string
from AnonX.misc import SUDOERS
from AnonX.utils.database import (get_lang, is_commanddelete_on,
is_maintenance)
def language(mystic):
async def wrapper(_, message, **kwargs):
if await is_maintenance() is False:
if message.from_user.id not in SUDOERS:
return await message.reply_text(
"» البوت تحت الصيانه. من فضلك انتظر بعض الوقت..."
)
if await is_commanddelete_on(message.chat.id):
try:
await message.delete()
except:
pass
try:
language = await get_lang(message.chat.id)
language = get_string(language)
except:
language = get_string("en")
return await mystic(_, message, language)
return wrapper
def languageCB(mystic):
async def wrapper(_, CallbackQuery, **kwargs):
if await is_maintenance() is False:
if CallbackQuery.from_user.id not in SUDOERS:
return await CallbackQuery.answer(
"» البوت تحت الصيانه. من فضلك انتظر بعض الوقت...",
show_alert=True,
)
try:
language = await get_lang(CallbackQuery.message.chat.id)
language = get_string(language)
except:
language = get_string("en")
return await mystic(_, CallbackQuery, language)
return wrapper
def LanguageStart(mystic):
async def wrapper(_, message, **kwargs):
try:
language = await get_lang(message.chat.id)
language = get_string(language)
except:
language = get_string("en")
return await mystic(_, message, language)
return wrapper