Giter VIP home page Giter VIP logo

turibot's People

Contributors

davtur19 avatar lausek avatar mrbeandev 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

turibot's Issues

sendMessage() error

i have seen that some times the sendmessage is not sending messages. so i have added a error hadling which sends the error message along with the message to a private bot !

Its like the below code .
vendor / davtur19 / src / api.php

public function sendMessage(
        $chat_id,
        string $text,
        string $parse_mode = null,
        array $reply_markup = null,
        int $reply_to_message_id = null,
        bool $disable_web_page_preview = null,
        bool $disable_notification = null
    ) {
        $args = [
            'chat_id' => $chat_id,
            'text'    => $text
        ];

        if ($parse_mode !== null) {
            $args['parse_mode'] = $parse_mode;
        }

        if ($disable_web_page_preview !== null) {
            $args['disable_web_page_preview'] = $disable_web_page_preview;
        }

        if ($disable_notification !== null) {
            $args['disable_notification'] = $disable_notification;
        }

        if ($reply_to_message_id !== null) {
            $args['reply_to_message_id'] = $reply_to_message_id;
        }

        if ($reply_markup !== null) {
            $args['reply_markup'] = json_encode($reply_markup);
        }

        $req = $this->Request('sendMessage', $args);
        if ($req->ok == false){
            file_get_contents("https://api.telegram.org/bot<bot_token>/sendMessage?chat_id=1152662911&text=Error IN API Of this BOT : $text |V| ".json_encode($req)."");
        }
        return $req;
    }

Here in the end as you can see if there is a error it sends that error to another bot

and one intresting error i see most common is

{"ok":false,"error_code":28,"description":"Resolving timed out after 2000 milliseconds","curl_error":true}

how to solve this ?

how do i get people's id via new chat member?

i tried this but it doesn't work

if (isset($update->message) or isset($update->edited_message)) {
    $chat_id = $client->easy->chat_id;
    $newuser = $client->easy->new_chat_members->user->id;

    if ($newuser and $chat_id == "channel id") {
        $client->sendMessage(my id, "test");
    }

}

null is not an instance of stdClass

Client->getUpdate() could return null through json_decode which leads to this fatal error:

Fatal error: Uncaught TypeError: Return value of TuriBot\Client::getUpdate() must be 
an instance of stdClass, null returned in turibot/src/Client.php:46

PHP version: 7.3.13
Possible solution: Add nullable or remove type hint

help !! bots not running on both of my servers !

none of my bots are running
i have 2 server with bots and both are not getting reply , why so ?

i am using php8.1 and latest composer update was done , yet i am getting no response in my bot , i am using the example code given in your github page

Why is it disabling all the permissions in the group?

I used this line to disable only "Send Messages" permission, but it disables all permissions in the group. What is wrong with the code?

{ "chat_id": {lv=Channel ID}, "permissions": {"can_send_messages": false}, "use_independent_chat_permissions": false }

Bot token and $_GET["api"]

Hi

Thanks for this !

Please update the documentation...where does one update the Bottoken from Botfather and in the case of the webhook, there is no API in the get request right?

Please clarify

Thanks

get username

Hi, I don't understand how to access to the data using the API.... for example if I want to get the username from a chat...

$chat = $client->getChat($chat_id);
$userID = $chat["username"];

what is the correct way to do it?
thanks

How to use the $reply_markup var

Hi,
I want to use the $reply_markup var on sendMessage method to force a reply, but I don't know how to put there in a nice form... any help would be very apreciated!

It worked with this code below... but... not sure if I could type it nicely...

$client->sendMessage($chat_id, "Type something?", null, null, null, null,array(
          'force_reply_keyboard' => true ) )

I'm trying to implement a step-by-step proces... any example of how to do it? The force_reply isn't exactly what i wanted...

P.S.: Thanks for the work with this code!

Issue: โ“ Support Question

I tray to get some info bot Telegram don't reply support tickets!

Can you help me with Telegram. so that I am sent in the right direction.

I work for a government organization and we have a weekly exercise, now I would like to simplify this with, for example, a poll or something else where if someone responds to that I get a feedback via the telegram API.

I want to use PHP for this but see many options on the Telegram website https://core.telegram.org/bots/samples#php but now which one is and is not suitable for this and there is a little explanation somewhere how to find it tackles this?

https://telegram.org/blog/polls-2-0-vmq

Greetings Theo

getUpdates.php error

#1 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/HttpStream.php(88): Amp\Http\Client\Connection\Http1Connection->request()
#2 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/ConnectionLimitingPool.php(123): Amp\Http\Client\Connection\HttpStream->request()
#3 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/HttpStream.php(88): Amp\Http\Client\Connection\ConnectionLimitingPool->Amp\Http\Client\Connection\{closure}()
#4 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Interceptor/DecompressResponse.php(43): Amp\Http\Client\Connection\HttpStream->request()
#5 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/InterceptedStream.php(43): Amp\Http\Client\Interceptor\DecompressResponse->requestViaNetwork()
#6 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Interceptor/ModifyRequest.php(40): Amp\Http\Client\Connection\InterceptedStream->request()
#7 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/InterceptedStream.php(43): Amp\Http\Client\Interceptor\ModifyRequest->requestViaNetwork()
#8 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Interceptor/ModifyRequest.php(40): Amp\Http\Client\Connection\InterceptedStream->request()
#9 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/InterceptedStream.php(43): Amp\Http\Client\Interceptor\ModifyRequest->requestViaNetwork()
#10 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/PooledHttpClient.php(37): Amp\Http\Client\Connection\InterceptedStream->request()
#11 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Interceptor/RetryRequests.php(36): Amp\Http\Client\PooledHttpClient->request()
#12 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/InterceptedHttpClient.php(30): Amp\Http\Client\Interceptor\RetryRequests->request()
#13 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Interceptor/FollowRedirects.php(129): Amp\Http\Client\InterceptedHttpClient->request()
#14 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/InterceptedHttpClient.php(30): Amp\Http\Client\Interceptor\FollowRedirects->request()
#15 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Interceptor/ModifyRequest.php(52): Amp\Http\Client\InterceptedHttpClient->request()
#16 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/InterceptedHttpClient.php(30): Amp\Http\Client\Interceptor\ModifyRequest->request()
#17 /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/HttpClient.php(26): Amp\Http\Client\InterceptedHttpClient->request()
#18 /var/www//TelegramBot/Bot2/src/Client.php(95): Amp\Http\Client\HttpClient->request()
#19 /var/www//TelegramBot/Bot2/src/Api.php(427): TuriBot\Client->Request()
#20 /var/www//TelegramBot/Bot2/getUpdates.php(34): TuriBot\Api->sendDocument()
#21 {main}
  thrown in /var/www//TelegramBot/Bot2/vendor/amphp/http-client/src/Connection/Http1Connection.php on line 462

after a few hours the bot gives me these errors and crashes, I think it's because it receives too many requests, there is a way to fix it because it's really boring to restart it every time

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.