skip to Main Content

Defining MainButton.onClick() for Telegram Webapp correcly – Telegram API

I am trying to define window.Telegram.WebApp.MainButton.onClick() functionality to use the most recent values. Lets see through code: // selectedRegions is an array of strings const [selectedRegions, setSelectedRegions] = React.useState([""]); React.useEffect(() => { window.Telegram?.WebApp.MainButton.onClick(() => { // window.Telegram.WebApp.sendData(selectedRegions); alert("main button clicked");…

VIEW QUESTION

Telegram bot polling function – Telegram API

This is my first time trying to make a telegram bot. Code: import os import telebot API_TOKEN = os.getenv('API_KEY') bot = telebot.TeleBot(API_TOKEN) @bot.message_handler(commands=['hello']) def send_welcome(message): bot.reply_to(message, "HI!") bot.polling() Error: Traceback (most recent call last): File "/Users/anshtyagi/Documents/telegram bot/main.py", line 23, in…

VIEW QUESTION
Back To Top
Search