6
6
from pyrogram .types import (CallbackQuery , InlineKeyboardButton ,
7
7
InlineKeyboardMarkup , Message )
8
8
9
- from spr import conn , session , spr
9
+ from spr import BOT_USERNAME , conn , session , spr
10
+ from spr .core import ikb
10
11
from spr .modules import MODULES
11
12
from spr .utils .misc import once_a_day , paginate_modules
12
13
@@ -43,12 +44,36 @@ async def main():
43
44
@spr .on_message (filters .command (["help" , "start" ]), group = 2 )
44
45
async def help_command (_ , message : Message ):
45
46
if message .chat .type != "private" :
46
- return await message .reply ("Pm Me For Help" )
47
- text , keyboard = await help_parser (message .from_user .mention )
48
- await message .reply_text (
49
- text ,
50
- reply_markup = keyboard ,
51
- quote = False ,
47
+ kb = ikb ({"Help" : f"t.me/{ BOT_USERNAME } ?start=help" })
48
+ return await message .reply ("Pm Me For Help" , reply_markup = kb )
49
+ kb = ikb (
50
+ {
51
+ "Help" : "bot_commands" ,
52
+ "Repo" : "https://github.com/TheHamkerCat/SpamProtectionRobot" ,
53
+ "Add Me To Your Group" : f"https://t.me/{ BOT_USERNAME } ?startgroup=new" ,
54
+ "Support Chat (for now)" : "https://t.me/WBBSupport" ,
55
+ }
56
+ )
57
+ mention = message .from_user .mention
58
+ await message .reply_photo (
59
+ "https://hamker.me/logo_3.png" ,
60
+ caption = f"Hi { mention } , I'm SpamProtectionRobot,"
61
+ + " Choose An Option From Below." ,
62
+ reply_markup = kb ,
63
+ )
64
+
65
+
66
+ @spr .on_callback_query (filters .regex ("bot_commands" ))
67
+ async def commands_callbacc (_ , cq : CallbackQuery ):
68
+ text , keyboard = await help_parser (cq .from_user .mention )
69
+ await asyncio .gather (
70
+ cq .answer (),
71
+ cq .message .delete (),
72
+ spr .send_message (
73
+ cq .message .chat .id ,
74
+ text = text ,
75
+ reply_markup = keyboard ,
76
+ ),
52
77
)
53
78
54
79
@@ -58,10 +83,9 @@ async def help_parser(name, keyboard=None):
58
83
paginate_modules (0 , HELPABLE , "help" )
59
84
)
60
85
return (
61
- f"""Hello { name } , I'm SpamProtectionRobot,
62
- And i can protect your group from Spam and NSFW media,
63
- Just add me to your group and i'll keep your group clean from spammers
64
- Choose an option from below.""" ,
86
+ f"Hello { name } , I'm SpamProtectionRobot, I can protect "
87
+ + "your group from Spam and NSFW media using "
88
+ + "machine learning. Choose an option from below." ,
65
89
keyboard ,
66
90
)
67
91
@@ -73,11 +97,12 @@ async def help_button(client, query: CallbackQuery):
73
97
next_match = re .match (r"help_next\((.+?)\)" , query .data )
74
98
back_match = re .match (r"help_back" , query .data )
75
99
create_match = re .match (r"help_create" , query .data )
76
- top_text = f"""
77
- Hello { query .from_user .first_name } , I'm SpamProtectionRobot,
78
- And i can protect your group from Spam and NSFW media,
79
- Just add me to your group and i'll keep your group clean from spammers
80
- You can choose an option below."""
100
+ u = query .from_user .mention
101
+ top_text = (
102
+ f"Hello { u } , I'm SpamProtectionRobot, I can protect "
103
+ + "your group from Spam and NSFW media using "
104
+ + "machine learning. Choose an option from below."
105
+ )
81
106
if mod_match :
82
107
module = mod_match .group (1 )
83
108
text = (
0 commit comments