Questions tagged [python-telegram-bot]

This is a Python library that wraps around the Telegram Bot API. Note that this is not a general tag for "Telegram bots written with Python", but only for question about this particular library.

This is a library that wraps around the bot HTTP API. It is compatible with only (please check the PyPi/GitHub page for detailed info).

Telegram Bot API

The Telegram Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.

1454 questions
8
votes
3 answers

Telegram check if user is admin

I am using the telegram bot api to make a bot. I have some commands that can only be sent from admins. Like kick and ban commands. How do I check if the sender is an admin or not? I am using the python-telegram-bot api. I do not want everyone to be…
ICanKindOfCode
  • 1,000
  • 1
  • 11
  • 32
8
votes
1 answer

How do I get the user profile picture of someone using the Telegram bot chat API?

I'm making a basic Control Panel for managing my Bot with PHP. Basically I want to display the Profile picture / avatar of the user who is sending message to the bot. However the user object has no photo_id, so is there way to get the user's avatar?
user8454964
8
votes
3 answers

(python) Telegram bot- how to send messages periodically?

I have a dilemma regarding my telegram bot. Let's say I have to create a function that will ask, every user connected to the bot, one time per week/month, a question: def check_the_week(bot, update): reply_keyboard = [['YES',…
Vasile
  • 801
  • 2
  • 13
  • 31
7
votes
2 answers

ImportError: cannot import name 'Filters' from 'telegram.ext'

I have installed python-telegram-bot like this: pip install python-telegram-bot And when I'm trying to do this: from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext I get this error: ImportError: cannot import…
Adil Akram
  • 81
  • 1
  • 1
  • 3
7
votes
3 answers

How to get message from logging function?

I have a logger function from logging package that after I call it, I can send the message through logging level. I would like to send this message also to another function, which is a Telegram function called SendTelegramMsg(). How can I get the…
Guilherme Matheus
  • 573
  • 10
  • 30
7
votes
1 answer

How to use python-telegram-bot to send messages to a telegram channel

I created a telegram bot and added it to my telegram channel. Now, I want to use it to send messages to my channel, when something is happening in my python program. For example, I have a python program that checks the weather every 15 secs, and…
Tom
  • 71
  • 1
  • 1
  • 2
7
votes
2 answers

Get last message/s from Telegram channel with Python

I'm using the python-telegram-bot library to write a bot in Python that sends URLs into a channel where the bot is administrator. Now, I would like to have the bot reading, let's say, the last 5 messages (I don't really care about the number as I…
7
votes
2 answers

sampling audio doesn't preserve waves (vectors)!

I made a Telegram robot, and one of its jobs is to create samples from audio files. Now for most audios that is sent to it, the sample is perfectly fine; something like this: However, for some audios, the sample looks a bit odd: As you can see,…
Amir Shabani
  • 3,857
  • 6
  • 30
  • 67
7
votes
3 answers

How to use Jobqueue in Python-telegram-bot

I have able to make a bot very easily by reading the docs but Jobqueue is not working as per it is written. The run_daily method uses a datetime.time object to send the message at a particular time but this code neither does its job of sending a…
7
votes
1 answer

Sending Telegram messages with Telethon: some entity parameters work, others don't?

I'm using Telethon's send_message function to send messages to various chats. Sometimes, the destination is another user (just a regular one on one chat), sometimes a group, sometimes a supergroup, and sometimes a channel (of which I'm admin). If I…
RocketNuts
  • 9,958
  • 11
  • 47
  • 88
7
votes
3 answers

How much length can be of a Telegram user_id?

I am making a database in which my algorithm only accepts queries from users with telegram id length of 9. user_id: 123456789; length = user_id.length; display(length); OUTPUT: 9 Are there telegram user ids of length lesser than 9?Can anybody…
7
votes
2 answers

Telegram bot should send URL that contains "&" character, but it sends the URL only until that character and then cuts it short

I want my Telegram bot to send a URL to a channel. However, the url contains the "&" character which cuts the message that it's trying to send short. The Telegram API documentation says I need to use & amp; (without the space) to replace & but…
KMFR
  • 895
  • 1
  • 15
  • 24
7
votes
2 answers

Python Telegram Bot - How to update the text of the last message my bot has sent

I'm using python-telegram-bot (python-telegram-bot.org) to communicate with Telegram from Python3 I would like to update the last reply I sent. Currently, the code below sends the message and then sends another message 5 seconds later. def…
576i
  • 7,579
  • 12
  • 55
  • 92
7
votes
1 answer

send video through telegram python api

I want to send a video through the API, there are functions to send text, images, audio and documents. Is there a function to send videos or should I use this function to do so? bot.send_document(chat_id=chat_id, document=open('tests/test.zip',…
Vishnu U
  • 71
  • 1
  • 1
  • 2
7
votes
1 answer

Telegram bot api keyboard

I have problem with Telegram Bot Api and with "ReplyKeyboard". I'm using Python 2.7 and I send post request: TelegramAPI.post(TELEGRAM_URL + "sendMessage", data=dict(chat_id=CHAT_ID, text="", keyboard={'keyboard': keyboard, 'one_time_keyboard':…
1 2
3
96 97