Skip to content

Commit

Permalink
telebot: rename voice chat to the video chat
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Oct 4, 2022
1 parent 98378aa commit 933fcac
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
6 changes: 3 additions & 3 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -116,7 +116,7 @@ func NoRestrictions() Rights {
CanSendPolls: true,
CanSendOther: true,
CanAddPreviews: true,
CanManageVoiceChats: false,
CanManageVideoChats: false,
CanManageChat: false,
}
}
Expand All @@ -138,7 +138,7 @@ func AdminRights() Rights {
CanSendPolls: true,
CanSendOther: true,
CanAddPreviews: true,
CanManageVoiceChats: true,
CanManageVideoChats: true,
CanManageChat: true,
}
}
Expand Down
16 changes: 8 additions & 8 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
16 changes: 8 additions & 8 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
16 changes: 8 additions & 8 deletions telebot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
29 changes: 29 additions & 0 deletions video_chat.go
Original file line number Diff line number Diff line change
@@ -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)
}
29 changes: 0 additions & 29 deletions voice.go

This file was deleted.

0 comments on commit 933fcac

Please sign in to comment.