Giter VIP home page Giter VIP logo

telegrambotphp's People

Contributors

abbas980301 avatar alefsheen avatar blopa avatar caco3 avatar eleirbag89 avatar happy-code-com avatar hijera avatar hossein142001 avatar ivmaks avatar lyucean avatar mohsen322 avatar oraziocontarino avatar parsapoorsh avatar siamakdals avatar sibche2013 avatar stylecibot avatar xpyctum avatar ynvv avatar yousha avatar zeyudada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telegrambotphp's Issues

cURL problem

Hi
I have a problem in sending data with SendMessage. I think it's related to cURL function. Sometimes it hangs for many senconds and even more than a minute. I've searched alot and found that some developers use Guzzle for solving this problem. Now I wanna know that is there any simplest way to prevent hanging in sending data to telegram bot.
Thanks alot.

Sending photo other than curl_file_create()

I'm trying to send a photo which is located in another server using $telegram->sendPhoto function but since I work with google app engine (free version) and it's CURL library is limited I used my_curl_file_create() function as below but I didn't get any result. Even I tried to use CURl Post method but I received this Json answer:
"{"ok":false,"error_code":400,"description":"Bad Request: there is no photo in the request"}"

<?php
$img = my_curl_file_create('http://example.com/255.png','image/png'); 
$content = array('chat_id' => $chat_id, 'photo' => $img );
$telegram->sendPhoto($content);

function my_curl_file_create($filename, $mimetype = '', $postname = '') {
        return "@$filename;filename="
            . ($postname ?: basename($filename))
            . ($mimetype ? ";type=$mimetype" : '');
    } 
?>

I tried to upload the file in google cloud Bucket and use the public link of it but didn't get any result either.
Is it because of google app engine or the code?

ssl

hi,
im using ssl from cloudflare
when using as Dedicated IP and private ssl certificate bot not work
please help me

Bot don't run

I introduce I am not strong in programming..
So i have load file 'Telegram.php' and file 'updates.php'.
In 'updates.php' i have set my token bot in variable $bot_id.
Then I've set webhook put my https site url.
But it don't run.. why?
Have I jump anything?

I await in your answer, thank you for that all and sorry for my bad english.

P.S :
What means this? I put in my server something?

For the GetUpdates:
Some way to execute the script in order to serve messages (for example cronjob)

how to use editMessageText

hi.
problems by this method editMessageText

$content = array('chat_id' => $c_id,'message_id' => intval($mes_id), 'text' => $mtn_all,'parse_mode' => 'HTML','reply_markup' => $keyb1);
$telegram->editMessageText($content);

i save message_id id in database and retrive and save chat id but not work for me?!?!?!
help me!!!

Bot Popup

Hi there,
I've recently seen a black popup in some telegram bots that apear some messages like 'Please wait...' and etc. I couldn't find any API in this class and telegram api page. Does any one know that? please help me, SOS 😁

Partial response from telegram to my bot.

This is my programming in PHP.

        $option = array( array( $telegram->buildInlineKeyboardButton($text="Test2",null,"test2",null) ) );
        $keyb = $telegram->buildInlineKeyBoard($option);
        $replycontent = array('chat_id' => $chat_id, 'text' => "Any case",'reply_markup' => $keyb);
        $telegram->sendMessage($replycontent)

At my bot, I captured the parse and I got :

{"update_id":xxxxxxxx,_"callback_query":{"id":"xxxxx","from":{"id"xxx,"first_name":"xx","last_name":"xx","username":"xxx"},"message":{"message_id":xx,"from":{"id":xx,"first_name":"gbox","username":"xx"},"chat":{"id":xxxx,"first_name":"xx","last_name":"xxxl","username":"xxxx","type":"private"},"date":1476580880,"text":"Any <<<<< only stopped there.

But if I set 'text' => "Anycase", in the program, I got full json.

What is wrong is it any away?

Using your API for new @channel send message and file sending

I would like to use your PHP API for new command for channel:

October 8, 2015

Added initial channel support for bots:
The Chat field in the Message is now of the new type Chat.
You can now pass a channel username (in the format @channelusername) in the place of chat_id in all methods (and instead of from_chat_id in forwardMessage). For this to work, the bot must be an administrator in the channel.

But when I use this code:

$telegram = new Telegram($bot_id);
//$chat_id = $telegram->ChatID();
//$chat_id = "@channel";
$test= "Messaggio di test";
$content = array('chat_id' => $chat_id, 'text' => $test);
$telegram->sendMessage($content);

The error is:

PHP Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in .../Telegram.php on line 767
PHP Stack trace:
PHP 1. {main}().../sendmessage2.php:0
PHP 2. Telegram->sendMessage() /usr/share/vrylbotdaemon/sendmessage2.php:16
PHP 3. Telegram->endpoint() /usr/share/vrylbotdaemon/libs/Telegram.php:102
PHP 4. Telegram->sendAPIRequest() /usr/share/vrylbotdaemon/libs/Telegram.php:35
PHP 5. curl_setopt() /usr/share/vrylbotdaemon/libs/Telegram.php:767

Can you help me?

NOTA: dato che ho visto che sei italiano ti chiedo. Sto cercando di capire dove sia il problema, ma non sono riuscito a capire. Se puoi modificare la chiamata renderebbe la libreria aggiornata all'ultima release di Telegram BOT API. Un saluto e grazie della tua fantastica libreria!

Admin mode

How check the user is admin and set some spetial manage to admins bot? And other user cant do that.
Just admin.
And how set user is admin?

I can't getFile with caption and get only thumb photo

Hello Sir,

I have specific situation where I must get image + caption. When user upload image + caption I have two items on file JSON. How I can get second array with via orginial size image $telegram->download()

Thanks

how to share InlineKeyboardButton

hi;
how to share InlineKeyboardButton to other chat “private”, “group”, “supergroup” or “channel”
so that show completely?

How should I call buildInlineKeyBoard function?

I can't figure out how to display inline keyboard. could you please illustrate an example here?

if($text == "inline")
{
$option=array(array("test"));
$keyb =$telegram->buildInlineKeyBoard($option);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "inline keyboard is built");
$telegram->sendMessage($content);
}

where is my problem?

send picture after user press inline button

hi
first of all ,appreciate for develop this useful class,and thank you share it for us
i have problem in catch inline button and send answer

here is my code
$option = array(
array( $telegram->buildInlineKeyboardButton($text="One","",$callback_data="One",""),$telegram->buildInlineKeyboardButton($text="Two","",$callback_data="Two","") )

 );

$keyb = $telegram->buildInlineKeyBoard($option);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "One Or Two ?");
$telegram->sendMessage($content);

i want send different picture after user press (One or Two) buttons
how can i do it ?

Regards,Frank

forward problems

hi
this my code:

$result = $telegram->getData();
$fd_c=$result['message']['forward_from_chat']['id'];
$fd_i=$result['message']['message_id'];
$content=array('chat_id' => $chat_id , 'from_chat_id' => $fd_c, 'message_id' => $fd_i);
$telegram->forwardMessage($content);

whene forward post another chanel . the bot shown incorrect post in chanel. but chanle name and chanel chat id is correct....
but message_id incorrect.
please help me
thanks

ForceReply

Hi .
i read ForceReply in telegram bots api .
how can i use it in your library ?
thank u

Copy message from other channel

Hi
Sorry,I have a question about your project(telegram).
Can I get the message channels that I'm not their admin?
I want write a script that read message from other chanel and write to
my chanel.
I can do it?
best regards
thanks

get file id

hi

how i can get file id when user send voice or photo ?

tnx

How to send a message without user reply?

Hi Gabriele Grillo,

Thank you for your work here, but I have one question: is it possible to send messages or broadcast for users without their reaction? Because it now only sends replies based on users messages and I want to send messages at different times (after users click /start for the first time only)

Thanks.

Build Multi-Step

Hi .
how can i build a Multi-Step for my bot ?
for example , when user writes "/test" robot says : "Hello . Please Enter Your Name" .
and when he entered his name , bot says : "Ok ! Your name is (His name) ! Please Send me your family "
and when he entered his family , bot says : "OK ! Your name is (His name , His Family ) .
and . . .
+
how can i send pm to my users ? ( send pm to all user )

can you help me ?

how to develop bot using oop

hi
i'd like to develop my bot using oop way, but there is something i don't understand.
i need to require class at top of my script
then in my __construct i must make a new Telegram object ?
like this:

require 'Telegram.php';
class bot extends Telegram {
   public function __construct($bot_id)
    {


        parent::__construct($bot_id);
        $this->tg = new Telegram($bot_id);

    }
}

obviously it's not working i don't where is my mistake

sendAudio()

This function works with audio lenght 7 or less seconds, but if an audio has 8 or more seconds doesn't work. why?

Getting error when send a file image

this is error what i get :

Warning: file_get_contents(): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\xampp\htdocs\mgp25\Telegram-Bot-API-master\src\Telegram.php on line 465

i'm use PHP 5.6 version and active curl.

Thanks for amazing library, very usefull :) 👍

Update type

I'm thinking about some thing like this.

$t = new Telegram($this->token);

    /**
     *
     * Return current update type
     *  Message
     *  Photo
     *  Video
     *  Audio
     *  ...
     *
     */
    $t->UpdateType();

What's your opinion about it? I wrote that, do you want to new pull request?

cant use telegram api in host

when i use local host every thing is ok bot in real host i have internal errore 500
how can i resole it?
curl and curlssl is active on server .

How to send InlineKeyboardMarkup keyboard?

In the examples, this method has not found

I tried to make it:
`$keyb = $telegram->buildInlineKeyBoardButton($text="text ulr", $url="https;//vk.com/", $callback_data, $switch_inline_query);

$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => $text, "parse_mode"=> "HTML");

$out = $telegram->sendMessage($content);`

Why telegram bot doesn't respond to messages in channel?

I have created a channel in telegram and I added a bot as an administrator of the channel, when I send a message to channel the bot doesn't answer, why?

I can send a message with /sendmessage

https://api.telegram.org/bot[key]/sendmessage?chat_id=@MyChannelID&text=This text is from bot to channel.

In the code below when I send a text " call " nothing happens.

<?php 

 include 'connection.php';
 include("Telegram.php");
 define('bot_id', 'key');
 $telegram = new Telegram(bot_id);

 $text = $telegram->Text();
 $chat_id = $telegram->ChatID();

 if ($text == "call") {
 $content = array('chat_id' => $chat_id, 'text' => "This is test     message!!!");
 $telegram->sendMessage($content);   
  }

 ?>

Thank you my friend for your patience in answering my questions.

Download File problem

Hi...
I'm testing your code example "update.php" with command "/img"
no error and file name appear on server, but his size are 0 Kb ...empty file..
(ther's full permission on folder server)
Any suggestion about this problem make me glad :-)

Tnks Bye,
Gian

send GEO location

hi

how user can send your GEO location with button in KeyBoardButton or inlinekeyborard ?

webhook

how do i set a webhook???how to use the function

telegram keyboard inline

hi

$bot_id="***************************";
include("Telegram.php");
$telegram = new Telegram($bot_id);
$chat_id = $telegram->ChatID();
$Keyarray=array(
  "0"=>array(
    "test",
    "col",
    "col"
  ),
  "1"=>array(
    "test",
    "col",
    "col"
  )
);
$content = array('chat_id' => $chat_id, 'text' => "Test",'reply_markup'=>$telegram->buildKeyBoard($Keyarray));
$telegram->sendMessage($content);

this code is work for create an keyboard

but i can not create an inline keyboard

how to download file

hi,
i'm using this code but not work.
"file_path" is empty
code:
$result = $telegram->getData();
$doc_id = $result["message"]["document"] ["file_id"];
$file = $telegram->getFile($doc_id);
$telegram->downloadFile($file["file_path"], "./3333333.xls");

i'm sending *.xls files to bot and saved in host but file size is: 0
plz help me
tnks

how to access messages data sent by bot ?

hi i want to access message_ids of my bot messages and store it in a variable, i know i can access all the data by using var_dump($telegram->sendmessage($content); but how can i filter through them and only get message_id ?

how to trace user position

hi
i want to know how can i trace user position in the chat via my bot.
my bot have several keyboard i want to add a back button for each keyboard .
but i don't know how to do that

buildKeyboardButton

Dear Gabriele,
please can tell me how to use/call buildKeyboardButton ?
If I understand right, with this option I can send a keyboard button with "callback_data" different from label of button, is it right ?

Many thanks for you support

`
$option = array(???);

echo buildKeyboardButton($option, $request_contact=false, $request_location=false);
`

I can't edit my message sent with inline keyboard !

Hey !
PLZ help me with this case that I have sent a message with inline keyboard and I want to change the text when user clicks on the keyboard button but I can't manage to do that ,here's my code :
`$msgid = $result["callback_query"]["message"]["message_id"];

$kb1 = $telegram->buildInlineKeyboardButton("بعدی","","next","");
$kb2 = $telegram->buildInlineKeyboardButton("قبلی","","before","");
$option = array( array($kb1,$kb2) );
$keyb = $telegram->buildInlineKeyBoard($option);
$telegram->sendMessage(array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => str_replace(", ","",$data), 'parse_mode' => 'HTML', 'disable_web_page_preview' => true));

$telegram->editMessageText(array('chat_id'=> $chat_id, 'text' => "123", 'message_id'=> $msgid));`

SendPhoto con file_id

Ciao Gabriele Grillo, con la funzione sendPhoto, non riesco a ricavare il file_id dell'immagine.

Carico l'immagine in questo modo:

if (strpos($text, 'curl') !== false){
$content = array('chat_id' => $chat_id, 'photo' => new CURLFile(realpath('assets/uploads/images/01.jpg')), 'caption' => $reply_text);
$telegram->sendPhoto($content);
}

In questo modo il bot mi invierà l'immagine. però anzicche specificare il percorso e quindi far caricare ogni volta al bot una nuova immagine, volevo specificare il file_id. Ma non so come ricavarlo?

Qualche idea?

Grazie per l'eventuale risposta. Preferivo contattarti in privato ma non ho trovato modi per farlo :)

how to send any files with file id in bot api?

hi this my code.
file_path read from database save file_id
$content = array('chat_id' => $chat_id1, 'video' => $file_path, 'caption' => $reply );
$telegram->sendVideo($content);
but file is big 20 mb dont send

have solution for this?!

LOG information

Hi Gabriele,
first .... many thanks for have share your usefull job! and stay in my same country :-)

May suggest me how to log all information incoming from BOT? Actually I have add some code to my bot ....But I think will be better use something like "Catch-All" information

$toWrite = "\r\n====$chat_id | $Jdata | $JFName | $JLName | $JUName | $JLocation | $JUpdateID | $JUpdateCount | $JFromGroup | $text "; $myfile = fopen("LogWebHook.txt", "a"); fwrite($myfile, $toWrite); fclose($myfile);

Grazie, ciao
Gian

PS: setup with webHook

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.