bot/connection.go   A
last analyzed

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 15
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bot.*Connection.Disconnect 0 2 1
A bot.NewConnection 0 6 1
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