-
Notifications
You must be signed in to change notification settings - Fork 26
/
chatadminrights.go
64 lines (58 loc) · 3.03 KB
/
chatadminrights.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Echotron
* Copyright (C) 2022 The Echotron Contributors
*
* Echotron is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Echotron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package echotron
// ChatAdministratorRights represents the rights of an administrator in a chat.
type ChatAdministratorRights struct {
IsAnonymous bool `json:"is_anonymous"`
CanManageChat bool `json:"can_manage_chat"`
CanDeleteMessages bool `json:"can_delete_messages"`
CanManageVideo_chats bool `json:"can_manage_video_chats"`
CanRestrictMembers bool `json:"can_restrict_members"`
CanPromoteMembers bool `json:"can_promote_members"`
CanChangeInfo bool `json:"can_change_info"`
CanInviteUsers bool `json:"can_invite_users"`
CanPostMessages bool `json:"can_post_messages,omitempty"`
CanEditMessages bool `json:"can_edit_messages,omitempty"`
CanPinMessages bool `json:"can_pin_messages,omitempty"`
CanPostStories bool `json:"can_post_stories,omitempty"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"`
}
// SetMyDefaultAdministratorRightsOptions contains the optional parameters used by
// the SetMyDefaultAdministratorRights method.
type SetMyDefaultAdministratorRightsOptions struct {
Rights ChatAdministratorRights `query:"rights"`
ForChannels bool `query:"for_channels"`
}
// GetMyDefaultAdministratorRightsOptions contains the optional parameters used by
// the GetMyDefaultAdministratorRights method.
type GetMyDefaultAdministratorRightsOptions struct {
ForChannels bool `query:"for_channels"`
}
// SetMyDefaultAdministratorRights is used to change the default administrator rights
// requested by the bot when it's added as an administrator to groups or channels.
// These rights will be suggested to users, but they are are free to modify the list
// before adding the bot.
func (a API) SetMyDefaultAdministratorRights(opts *SetMyDefaultAdministratorRightsOptions) (res APIResponseBool, err error) {
return res, client.get(a.base, "setMyDefaultAdministratorRights", urlValues(opts), &res)
}
// GetMyDefaultAdministratorRights is used to get the current default administrator rights of the bot.
func (a API) GetMyDefaultAdministratorRights(opts *GetMyDefaultAdministratorRightsOptions) (res APIResponseChatAdministratorRights, err error) {
return res, client.get(a.base, "getMyDefaultAdministratorRights", urlValues(opts), &res)
}