python-telegram-bot

Getting exception : AttributeError __aenter__

Getting exception : AttributeError __aenter__ Question: I get this exception: "Exception has occurred: AttributeError __aenter__" in line async with bot:. (I entered the token). Please help import asyncio import telegram async def main(): bot = telegram.Bot("token") async with bot: print(await bot.get_me()) if __name__ == ‘__main__’: asyncio.run(main()) I found this code here: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API Asked By: aboka …

Total answers: 3

Telegram bot to send auto message every n hours with python-telegram-bot

Telegram bot to send auto message every n hours with python-telegram-bot Question: I am quite new in building bots so I created a very simple Telegram bot and it works great but can’t figure out how to make the bot send messages every n minutes or n hours when /start_auto command is initiated. I made …

Total answers: 4

Receive the typed value from the user after the command in python telegram bot

Receive the typed value from the user after the command in python telegram bot Question: For example, we have a command called a chart /chart Now I want to get the value that the user enters after this command example: /chart 123456 now How should i get that 123456? This is the code used to …

Total answers: 3

Python telegram bot, how to store and show users data for each users?

Python telegram bot, how to store and show users data for each users? Question: Hello I am new one for python and telegram api so i have some questions. I am creating telegram bot(python telegram api) with users profile. I have created database(mysql.connector) and store there all users info after registration. Also i have created …

Total answers: 3

How to make user hyperlink in python telegram bot?

How to make user hyperlink in python telegram bot? Question: Stack overflow! I’m using telebot module for my telegram bot (from telebot import types). I want to send messages to telegram users. In this messages I want to paste a link to another telegram users. My code is: linked_user = ‘[username](tg://user?id=999999999)’ bot.send_message( admin_chat_id, f'{linked_user}’, parse_mode=’MarkdownV2′, …

Total answers: 2

Is there a way to change avatar in telegram bot using python?

Is there a way to change avatar in telegram bot using python? Question: I was trying to find some documentation, but i`ve failed. I would be grateful if you send me doc or example how to do it. Asked By: qruim || Source Answers: In order to change your profile photo you should use MTPROTOAPI. …

Total answers: 2

How to make auto-run python file when time is 06:00 P.M

How to make auto-run python file when time is 06:00 P.M Question: I have telegram bot which is made by python. The file must run at 06:00 P.M everyday. My PC is Windows 10. How can I achieve this , please guide me. Asked By: Anna Maria || Source Answers: Find out your Python exe …

Total answers: 3

send Youtube videos to telegram

send Youtube videos to telegram Question: i wrote this program : import scrapetube import hashlib import telegram import requests import json from pytube import YouTube from time import sleep import os bot_token = ‘my token’ bot_chatID = ‘@PinkPanthersShow’ bot = telegram.Bot(token=f'{bot_token}’) c_videos = scrapetube.get_channel("UC1fIyfhQtm1fSljyKBf2uKA") videos = list() for video in c_videos: videos.append(f"https://www.youtube.com/watch?v={str(video[‘videoId’])}") videos.reverse() def upload_video(title, …

Total answers: 2

ImportError: cannot import name 'ParseMode' from 'telegram'

ImportError: cannot import name 'ParseMode' from 'telegram' Question: I am trying to create a telegram bot. The code i am trying to execute is : from telegram import ParseMode But it is throwing up this error: ImportError: cannot import name ‘ParseMode’ from ‘telegram’ (C:ProgramDataAnaconda3libsite-packagestelegram__init__.py) Could you please advise how to fix this error? Asked By: …

Total answers: 2

requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.telegram.org', port=443): # python telegram bot using pytelegrambotapi and Tor

requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.telegram.org', port=443): # python telegram bot using pytelegrambotapi and Tor Question: When I want to connect to telegram bot using Tor that returns error blow requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host=’api.telegram.org’, port=443): Max retries exceeded with url: /bot/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f28923f4a30>, ‘Connection to api.telegram.org timed out. (connect timeout=20)’)) Asked By: Nima || Source Answers: first …

Total answers: 1