382 questions
1
vote
1
answer
190
views
Userbot Telegram API
I am creating a userbot. I can't figure out how to implement it: when I am offline from Telegram (I exit the app), it automatically changes the name in one way and when I am online in another. I can't ...
-1
votes
1
answer
108
views
How to make Telebot respond "I don't understand" when user sends unknown text? [duplicate]
I’m making a Telegram bot using Python and the telebot (pyTelegramBotAPI) library.
I created a basic telegram bot for practice, and I want bot to say “Sorry, I don’t understand” when a user sends a ...
0
votes
0
answers
72
views
Problem in deploying telegram bot in Render. There is no error but the bot does not respond to /latestjobs
import os
from flask import Flask
from threading import Thread
from telegram import Update
from telegram.ext import (
ApplicationBuilder,
CommandHandler,
ContextTypes,
)
import ...
1
vote
0
answers
82
views
How to suppress "Traceback" when it loses connection with Telegram bot
I'm developing and building a Python script for Telegram bot. I was adding the following codes in a script to report any error via output from Linux terminal:
logging.basicConfig(
format='%(...
1
vote
1
answer
160
views
Is there a method to accept pending requests for membership in a channel or group?
For Python telegram bot is there a method to accept pending requests for membership in a channel or group?
def get_pending_requests(update: Update, context: CallbackContext):
try:
...
2
votes
1
answer
164
views
How to prevent Python Telebot from duplicating messages?
I've got a problem with Python Telebot, here is my code:
import telebot
token = 'token'
bot = telebot.TeleBot(token)
@bot.message_handler(func=lambda message: True)
def start(message):
bot....
0
votes
0
answers
38
views
Python Telegram bot freezes when run by Airflow
I'm trying to execute a Python Telegram Bot through an Airflow DAG. The DAG works and execute the bot, but it don't do any response to the commands.
When I execute the file manually it do the ...
0
votes
0
answers
21
views
Why doesn't seem to be able to send an audio file with FRONT_COVER on the Pytelegrambotapi
In general the problem is that the audio file is sent to a file without a picture. I first thought that the problem is that the picture is installed on the wrong version of id3, and tried four methods ...
0
votes
2
answers
363
views
how to count the number of reactions of a post in a channel. pyTelegramBotAPI?
I'm trying to create a chatbot that will read the number of reactions and send them to me. In the pyTelegramBotAPI documentation, I found the message_reaction_count_handler and ...
0
votes
1
answer
81
views
[PyTelegramBotAPI]Error Sending Media Group with Video and Thumbnail: BufferedReader is Not JSON Serializable
I'm encountering an issue using PyTelegramBotApi that's driving me crazy. I want to send a media group message from my bot to a channel. The media group contains a single video with a custom thumbnail....
2
votes
1
answer
63
views
Telebot. @bot.callback_query_handler isn't working
Can somebody tell me what am I doing wrong? The bot sends me an inline keyboard, but after clicking the button, I do not receive any callbacks (even the logger doesn't send anything).
Also, if I pass ...
0
votes
0
answers
126
views
problem of not having all YouTube video qualities in the yt-dlp list
so basically i'm trying to build telegram bot using telebot (pyTelegramBotAPI) library and yt-dlp so that the user can download the video he wants with the quality he wants.
also because yt-dlp shows ...
0
votes
0
answers
687
views
Telegram stars payment invalid
I made a telegram bot integrated with mongodb to handle payments through getting telegram stars from users, but I get the error
telebot.apihelper.ApiTelegramException: A request to the Telegram API ...
0
votes
1
answer
32
views
Python peewee ORM Error: 'no such table: Tasks'
I'm struggling with peewee in python. My configuration for project is Python + pyTelegramBotAPI + Sqlite3 + peewee. My telegram bot is the task manager (learning project). Here's my code for getting ...
0
votes
1
answer
91
views
how to let userBot and my bot work together?
I'm trying to build telegram bot which forwards msgs from a specific channel to the bot using userBot and then the bot should react automatically to the forwarded msg
@client.on(events.NewMessage(...
1
vote
1
answer
675
views
Telegram Bot: How to Download Multiple Photos from the Same media_group_id in a Single Update?
This question is a followup from the following question asked in a previous post.
This is my code block to download all photos from a telegram bot within the same media_group_id context.
async def ...
-1
votes
1
answer
1k
views
Opening direct chat from within Telegram Mini-app
I have been trying to create a feature in my telegram mini-app where a user can open a direct chat with another user by clicking on an icon. The methods i have tried dont open up any chat.
I have ...
0
votes
1
answer
164
views
ChatOrUserPicker modal window in telebot API
Is there any functionality in the telebot framework that would allow me to show up a modal window with chat selection when the inline button in the telegram bot is pressed, so that the user selects a ...
0
votes
1
answer
133
views
How do I fix AttributeError: 'NoneType' object has no attribute 'bot'?
This is the code:
AttributeError: 'NoneType' object has no attribute 'bot'
from telegram.ext import CallbackContext
from telegram import Bot
import os
# Initialize your bot with the token from ...
1
vote
1
answer
984
views
Send message from bot to another bot telegram
Basically I want my bot to text another bot, I want to achieve this so that I can text bots like if I was a new user since my bots telegram Id is different, so far i see that's not possible, that ...
0
votes
0
answers
48
views
FileNotFoundError: [WinError 2] The system cannot find the file specified (telegram-bot)
Im trying to make this script run on telegram which works fine until i send a picture to the bot and it gives me this error.
I am trying to run this script:
import os
import subprocess
from telegram ...
-1
votes
1
answer
221
views
Telegram bot, Response to button click not sending
I'm making a telegram bot formula assistant. There is a problem that when you press the "Mechanics" button, the bot responds, but when you press "Electrical and magnetic phenomena" ...
-1
votes
1
answer
102
views
Error when entering data via Telegram bot for the second time
Error when creating a telegram bot, when entering the Name/Email/Phone, I ask him to do this again, then he gives me the following error message:
<HttpError 400 when requesting https://sheets....
1
vote
1
answer
3k
views
How to safely transfer data from Telegram Mini App to Django+pyTelegramBotAPI without closing the app
I tried using WebApp.sendData, but it closes the app. I guess I should use POST to send data from browser, but I don't know how do I make the backend know the telegram ID of a user whose Mini App ...
-5
votes
2
answers
417
views
nameerror : name 'bot' is not defined
i am trying to create a telegram bot and its having issues
import os
import telebot
my_secret = os.environ['Example']
@bot.message_handler(command=['Greet'])
def greet(message):
bot.reply_to(...
0
votes
0
answers
50
views
Telegram bot continues to process the request instead of restarting
There is a working Telegram bot that sends a greeting and offers to submit a request. It sends the result to a specific user in a Telegram chat.
However, if during the request submission process, the ...
0
votes
2
answers
594
views
PyTelegrambotApi — @callback_query_handler does not work
I'm trying to create my first telegram bot with PyTelegrambotApi, but I encountered a weird problem: I get no callback after I press any inline buttons. Nothing happens. According to the documentation ...
0
votes
0
answers
621
views
Error - "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message is too long"
I created a telegram bot in python, Used py-telegram-bot-api and telebot libraries, after launch it gives error.
I also used different APIs, the result is the same
The main purpose of the code is to ...
0
votes
1
answer
852
views
Telegram bot can't send a message from another thread, Request Timeout
I use async version of pyTelegramBotApi for a Telegram bot part. I use vk-api for a VK part (not sure if that matters).
I have a bot that monitors other social network (Vkontakte) and, on some ...
2
votes
1
answer
927
views
Having problems with "ton" library in python
I'm using ton library and Python. This is the code I'm trying to run:
from ton.sync import TonlibClient
client = TonlibClient()
TonlibClient.enable_unaudited_binaries()
client.init_tonlib()
seed = &...
0
votes
1
answer
199
views
It is a Telegram bot API bug?
Working with the bots API.
When I try to use /sendmessage function:
https://core.telegram.org/bots/api#sendmessage
if the text var contains " H" (blank space + H), the message is not sent. ...
0
votes
1
answer
491
views
i have problems with pytube and telegram bot
I have a telegram bot that downloads videos from youtube.
i have 2 problems.
I used the pytube library to create the bot. shows age limit error while downloading some videos. How to avoid this.
I ...
0
votes
1
answer
383
views
How to detect user's reaction such as "thumbs up", "like", "dislike" on the message of the channel
The code below detects nothing when I click the "like" on the channel. I don't know what's wrong with my code.
# pyTelegramBotAPI Version 4.14.1
import telebot
from telebot import ...
1
vote
0
answers
154
views
auth_key generation failed 5 time(s)
I'm unable to connect to Telegram using Telethon.
client = TelegramClient('sessions/'+api_hash, api_id, api_hash)
logging.basicConfig(level=logging.DEBUG)
client.start()
See the log bellow.
INFO:...
0
votes
0
answers
30
views
Can't solve a problem with the handler when writing a music tg bot
I am writing a telebot bot that will be able to store songs from the user in the sqlite3 database and display information about the songs. Now the part with the addition of songs is ready. That is, ...
1
vote
0
answers
390
views
How to handle authentication with Telegram Bot in Django-rest-framework
I've reviewed all related questions, but I'm currently facing a problem for which I'm uncertain about the best approach. I have a web application built with Django and django-allauth. Telegram Bot ...
2
votes
1
answer
3k
views
Disable preview for a specific link in Telegram bot API
Does anyone know if a bot sets the disable_web_page_preview: false in sendMessage method and sends a link as part of a message, can I somehow programmatically disable the preview for a this (one) link?...
0
votes
0
answers
494
views
How to get the bytes of a photo file from Telegram without saving the file?
I'm working on a telegram bot that receives a photo with a barcode.
I interact with the Telegram API through the Telebot module
The photo is processed, the barcode is recognized and stored in the ...
1
vote
1
answer
2k
views
How to get ALL topics for telegram supergroup using TelegramAPI
I need to get all topics for my telegram group using python3 and pyTelegramBotAPI library. How can I do it?
Thanks!
I can get topic ID during creating. But can't get all topics list. Or may be I dont ...
0
votes
1
answer
140
views
The bot crashes when people write to it
The bot crashes when it receives any message that is not related to pressing a button, I tried to fix it through ChatGPT by adding a function that when the bot receives a message, it responds "...
0
votes
1
answer
953
views
Python telebot not working properly while executing scripts from my server
I've created a telegram bot using telebot or pyTelegramBotAPI and created a command in it that let's users execute a python script from my server the script actually scrapes information from lots of ...
0
votes
2
answers
433
views
How to restrict sending multiple images in one message from a user to a telegram bot?
I'm making a telegram bot in Python that edits an image.
Tell me how to make it so that the user can send only one image in a message? But how can you control the number of images in a message from a ...
0
votes
1
answer
686
views
How to print user's message in telegram bot?
I'm making a telegram bot that supposed to ask users for ID and print it out in terminal
import telebot
from time import sleep
bot = telebot.TeleBot('BOT TOKEN')
from telebot import types
...
0
votes
1
answer
3k
views
How to get the user ID of all the users in a group/channel in Telegram using Python?
I am trying to get the user ID of all the users in a group/channel in Telegram using Python. I have tried using the get_chat_members() method in the telebot library, but this method is not available.
...
-1
votes
1
answer
395
views
Can telegram bot create a group after setting a certain command?
Can the bot create a group chat after setting a certain command?
E.g., a user pushes a button and a new chat is created for him and another user
I know that in the previous Telegram APIs bot cannot do ...
0
votes
1
answer
256
views
i want to download images with pytelegrambotapi with good quality , but i cant
I want to download images with pytelegrambotapi with good quality,
I use this code, its ok and works, but it download images with bad quality.
@bot.message_handler(content_types=['document', 'photo', '...
0
votes
2
answers
421
views
i want to get channel history whith pytelegrambotapi
I want to select all the posts that already exist in a Telegram channel with py-telegram-bot-api and send them somewhere
i used get_chat_history but py-telegram-bot-api has no this attribute.
0
votes
1
answer
1k
views
Can't stop a bot without stopping the entire process in pyTelegramBotAPI
I've been scratching my head on this for 6 hours now. I am trying to stop my bot, without stopping the entire process. The condition for a bot polling stop is supposed to be that the variable ID is ...
0
votes
0
answers
464
views
I keep getting Bad Request Error from Telegram Api
I really don't get why I have not been able to send inline links through telegram API, any solution?
I have previously tried using html inline link format but it's always giving me bad request. What ...
1
vote
2
answers
7k
views
Telegram Bot Error Code 409 Despite There Being a Single Instance Running
When running the below file I get the following error code 409 despite trying everything to ensure that I only have one local process making the infinity_polling() call. I have looked through all of ...