telebot: rename voice chat to the video chat

pull/558/head
Demian 2 years ago
parent 98378aadd1
commit 933fcacf4a

@ -87,7 +87,7 @@ type Rights struct {
CanSendPolls bool `json:"can_send_polls"`
CanSendOther bool `json:"can_send_other_messages"`
CanAddPreviews bool `json:"can_add_web_page_previews"`
CanManageVoiceChats bool `json:"can_manage_video_chats"` // TODO(v4): CanManageVideoChats
CanManageVideoChats bool `json:"can_manage_video_chats"`
CanManageChat bool `json:"can_manage_chat"`
}
@ -116,7 +116,7 @@ func NoRestrictions() Rights {
CanSendPolls: true,
CanSendOther: true,
CanAddPreviews: true,
CanManageVoiceChats: false,
CanManageVideoChats: false,
CanManageChat: false,
}
}
@ -138,7 +138,7 @@ func AdminRights() Rights {
CanSendPolls: true,
CanSendOther: true,
CanAddPreviews: true,
CanManageVoiceChats: true,
CanManageVideoChats: true,
CanManageChat: true,
}
}

@ -405,23 +405,23 @@ func (b *Bot) ProcessUpdate(u Update) {
return
}
if m.VoiceChatStarted != nil {
b.handle(OnVoiceChatStarted, c)
if m.VideoChatStarted != nil {
b.handle(OnVideoChatStarted, c)
return
}
if m.VoiceChatEnded != nil {
b.handle(OnVoiceChatEnded, c)
if m.VideoChatEnded != nil {
b.handle(OnVideoChatEnded, c)
return
}
if m.VoiceChatParticipants != nil {
b.handle(OnVoiceChatParticipants, c)
if m.VideoChatParticipants != nil {
b.handle(OnVideoChatParticipants, c)
return
}
if m.VoiceChatScheduled != nil {
b.handle(OnVoiceChatScheduled, c)
if m.VideoChatScheduled != nil {
b.handle(OnVideoChatScheduled, c)
return
}

@ -226,17 +226,17 @@ type Message struct {
// The domain name of the website on which the user has logged in.
ConnectedWebsite string `json:"connected_website,omitempty"`
// For a service message, a voice chat started in the chat.
VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"`
// For a service message, a video chat started in the chat.
VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
// For a service message, a voice chat ended in the chat.
VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended,omitempty"`
// For a service message, a video chat ended in the chat.
VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
// For a service message, some users were invited in the voice chat.
VoiceChatParticipants *VoiceChatParticipants `json:"voice_chat_participants_invited,omitempty"`
// For a service message, some users were invited in the video chat.
VideoChatParticipants *VideoChatParticipants `json:"video_chat_participants_invited,omitempty"`
// For a service message, a voice chat schedule in the chat.
VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"`
// For a service message, a video chat schedule in the chat.
VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
// For a data sent by a Web App.
WebAppData *WebAppData `json:"web_app_data,omitempty"`

@ -117,17 +117,17 @@ const (
// Will fire on chat join request.
OnChatJoinRequest = "\achat_join_request"
// Will fire on the start of a voice chat.
OnVoiceChatStarted = "\avoice_chat_started"
// Will fire on the start of a video chat.
OnVideoChatStarted = "\avideo_chat_started"
// Will fire on the end of a voice chat.
OnVoiceChatEnded = "\avoice_chat_ended"
// Will fire on the end of a video chat.
OnVideoChatEnded = "\avideo_chat_ended"
// Will fire on invited participants to the voice chat.
OnVoiceChatParticipants = "\avoice_chat_participants_invited"
// Will fire on invited participants to the video chat.
OnVideoChatParticipants = "\avideo_chat_participants_invited"
// Will fire on scheduling a voice chat.
OnVoiceChatScheduled = "\avoice_chat_scheduled"
// Will fire on scheduling a video chat.
OnVideoChatScheduled = "\avideo_chat_scheduled"
// Will fire on a proximity alert.
OnProximityAlert = "\aproximity_alert_triggered"

@ -0,0 +1,29 @@
package telebot
import "time"
// VideoChatStarted represents a service message about a video chat
// started in the chat.
type VideoChatStarted struct{}
// VideoChatEnded represents a service message about a video chat
// ended in the chat.
type VideoChatEnded struct {
Duration int `json:"duration"` // in seconds
}
// VideoChatParticipants represents a service message about new
// members invited to a video chat
type VideoChatParticipants struct {
Users []User `json:"users"`
}
// VideoChatScheduled represents a service message about a video chat scheduled in the chat.
type VideoChatScheduled struct {
Unixtime int64 `json:"start_date"`
}
// StartsAt returns the point when the video chat is supposed to be started by a chat administrator.
func (v *VideoChatScheduled) StartsAt() time.Time {
return time.Unix(v.Unixtime, 0)
}

@ -1,29 +0,0 @@
package telebot
import "time"
// VoiceChatStarted represents a service message about a voice chat
// started in the chat.
type VoiceChatStarted struct{}
// VoiceChatEnded represents a service message about a voice chat
// ended in the chat.
type VoiceChatEnded struct {
Duration int `json:"duration"` // in seconds
}
// VoiceChatParticipants represents a service message about new
// members invited to a voice chat
type VoiceChatParticipants struct {
Users []User `json:"users"`
}
// VoiceChatScheduled represents a service message about a voice chat scheduled in the chat.
type VoiceChatScheduled struct {
Unixtime int64 `json:"start_date"`
}
// StartsAt returns the point when the voice chat is supposed to be started by a chat administrator.
func (v *VoiceChatScheduled) StartsAt() time.Time {
return time.Unix(v.Unixtime, 0)
}
Loading…
Cancel
Save