contacts.block
Adds a peer to a blocklist, see here » for more info.
func (c *Client) ContactsBlock(ctx context.Context, request *ContactsBlockRequest) (bool, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.ContactsBlock(ctx, &tg.ContactsBlockRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
MyStoriesFrom | bool | — | Whether the peer should be added to the story blocklist; if not set, the peer will be added to the main blocklist, see here » for more info. |
ID | InputPeerClass | yes | Peer |
Returns
bool
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
| 400 | CONTACT_ID_INVALID | The provided contact ID is invalid. |
| 400 | INPUT_USER_DEACTIVATED | The specified user was deleted. |
| 400 | MSG_ID_INVALID | Invalid message ID provided. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
contacts.block#2e2e8734