Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telegram
- from telegram import KeyboardButton
- from telegram import ReplyKeyboardMarkup
- from telegram.ext import Updater, CommandHandler, MessageHandler
- bot_token = "TOKEN"
- updater = Updater(token=bot_token, use_context=True)
- dispatcher = updater.dispatcher
- def start(update, context):
- contact_keyboard = telegram.KeyboardButton(text="Share contact", request_contact=True)
- custom_keyboard = (contact_keyboard)
- reply_markup = telegram.ReplyKeyboardMarkup (custom_keyboard)
- first_name = update.message.from_user.first_name
- msg = "Hello {} to access the group you need to share your phone contact".format (first_name)
- context.bot.sendMessage(chat_id=update.message.chat_id, text=msg)
- start_handler = CommandHandler('start', start)
- dispatcher.add_handler(start_handler)
- def echo(update, context):
- context.bot.sendMessage(chat_id=update.message.chat_id,text="Error,enter your contact number")
- echo_handler=MessageHandler(Filters.text,echo)
- dispatcher.add_handler(echo_handler)
- updater.start_polling()
- updater.idle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement