Enable/Disable services based on API key existence
This commit is contained in:
parent
c4a32a0ff6
commit
098c12dfda
4
main.go
4
main.go
|
@ -140,7 +140,7 @@ func CheckAPIKeys() {
|
||||||
fmt.Printf("The youtube service has been disabled as you do not have a YouTube API key defined in your environment variables.\n" +
|
fmt.Printf("The youtube service has been disabled as you do not have a YouTube API key defined in your environment variables.\n" +
|
||||||
"Please see the following link for info on how to fix this: https://github.com/matthieugrieger/mumbledj#youtube-api-keys\n")
|
"Please see the following link for info on how to fix this: https://github.com/matthieugrieger/mumbledj#youtube-api-keys\n")
|
||||||
} else {
|
} else {
|
||||||
AddService(YouTube{})
|
services = append(services, YouTube{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks Soundcloud API key
|
// Checks Soundcloud API key
|
||||||
|
@ -148,7 +148,7 @@ func CheckAPIKeys() {
|
||||||
fmt.Printf("The soundcloud service has been disabled as you do not have a Soundcloud API key defined in your environment variables.\n" +
|
fmt.Printf("The soundcloud service has been disabled as you do not have a Soundcloud API key defined in your environment variables.\n" +
|
||||||
"Please see the following link for info on how to fix this: https://github.com/matthieugrieger/mumbledj#soundcloud-api-keys\n")
|
"Please see the following link for info on how to fix this: https://github.com/matthieugrieger/mumbledj#soundcloud-api-keys\n")
|
||||||
} else {
|
} else {
|
||||||
AddService(SoundCloud{})
|
services = append(services, SoundCloud{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,6 @@ type Playlist interface {
|
||||||
|
|
||||||
var services []Service
|
var services []Service
|
||||||
|
|
||||||
func AddService(service Service) {
|
|
||||||
if services == nil {
|
|
||||||
service = Service{service}
|
|
||||||
} else {
|
|
||||||
service = append(service, services)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func findServiceAndAdd(user *gumble.User, url string) error {
|
func findServiceAndAdd(user *gumble.User, url string) error {
|
||||||
var urlService Service
|
var urlService Service
|
||||||
|
|
||||||
|
|
Reference in a new issue