问题
I would like to make the button that will open URL (external hyperlink) in browser from Telegram chat. Currently, I developed only clickable action buttons.
update.message.reply_text(
'Subscribe to us on Facebook and Telegram:',
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton(text='on Facebook', callback_data='Facebook')],
[InlineKeyboardButton(text='on Telegram', callback_data='Telegram')],
])
)
But how to make them as link (with arrow). I want to ask for users for sharing.
回答1:
Instead of callback_data
argument you can use url
and that's it.
update.message.reply_text(
'Subscribe to us on Facebook and Telegram:',
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton(text='on Facebook', url='https://facebook.com')],
[InlineKeyboardButton(text='on Telegram', url='https://t.me')],
])
)
来源:https://stackoverflow.com/questions/62892272/how-to-add-url-to-inlinekeyboardbutton-for-telegram-bot