-
Notifications
You must be signed in to change notification settings - Fork 1
/
help.py
145 lines (137 loc) · 4.57 KB
/
help.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
from typing import Union
from pyrogram import filters, types
from pyrogram.types import InlineKeyboardMarkup, Message
import config
from config import BANNED_USERS
from strings import get_command, get_string, helpers
from AnonX import app
from AnonX.misc import SUDOERS
from AnonX.utils import help_pannel
from AnonX.utils.database import get_lang, is_commanddelete_on
from AnonX.utils.decorators.language import (LanguageStart,
languageCB)
from AnonX.utils.inline.help import (help_back_markup,
private_help_panel)
from strings.filters import command
### Command
HELP_COMMAND = get_command("HELP_COMMAND")
@app.on_message(
command(HELP_COMMAND)
& filters.private
& ~BANNED_USERS
)
@app.on_callback_query(
filters.regex("settings_back_helper") & ~BANNED_USERS
)
async def helper_private(
client: app, update: Union[types.Message, types.CallbackQuery]
):
is_callback = isinstance(update, types.CallbackQuery)
if is_callback:
try:
await update.answer()
except:
pass
chat_id = update.message.chat.id
language = await get_lang(chat_id)
_ = get_string(language)
keyboard = help_pannel(_, True)
if update.message.photo:
await update.edit_message_text(
_["help_1"].format(config.SUPPORT_HEHE), reply_markup=keyboard
)
else:
await update.edit_message_text(
_["help_1"].format(config.SUPPORT_HEHE), reply_markup=keyboard
)
else:
chat_id = update.chat.id
if await is_commanddelete_on(update.chat.id):
try:
await update.delete()
except:
pass
language = await get_lang(chat_id)
_ = get_string(language)
keyboard = help_pannel(_)
await update.reply_sticker("CAACAgUAAxkBAAIjVmKPYTFByKZlCo9d8mUv8QVAJEw7AAL9BQACiy14VGoQxOCDfE1KJAQ")
await update.reply_photo(
photo=config.START_IMG_URL,
caption=_["help_1"].format(config.SUPPORT_HEHE), reply_markup=keyboard)
@app.on_message(
filters.command(HELP_COMMAND)
& filters.group
& ~filters.edited
& ~BANNED_USERS
)
@LanguageStart
async def help_com_group(client, message: Message, _):
keyboard = private_help_panel(_)
await message.reply_photo(
photo=config.START_IMG_URL,
caption=_["help_2"], reply_markup=InlineKeyboardMarkup(keyboard)
)
@app.on_callback_query(filters.regex("help_callback") & ~BANNED_USERS)
@languageCB
async def helper_cb(client, CallbackQuery, _):
callback_data = CallbackQuery.data.strip()
cb = callback_data.split(None, 1)[1]
keyboard = help_back_markup(_)
if cb == "hb9":
if CallbackQuery.from_user.id not in SUDOERS:
return await CallbackQuery.answer(
"This button is only for sudoers.", show_alert=True
)
else:
await CallbackQuery.edit_message_text(
helpers.HELP_9, reply_markup=keyboard
)
return await CallbackQuery.answer()
try:
await CallbackQuery.answer()
except:
pass
if cb == "hb1":
await CallbackQuery.edit_message_text(
helpers.HELP_1, reply_markup=keyboard
)
elif cb == "hb2":
await CallbackQuery.edit_message_text(
helpers.HELP_2, reply_markup=keyboard
)
elif cb == "hb3":
await CallbackQuery.edit_message_text(
helpers.HELP_3, reply_markup=keyboard
)
elif cb == "hb4":
await CallbackQuery.edit_message_text(
helpers.HELP_4, reply_markup=keyboard
)
elif cb == "hb5":
await CallbackQuery.edit_message_text(
helpers.HELP_5, reply_markup=keyboard
)
elif cb == "hb6":
await CallbackQuery.edit_message_text(
helpers.HELP_6, reply_markup=keyboard
)
elif cb == "hb7":
await CallbackQuery.edit_message_text(
helpers.HELP_7, reply_markup=keyboard
)
elif cb == "hb8":
await CallbackQuery.edit_message_text(
helpers.HELP_8, reply_markup=keyboard
)
elif cb == "hb10":
await CallbackQuery.edit_message_text(
helpers.HELP_10, reply_markup=keyboard
)
elif cb == "hb11":
await CallbackQuery.edit_message_text(
helpers.HELP_11, reply_markup=keyboard
)
elif cb == "hb12":
await CallbackQuery.edit_message_text(
helpers.HELP_12, reply_markup=keyboard
)