telegram-bot

How to download full size photo using Telegram Bot API uploaded from user

你说的曾经没有我的故事 提交于 2020-08-27 21:27:03
问题 I'm working on a telegram bot and I need to download photo, audio, video sent by user to the bot. Using the only path returned by the get file method I only get a thumbnail. In fact the only result of the get file method contains a really tiny value for the file size. I can't figure out where the problem is. The photos are normally sent by message as photo (not as file). 回答1: first you should download the photo with this api to your bot https://api.telegram.org/bot<token>/getfile?file_id={the

How to use Jobqueue in Python-telegram-bot

邮差的信 提交于 2020-08-26 00:32:13
问题 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 message nor shows any errors. It just keeps running import datetime from telegram import bot from telegram.ext import Updater def callback_minute(bot, job): bot.send_message(chat_id=475838704, text='PlEaSe wOrK!') def main(): updater = Updater() bot =

How to use Jobqueue in Python-telegram-bot

时光怂恿深爱的人放手 提交于 2020-08-26 00:30:52
问题 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 message nor shows any errors. It just keeps running import datetime from telegram import bot from telegram.ext import Updater def callback_minute(bot, job): bot.send_message(chat_id=475838704, text='PlEaSe wOrK!') def main(): updater = Updater() bot =

Sending animated GIFs with sendPhoto (Telegram bot)

*爱你&永不变心* 提交于 2020-08-24 06:51:42
问题 I'm trying to send an animated GIF with sendPhoto (Telegram's Bot API) with this request: https://api.telegram.org/bot<token>/sendPhoto?chat_id=<chat_id>&photo=http://i.giphy.com/13IC4LVeP5NGNi.gif That method works, as in, I get ok:true back, but the image in the chat window is a still snapshot of the moving GIF. How can I get the animated GIF to show? Is there another method I should use? 回答1: You should use the sendAnimation method for sending a GIF or H.264/MPEG-4 AVC video without sound

python telebot got unexpected response

末鹿安然 提交于 2020-08-22 19:09:08
问题 I have been using my Telegram bot for sending me different notifications from my desktop computer using python's telebot library. Everything was working properly for quite a long time, but one day it stopped working. Here's the code (Python 2.7): import telebot import socket TELEBOT_TOKEN = '<token>' CHAT_ID = <chat id> bot = telebot.TeleBot(TELEBOT_TOKEN) def notify(message): bot.send_message(CHAT_ID, 'Notification from ' + socket.gethostname() + ':\n' + message) notify('Hello world!') When