this post was submitted on 04 Jul 2023
1 points (100.0% liked)

Telegram Bots

41 readers
0 users here now

founded 1 year ago
MODERATORS
 
This is an automated archive made by the Lemmit Bot.

The original was posted on /r/telegrambots by /u/DX_ashh on 2023-06-19 18:59:50+00:00.


im having trouble getting webhooks to work. i have a server running on pythonanywhere. and i have set up run_webhooks() with proper prompts. when i use a command eg /start it sends the request to the server but its not responding/working. im using flask, python telegram bot and python anywhere

class TeleBot:
    def __init__(self):
        self.bot_api = bot_api
        self.application = ApplicationBuilder().token(self.bot_api).build()

    def addhandler(self):
        start_handler = CommandHandler('start', self.start, filters=filters.COMMAND)

        self.application.add_handler(start_handler)
        print('added')

        self.application.run_webhook(
                listen='0.0.0.0',
                port=8443,
                url_path='',
                secret_token='secretphrase',
                key='private.key',
                webhook_url=f'https://api.telegram.org/bot%7Bbot_api%7D/setWebhook?url=https%3A%2F%2F%7Bmy_username%7D.pythonanywhere.com%2F',
            )

    async def start(self, update, context):
        print('ping')
        chat_id = update.effective_chat.id
        await context.wizardBot.sendMessage(chat_id=chat_id, text='Hey')

if __name__ == '__main__':
    telebot = TeleBot()
    telebot.addhandler()

server log:

+0000] "POST / HTTP/1.1" 200 17 "-" "-"

is just not returning the bot to send a message or anything

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here