xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
576 stars 130 forks source link

Always CHANNEL_INVALID when calling /channels.InviteToChannel/ api. #95

Closed pasya1912 closed 2 years ago

pasya1912 commented 2 years ago

im going to invite my account to a group

the madelineproto will be : $MadelineProto->channels->InviteToChannel(['channel'=>'688336041','users'=>['@raflipasya19']]); its work properly.

so i tried the API version ( this repo ).

http://127.0.0.1:9503/api/session/channels.inviteToChannel/?channel=688336041&users[]=@raflipasya19

but the response always:

{
    "success": false,
    "errors": [
        {
            "exception": "danog\\MadelineProto\\RPCErrorException",
            "message": "CHANNEL_INVALID",
            "file": "/mnt/c/xampp/htdocs/TelegramApiServer/vendor/danog/madelineproto/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php",
            "line": 394,
            "code": 400,
            "backtrace": [
                {
                    "file": "/mnt/c/xampp/htdocs/TelegramApiServer/vendor/danog/madelineproto/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php",
                    "line": 194,
                    "function": "handleRpcError",
                    "class": "danog\\MadelineProto\\Connection",
                    "type": "->"
                },
                {
                    "file": "/mnt/c/xampp/htdocs/TelegramApiServer/vendor/danog/madelineproto/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php",
                    "line": 73,
                    "function": "handleResponse",
                    "class": "danog\\MadelineProto\\Connection",
                    "type": "->"
                },
                {
                    "file": "/mnt/c/xampp/htdocs/TelegramApiServer/vendor/amphp/amp/lib/Loop/Driver.php",
                    "line": 119,
                    "function": "handleMessages",
                    "class": "danog\\MadelineProto\\Connection",
                    "type": "->"
                }
            ]
        }
    ],
    "response": null
}

Any help ?

xtrime-ru commented 2 years ago

Hi. You have error in request. InviteToChannel requires one argument array. You provided two arguments.

Try this way: http://127.0.0.1:9503/api/session/channels.inviteToChannel/?data[channel]=688336041&data[users][]=@raflipasya19