aboutsummaryrefslogtreecommitdiff
path: root/telegram/commands.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-01 04:25:24 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-01 04:25:24 +0300
commitef831fc9725601a94149ce94c3fb686afc77e0a5 (patch)
tree4046e57e03097d9af33cde558056cd5393fa77f4 /telegram/commands.go
parent748366ad6a9dc4b2a269d5499ae1d5d7e8526762 (diff)
Migrate to TDLib 1.8.14 (multiple usernames support)
Diffstat (limited to 'telegram/commands.go')
-rw-r--r--telegram/commands.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/telegram/commands.go b/telegram/commands.go
index 53b5d75..3828ec2 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -18,8 +18,7 @@ const notEnoughArguments string = "Not enough arguments"
const telegramNotInitialized string = "Telegram connection is not initialized yet"
const notOnline string = "Not online"
-var permissionsAdmin = client.ChatMemberStatusAdministrator{
- CanBeEdited: true,
+var permissionsAdmin = client.ChatAdministratorRights{
CanChangeInfo: true,
CanPostMessages: true,
CanEditMessages: true,
@@ -30,14 +29,20 @@ var permissionsAdmin = client.ChatMemberStatusAdministrator{
CanPromoteMembers: false,
}
var permissionsMember = client.ChatPermissions{
- CanSendMessages: true,
- CanSendMediaMessages: true,
+ CanSendBasicMessages: true,
+ CanSendAudios: true,
+ CanSendDocuments: true,
+ CanSendPhotos: true,
+ CanSendVideos: true,
+ CanSendVideoNotes: true,
+ CanSendVoiceNotes: true,
CanSendPolls: true,
CanSendOtherMessages: true,
CanAddWebPagePreviews: true,
CanChangeInfo: true,
CanInviteUsers: true,
CanPinMessages: true,
+ CanManageTopics: true,
}
var permissionsReadonly = client.ChatPermissions{}
@@ -666,7 +671,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
entries := []string{
keyValueString("Chat title", info.Fn),
keyValueString("Photo", link),
- keyValueString("Username", info.Nickname),
+ keyValueString("Usernames", c.usernamesToString(info.Nicknames)),
keyValueString("Full name", info.Given+" "+info.Family),
keyValueString("Phone number", info.Tel),
}
@@ -883,7 +888,10 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
}
// clone the permissions
- status := permissionsAdmin
+ status := client.ChatMemberStatusAdministrator{
+ CanBeEdited: true,
+ Rights: &permissionsAdmin,
+ }
if len(args) > 1 {
status.CustomTitle = args[1]
@@ -933,9 +941,9 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
return "Invalid TTL", true
}
}
- _, err = c.client.SetChatMessageTtl(&client.SetChatMessageTtlRequest{
- ChatId: chatID,
- Ttl: int32(ttl),
+ _, err = c.client.SetChatMessageAutoDeleteTime(&client.SetChatMessageAutoDeleteTimeRequest{
+ ChatId: chatID,
+ MessageAutoDeleteTime: int32(ttl),
})
if err != nil {