Questions tagged [telegram-bot]

The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram which is an instant-messaging app with documented API. Use this tag if you're writing a telegram bot and have a specific question regarding the Bot API.

Available methods

  • getMe
  • sendMessage
  • forwardMessage
  • sendPhoto
  • sendAudio
  • sendDocument
  • sendSticker
  • sendVideo
  • sendVideoNote
  • sendVoice
  • sendLocation
  • sendVenue
  • sendContact
  • sendChatAction
  • getUserProfilePhotos
  • getUpdates
  • setWebhook
  • removeWebhook
  • getFile

Links:

4905 questions
1
vote
0 answers

Longman telegram bot clone message

I'm trying to create a command replying a message. When you write /share replying a message the bot have to clone the message and send in to me in pvt. My problem is that I want to manage all type of messages [ also photos, documents, contact and…
Shyghar
  • 313
  • 4
  • 19
1
vote
0 answers

TypeError: the first argument must be callable how to solve

So I have this code: from random import choice import schedule import telebot token = 'token' bot = telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start(message): bot.send_message(message.chat.id, "Каждый час будет…
1
vote
1 answer

How to get a person telegram link by only his phone number via API?

Is there a way to get person's telegram via API or telegram bot by only his phone number and not adding him into contact?
Khemrath
  • 58
  • 7
1
vote
1 answer

Where should I upload telegram bot's files to run?

I'm just creating a telegram bot using Python and MySQL. It's currently only run on XAMPP. May I know how can I upload it to server so that everyone can use the bot although my computer is turned off ? Thanks in advance.
1
vote
2 answers

Text + image not working with telegram bot

Having troubles with sending image with text. Instead of actual image, I'm just getting the path to it. I wonder if someone knows what is the problem in my code. Instead of the path I want an actual image import telebot from telebot import…
CrazyChaos
  • 43
  • 1
  • 7
1
vote
0 answers

Telegram Bot: Get Chat Title

I'm trying to get the title of a group chat but it always pass me Undefined array key "chat" This is the code I'm using: $update = file_get_contents('php://input'); $update = json_decode($update, TRUE); $title = $update['chat']['title']; I'm…
user18216979
1
vote
0 answers

How to get location from user who sent a message to bot Python telegram bot API without

I Have that code main.py import telebot bot_token = "my_token" bot = telebot.TeleBot(bot_token) @bot.message_handler(commands=["send_location"]) def sendlocation(message): print(message.location) bot.infinity_polling() When I sent the…
CH_YUR
  • 25
  • 6
1
vote
1 answer

aiogram Why code has expired for different users with the same api_i and api_hash?

I working on python telegram bot that allow login telegram client using registered user and then do some actions using user credentials ... ... But I got the following error: ERROR: The confirmation code has expired (caused by SignInRequest) I use…
Denis Kotov
  • 857
  • 2
  • 10
  • 29
1
vote
1 answer

get array content from json (telegram api) in php

I have this json code "result": [ { "update_id": 74783732, "message": { "message_id": 852, "from": { "id": ---, "is_bot": false, "first_name": "---", "username": "---", "language_code": "en" }, "chat": { "id": ---, "first_name": "---", "username":…
Erik
  • 13
  • 3
1
vote
0 answers

Telegram bot Message Handler error [Local varialbe referenced before assignment]

from dotenv import load_dotenv import os from panda import * from telegram.ext import * from telegram.update import * load_dotenv('.env') Token =os.getenv('TOKEN') print("The bot connected .....") # commands handler # start message def…
1
vote
0 answers

Parse error: Unexpected $THIS (T_VARIABLE)

I don`t now much about PHP and trying to run a Telegram bot but i get this error Parse error: syntax error, unexpected '$this' (T_VARIABLE) on line 101 $me = yield $this->get_self(); $userID = isset($update['message']['from_id']) ?…
AwJ
  • 33
  • 8
1
vote
0 answers

How to send a message through Telegram API's?

I'm using Telegram API and translated that example in vb.net. That code get users messages from telegram client and reply back: Screnshot The code is: Imports System Imports System.Threading Imports Telegram.Bot Imports…
1
vote
0 answers

Sending Live Location to TelegramBot via Nodejs

How can I get users' live location when they share it with a Telegram Bot? I am using node-telegram-bot-api in this project. I have managed to get the bot request one-time location from the users. Here's the code: import TelegramBot from…
Hafiz Hanif
  • 361
  • 1
  • 3
  • 20
1
vote
0 answers

Special function in telebot

@bot.message_handler(commands=[" "]) def send_command(message): bot.send_message(message,"message") For a bot, how could I use a special function in the code above? While True: Time.sleep(1) bot.SendMessage(234235234543453,…
Jhon Oliver
  • 149
  • 6
1
vote
0 answers

How to extract user input from a bot for further processing?

I'm trying to build a python script utilising a Telegram bot to enable the following process: Get the details of a potential bet on a sport event from a database Notify me of the bet details via a Telegram message Place a corresponding bet through…
Jossy
  • 589
  • 2
  • 12
  • 36