Questions tagged [py-telegram-bot-api]

A simple, but extensible Python implementation for the Telegram Bot API.

A Telegram bot API implementation in python.

Homepage: https://github.com/eternnoir/pyTelegramBotAPI

375 questions
10
votes
3 answers

How to make that when you click on the text it was copied pytelegrambotapi

I am writing a telegram to the bot. I ran into such a problem. I need the bot to send a message (text) when clicked on which it was copied (as a token from @BotFather)
DanDyFun
  • 141
  • 1
  • 1
  • 5
7
votes
2 answers

Get photo in telegram bot through pyTelegramBotAPI

I'm trying to develop a simple bot, that can retrieve photo from user and then do several operations with media file. I'm using telebot (https://github.com/eternnoir/pyTelegramBotAPI) for design. As far as I can see from the wiki, I can divide…
dand1
  • 371
  • 2
  • 8
  • 22
6
votes
3 answers

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?
Philippe
  • 299
  • 2
  • 3
  • 13
4
votes
1 answer

Telegram bot logs Error code 409 even though there is single instance running

I have deployed my Telegram bot on Heroku written in Python (PyTelegramBotAPI) before and it was working without any issue. Today I tried to migrate it to Render.com. I stopped my Dyno and deployed it on Render and it logs below error. I tried…
pasindu
  • 529
  • 1
  • 4
  • 16
4
votes
1 answer

Live location in pyTelegramBotAPI

I managed to get the users current location by creating a request that adds a key "share location" to the keyboard. However, I don't want to keep pressing a button each time my location should be updated. Therefore I want to be able to track the…
Anteino
  • 1,044
  • 7
  • 28
4
votes
0 answers

Problem with Telegram webhook on production server

I'm developing Telegram bot based on pyTelegramBotAPI and Django. There is initial code: import json import time from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt import telebot from django.conf import…
4
votes
1 answer

How to check if a user is subscribed to a specific Telegram channel (Python / PyTelegramBotApi)?

I am writing a Telegram bot using the PyTelegramBotApi library, I would like to implement the function of checking the user's subscription to a certain telegram channel, and if there is none, offer to subscribe. Thanks in advance for your answers!
4
votes
2 answers

Using Telegram bot webhook by pyTelegramBotAPI and Flask on pythonanywhere.com

The question is about using webhooks in a Telegram bot using the pyTelegramBotAPI module. I am using pythonanywhere.com to host the bot. The following code works fine: from flask import Flask, request import telebot secret = "A_SECRET_NUMBER" bot =…
4
votes
2 answers

SQLAlchemy + pyTelegramBotAPI: SQLite objects created in a thread can only be used in that same thread

i have a real headache from trying to understand the cause of the following problem. We are using a combination of the following libraries: pyTelegramBotAPI to process requests in a multi-threaded way SQLAlchemy sqlite The SQLAlchemy was first…
d56
  • 825
  • 1
  • 9
  • 26
3
votes
1 answer

telegram bot breaks down when it is used by more than one person

After more than one person uses the bot, the error 2022-06-03 19:46:12,641 (init.py:648 MainThread) ERROR - TeleBot appears: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message text is empty". I read a…
Deoken
  • 33
  • 2
3
votes
1 answer

How to find username from id in telethon

I wanted to know that can I find the username of a public telegram channel from it's public id in telethon? I tried the get_entity method but it is only working for telegram group not channel. So, how can I get the username ?
Utsav Meena
  • 141
  • 1
  • 5
3
votes
1 answer

Using bot.register_next_step_handler in telegram bot I get TypeError: 'NoneType' object is not callable

The idea is to get telegram bot that receives from user some data, handles it, displays the result and then repeats the whole cycle not waiting a command from user. Here is the code: from telebot import TeleBot TOKEN = "" bot =…
3
votes
1 answer

"A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is too long"

I'm trying to retrieve messages from Reddit subreddits using PRAW. It is working properly for most of the cases but I'm getting the following error that the message is too long.I'm using pytelegrambotApi Snippet: import praw import telebot bot =…
3
votes
0 answers

Problem connecting telegram bot through Python

I was trying to set up a telegram bot using Python according to this tutorial. The final script I wrote in Python is import…
3
votes
1 answer

Use an open port when deploying telegram bot using pyTelegramBotAPI to Heroku

While trying to host a Telegram bot written with pyTelegramBotAPI library and aiohttp webhooks, i have encountered a problem: Telegram only supports webhooks on open ports 80, 88, 443 and 8443. Meanwhile, Heroku docs say: Each web process simply…
1
2 3
24 25