@@ -74,6 +74,7 @@ async def decline_user(
7474async def join_request_callback (update : Update , context : ContextTypes .DEFAULT_TYPE ) -> None :
7575 join_request = cast (ChatJoinRequest , update .chat_join_request )
7676 user = join_request .from_user
77+ user_chat_id = join_request .user_chat_id
7778 chat_id = join_request .chat .id
7879 jobs = cast (JobQueue , context .job_queue ).get_jobs_by_name (f"JOIN_TIMEOUT { chat_id } { user .id } " )
7980 if jobs :
@@ -87,6 +88,8 @@ async def join_request_callback(update: Update, context: ContextTypes.DEFAULT_TY
8788 user_data .setdefault (int (chat_id ), {}).setdefault ("received join request" , []).append (
8889 get_dtm_str ()
8990 )
91+ user_data [int (chat_id )]["user_chat_id" ] = user_chat_id
92+ user_data [int (chat_id )]["user_id" ] = user .id
9093
9194 text = (
9295 f"Hi, { user .mention_html ()} ! I'm { context .bot .bot .mention_html ()} , the "
@@ -104,7 +107,9 @@ async def join_request_callback(update: Update, context: ContextTypes.DEFAULT_TY
104107 )
105108 )
106109 try :
107- message = await user .send_message (text = text , reply_markup = reply_markup )
110+ message = await context .bot .send_message (
111+ chat_id = user_chat_id , text = text , reply_markup = reply_markup
112+ )
108113 except Forbidden :
109114 # If the user blocked the bot, let's give the admins a chance to handle that
110115 # TG also notifies the user and forwards the message once the user unblocks the bot, but
@@ -155,9 +160,7 @@ async def join_request_buttons(update: Update, context: ContextTypes.DEFAULT_TYP
155160 if "User_already_participant" not in exc .message :
156161 raise exc
157162
158- context .application .create_task (
159- user .send_message ("Nice! Have fun in the group 🙂" ), update = update
160- )
163+ await user .send_message ("Nice! Have fun in the group 🙂" )
161164 reply_markup = None
162165 else :
163166 user_data .setdefault (int (chat_id ), {}).setdefault ("pressed button 1" , []).append (
0 commit comments