Questions tagged [telepot]

telepot is a python library to access the Telegram Bot API and work with it via python script or console

109 questions
2
votes
1 answer

Telegram no longer accepting wildcard certificates.Getting error in pythonanywhere

I cannot able to send messages to my bot as I deploy my bot on pythonanywhere. Getting error like cannot to the server due to the reason that telegram is no longer supporting wildcard certificates as mention in the official pythonanywhere blog link…
2
votes
1 answer

"SSL: CERTIFICATE_VERIFY_FAILED" error in my telegram bot

My Telegram bot code was working fine for weeks and I didn't changed anything today suddenly I got [SSL: CERTIFICATE_VERIFY_FAILED] error and my bot code no longer working in my PC. I use Ubuntu 18.04 and I'm usng telepot library. What is wrong and…
man
  • 173
  • 2
  • 9
2
votes
1 answer

Trying to send all pictures of a directory to Telegram bot user

I'm trying to send all pictures of a folder to the bot user. Here is what I tried but it is not working and not even getting any error. path = '~/Documents/mypath/pics' files = [] # r=root, d=directories, f = files for r, d, f in os.walk(path): …
man
  • 173
  • 2
  • 9
2
votes
1 answer

what can be done by a telegram chat ID?

if someone find my telegram chat ID (instead of my phone number or username), what can do with that? is it dangerous?! is it a big deal that someone can find my ID? should I worry about it?
reza
  • 135
  • 1
  • 11
2
votes
1 answer

Connection error while connection has already been established

I use the Telethon == 1.4.3 in my code: import telepot import threading from telethon import TelegramClient from flask import Flask, request from telepot.loop import OrderedWebhook from telepot.delegate import ( per_chat_id, create_open,…
Amin
  • 23
  • 1
  • 9
2
votes
1 answer

MessageLoop(bot, handle).run_forever() doesn't work in Pycharm

I tried the following code in both cmd and Pycharm.It worked well for the cmd but it turned out that the code did not work well in the Pycharm.I couldn't get any updates and the process just finished. Can I know how to solve this? PS : It worked in…
Kelvin
  • 31
  • 2
2
votes
1 answer

How can I add custom keyboard on my Telegram bot?

Here is my Telegram bot code: import time, datetime import telepot from telepot.loop import MessageLoop now = datetime.datetime.now() def action(msg): chat_id = msg['chat']['id'] command = msg['text'] print('Received: %s' % command) …
Bangladesh 71
  • 135
  • 1
  • 4
2
votes
1 answer

How to send file according to file ID on Telegram

How can I send (not forward) file existing on Telegram to user according to file ID? I know all files uploaded on Telegram have unique ID. How can I extract that ID and what's the function or method to send that file by extracted ID? (I use Python…
2
votes
1 answer

How can I send an audio from url using bot.sendAudio()

I have a telegram bot that you can text a YouTube link and it replys with a link that you can open to download the audio format. I wanted to make it more efficient and instead of sending a link (using bot.sendMessage()) that you can click to…
chris
  • 139
  • 1
  • 1
  • 6
1
vote
1 answer

telepot sendPhoto not wokring

I use send photo and get the error global name 'chat_id is not defined. If i add a caption it says it is an invalid keywork even though it is in the docs def on_chat_message(msg): global chat_id global disable_web_page_preview content_type,…
1
vote
0 answers

How to get user input from a button click in telegram python?

I am new to python and I am trying to code a function such that upon a button press, the telegram bot perform something. My code goes something like this def action(msg): chat_id = msg['chat']['id'] command = msg['text'] keyboard =…
LatteCat
  • 31
  • 4
1
vote
0 answers

Anonymous GET request pings Telegram Bot heroku

I have created a Telegram Bot using TELEPOT which is deployed on heroku. It works fine but, never goes to sleep. Because I am using free service which gives 550Hours a month. I want my app to go idle. But, after every 30mins I get these GET…
casiso
  • 11
  • 1
1
vote
1 answer

Bot keeps showing the same error when kicked TELEPOT

I've created a telegram bot that only prints the message that I send, everything works correctly until I block it or add/kick it from a group, when I do this the bot keeps showing this error: Here's the code: import telepot from telepot.loop import…
cipryyyy
  • 39
  • 1
  • 8
1
vote
0 answers

telegram bot to send random image from file

I have the basic code for sending a photo and i seem to understand the concept of choosing a random one. My question is where in this code should i put the random choice code? import sys import time import os import telepot from telepot.loop import…
ible
  • 55
  • 6
1
vote
2 answers

global name chat_id is not defined

I'm trying to send a message after a user has clicked on the inline buttons. It tells me the chat_id is not valid. When i take it out it tells me i have to include it. Every other button works fine and i recieve the callback in terminal def…
ible
  • 55
  • 6