bot.NewConnection   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 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