File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,31 @@ def new_chat(context: ContextTypes.DEFAULT_TYPE):
35
35
'parts' : ['Sure.' ] # Model's response
36
36
},
37
37
])
38
+ import asyncio
39
+
40
+ import asyncio
41
+ from datetime import datetime
42
+
38
43
async def start (update : Update , _ : ContextTypes .DEFAULT_TYPE ) -> None :
39
44
"""Send a message when the command /start is issued."""
40
45
user = update .effective_user
46
+ message = f"Hi { user .mention_html ()} !\n \n Start sending messages with me to generate a response.\n \n Send /new to start a new chat session."
47
+
48
+ # Get the current date and time
49
+ now = datetime .now ().strftime ("%Y-%m-%d %H:%M:%S" )
50
+
51
+ # Write user details and the timestamp to log file
52
+ with open ('user_log.txt' , 'a' ) as log_file :
53
+ log_file .write (f"{ now } - User { user .id } - { user .username } started the chat.\n " )
54
+
55
+ # Send the greeting message to the user
41
56
await update .message .reply_html (
42
- f"Hi { user . mention_html () } ! \n \n Start sending messages with me to generate a response. \n \n Send /new to start a new chat session." ,
57
+ message ,
43
58
# reply_markup=ForceReply(selective=True),
44
59
)
45
60
46
61
62
+
47
63
async def help_command (update : Update , _ : ContextTypes .DEFAULT_TYPE ) -> None :
48
64
"""Send a message when the command /help is issued."""
49
65
help_text = """
Original file line number Diff line number Diff line change
1
+ User 124235298 - pasou started the chat.
2
+ 2024-05-30 03:59:01 - User 124235298 - pasou started the chat.
You can’t perform that action at this time.
0 commit comments