| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package bot |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "github.com/bwmarrin/discordgo" |
||
| 5 | ) |
||
| 6 | |||
| 7 | // Connection : Voice connection struct |
||
| 8 | type Connection struct { |
||
| 9 | voiceConnection *discordgo.VoiceConnection |
||
| 10 | playing bool |
||
| 11 | quitChan chan struct{} |
||
| 12 | } |
||
| 13 | |||
| 14 | // NewConnection creates and returns new voice connection |
||
| 15 | func NewConnection(voiceConnection *discordgo.VoiceConnection) *Connection { |
||
| 16 | connection := new(Connection) |
||
| 17 | connection.voiceConnection = voiceConnection |
||
| 18 | connection.playing = false |
||
| 19 | connection.quitChan = make(chan struct{}, 1) |
||
| 20 | return connection |
||
| 21 | } |
||
| 22 | |||
| 23 | // Disconnect remove from voice channel and connection |
||
| 24 | func (c *Connection) Disconnect() { |
||
| 25 | _ = c.voiceConnection.Disconnect() |
||
| 26 | } |
||
| 27 |