(msg)
| 15 | #Get notified of incoming members in group |
| 16 | @bot.message_handler(content_types=['new_chat_members']) |
| 17 | def newmember(msg): |
| 18 | #Create an invite link class that contains info about the created invite link using create_chat_invite_link() with parameters |
| 19 | invite = bot.create_chat_invite_link(Group_ID, member_limit=1, expire_date=int(time())+45) #Here, the link will auto-expire in 45 seconds |
| 20 | InviteLink = invite.invite_link #Get the actual invite link from 'invite' class |
| 21 | |
| 22 | mrkplink = InlineKeyboardMarkup() #Created Inline Keyboard Markup |
| 23 | mrkplink.add(InlineKeyboardButton("Join our group 🚀", url=InviteLink)) #Added Invite Link to Inline Keyboard |
| 24 | |
| 25 | bot.send_message(msg.chat.id, f"Hey there {msg.from_user.first_name}, Click the link below to join our Official Group.", reply_markup=mrkplink) |
| 26 | |
| 27 | #This will send a message with the newly-created invite link as markup button. |
| 28 | #The member limit will be 1 and expiring time will be 45 sec. |
| 29 | |
| 30 | |
| 31 |
nothing calls this directly
no test coverage detected
searching dependent graphs…