mtproto-core icon indicating copy to clipboard operation
mtproto-core copied to clipboard

Error when trying 'channels.inviteToChannel'

Open Doogiemuc opened this issue 2 years ago • 1 comments

I am trying to invite a few users into my channel. I am successfully logged in. And I am the admin of my channel.

// This is the channel that I want to invite to. It's a real announcement only channel. Not a chat group
let channel = {
	_: 'inputChannel',
	channel_id: '167XXXXX',
	access_hash: '15945224XXX',
	title: 'My channel'
}
let users = [
    {
      _: 'inputUser',
      user_id: '24977XXXX',
      access_hash: '160550485622700XXX'
    },
    {
      _: 'inputUser',
      user_id: '503XXXXXXXX',
      access_hash: '150113XXXXXXXX'
    }
]

let updates = await api.call("channels.inviteToChannel", {
  channel: channel,
  users: users
})

This throws the error:

{ _: 'mt_rpc_error', error_code: 400, error_message: 'USERS_TOO_MUCH' }

But there are only 200 users in my channel???? And I am only trying to add two new ones via API.

Is the format of my inputUser correct? Is the format of my users array correct? The API expects a 'vector'? Another issue says, in Javascript that's just simply an array? What am I doing wrong?

Doogiemuc avatar May 13 '22 12:05 Doogiemuc

ok, seems my code actually IS correct. Just needed to retry the next day then it worked.

.... exactly once ...

now I am stuck in FLOOD_WAIT_1760 :-( But that was expected .... :-) let's see what we can do there ....

Doogiemuc avatar May 17 '22 19:05 Doogiemuc