-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchannel.go
44 lines (38 loc) · 970 Bytes
/
channel.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
package lowbot
import (
"github.com/google/uuid"
)
type IChannel interface {
GetChannel() *Channel
Stop() error
Start() error
SendAudio(*Interaction) error
SendButton(*Interaction) error
SendDocument(*Interaction) error
SendImage(*Interaction) error
SendText(*Interaction) error
SendVideo(*Interaction) error
}
type Channel struct {
ChannelID uuid.UUID
Name string
Broadcast *Broadcast[*Interaction]
}
func SendInteraction(channel IChannel, interaction *Interaction) error {
if interaction.Type == MESSAGE_TEXT {
return channel.SendText(interaction)
}
if interaction.Type == MESSAGE_BUTTON {
return channel.SendButton(interaction)
}
if interaction.Parameters.File.IsAudio() {
return channel.SendAudio(interaction)
}
if interaction.Parameters.File.IsImage() {
return channel.SendImage(interaction)
}
if interaction.Parameters.File.IsVideo() {
return channel.SendVideo(interaction)
}
return channel.SendDocument(interaction)
}