Questions tagged [php-telegram-bot]

The telegram Bots are applications that can be used via telegram chat, the interaction is via Messages. The realization of these bots with PHP simplifies the work of a developer.

It is implemented by API and HTTP-based interface has all the methods of bot telegram (https://stackoverflow.com/tags/telegram-bot/info).

A simple way of use is:

define('BOT_TOKEN', '<YOUR-TOKEN>');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
define('FILE_URL', 'https://api.telegram.org/file/bot'.BOT_TOKEN.'/');

$content = file_get_contents("php://input");
$update = json_decode($content, true);

$message = isset($update['message']) ? $update['message'] : "";
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
$text = isset($message['text']) ? $message['text'] : "";

header("Content-Type: application/json");
$parameters = array('chat_id' => $chatId, "text" => 'you wrote: '.$text);
$parameters["method"] = "sendMessage";
341 questions
2
votes
0 answers

Can I hide telegram bot menu button?

In recent update they introduced the menu button where you have commands. I want to know if I can disable this or maybe delete all the commands? My bot now has one default command /start. What will it look like if I'll delete it?
s0up
  • 372
  • 4
  • 13
2
votes
2 answers

Telegram bot can't send direct messages

I am creating a Telegram bot using pytelegrambotapi. But when I test the code, my Telegram Bot always replies with quoting my input like this, I don't want it to quote my input message but send the message directly. Also how can I get replies by…
2
votes
0 answers

Why telegram bot sends the file twice?

I am sending a file via telegram bot api, I am sure that my code works once, but two files always come! I cannot understand what is the reason, here is my code: $url =…
user16176768
2
votes
1 answer

Telegram : How can i join chat automatically and post message through bot

I am looking for a Telegram bot that will automatically join a group from a list and automatically send a message. Does anyone know how this is possible?
2
votes
1 answer

How to prevent my bot from entering into a loop?

I created a functionality in my bot that allows to ping other computers, when the user pings more than 60 times the bot takes a long time to do it, and I think it does not respond to Telegram with an http 200 code, so Telegram sends it again the…
2
votes
1 answer

Is there a way for a Telegram bot to get its own messages that it has sent in a private channel where it is an admin?

I just want a way to get the messages that my Telegram bot has posted in a private channel where it is an admin. I found this question from over 3 years ago: Is there any way to get all messages that a Telegram Bot has sent They say it wasn't…
2
votes
0 answers

Is there a way to know if a message was deleted by channel members before i delete that message myself in telegram

Is there a way for me to know if the message send by my bot to a channel was deleted before i delete that message using deleteMessage method in Bot API in Telegram delete_message(channel_ID,message_ID) returns true even if the message was already…
2
votes
1 answer

How to forward (filter) Telegram messages from a private group to myself based on sender?

I'm in a private Telegram group that has a continual stream of many messages from a large number of people. I need to somehow pull out just those from a handful of specific people, and forward them to myself somehow - e.g. a new group I'm the only…
2
votes
1 answer

Deleting all messages of telegram group by bot

I want to delete the messages in group but the bot only deletes the last few messages, about the last ten minutes. I'm using message_id decreasing for doing that $lastMessageID = --$result ['message']['message_id']; for ($i=0; $i <$n ; $i++)…
Amir
  • 523
  • 1
  • 5
  • 24
2
votes
1 answer

$_POST variable is empty when code is executed using Telegram webhook

I am creating a Telegram Bot using PHP. I have set the webhook to "https://example.com/bot.php". As you can see below, I used echo to run a script that creates HTML form. After being created, the form then is submitted automatically and I get…
Brian B
  • 80
  • 1
  • 9
2
votes
1 answer

Answer callback query

I have a Telegram with multiple functions running ok. Now I'm trying to add some more actions on inline buttons, however I can't seem to get it done. I've wrapped all my bot code into an if and added an else condition for when a callback is sent,…
2
votes
1 answer

No pending_update_count from Telegram Bot

I am struggling with Telegram API for a while now, it seems that I don't find my problem on stackoverflow which is why I am posting this message right now. I try to build a Telegram Bot plain and simple. I use PHP and ureal4u library to get Update…
Frogga0
  • 21
  • 1
2
votes
1 answer

Can a pinned message have inline buttons?

I have a bot that I am building in telegram. This bot posts a “pinned” message. I’m curious if a pinned message can have inline buttons.
2
votes
1 answer

Customize the ringtone of notifications of a telegram bot

I was wondering if it was possible to set an alarm ringtone to notifications of a particular bot. In the sense, I wish that as soon as a user received a notification from a telegram bot created by me, he would leave instead of the default…
Lorenzo
  • 31
  • 4
2
votes
3 answers

Send Message to Telegram Bot Without Open Telegram Apps

usually if we want to chat or send command to Telegram Bot, we just texting the bot from Telegram apps (desktop, web, or smartphone). Is there any way texting the bot without open Telegram apps?? I've read many website and thread in stackoverflow,…
biladina
  • 137
  • 1
  • 11