Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyTelegramBotAPI disable link preview

Currently writing my first bot using pyTelegramBotAPI. I want to disable link previews on certain messages. How do I do this?

like image 913
Philippe Avatar asked May 07 '26 18:05

Philippe


1 Answers

It looks like there is an disable_web_page_preview parameter on the sendMessage method.

tb = telebot.TeleBot(TOKEN)
tb.send_message(123456, "Hi <link>", disable_web_page_preview=True)

Original code;

def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
                 parse_mode=None, disable_notification=None):
like image 50
0stone0 Avatar answered May 10 '26 06:05

0stone0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!