MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / newmember

Function newmember

examples/create_invite_link.py:17–28  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

15#Get notified of incoming members in group
16@bot.message_handler(content_types=['new_chat_members'])
17def 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

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
send_messageMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…