@@ -11,20 +11,31 @@ async def _send(self, args: argparse.Namespace):
11
11
user_id = int (args .user ) if args .user else - 1
12
12
group_id = int (args .group ) if args .group else - 1
13
13
await sender .send_message (args .message , user_id , group_id )
14
+
15
+ def _stop (self ):
16
+ print ("error: this function is still work in progress" )
17
+ quit ()
14
18
15
19
def parse_arg (self , args ):
16
20
parser = argparse .ArgumentParser (
17
21
description = "QQ Chat Recorder, record your chat history and save them forever." ,
18
22
add_help = True ,
19
23
)
24
+
20
25
subparsers = parser .add_subparsers (dest = "operation" )
21
26
exec_parser = subparsers .add_parser ("send" , help = "Send a message to a user or group." )
22
27
exec_parser .add_argument ("-m" , "--message" , help = "Content of message" , default = None , required = True )
23
28
exec_parser .add_argument ("-u" , "--user" , help = "User ID" , default = None , required = False )
24
29
exec_parser .add_argument ("-g" , "--group" , help = "Group ID" , default = None , required = False )
30
+ exec_parser = subparsers .add_parser ("stop" , help = "Stop the recorder." )
31
+ exec_parser = subparsers .add_parser ("start" , help = "Start the recorder." )
25
32
args_namespace = parser .parse_args ()
26
33
if args_namespace .operation == "send" :
27
34
asyncio .run (self ._send (args_namespace ))
35
+ if args_namespace .operation == "start" :
36
+ return 'start'
37
+ if args_namespace .operation == "stop" :
38
+ self ._stop ()
28
39
29
40
30
41
parser = Parser ()
0 commit comments