dndmusicbot/ambiance.go

25 lines
383 B
Go
Raw Normal View History

2022-11-18 21:18:12 +00:00
package main
import (
"os"
"path/filepath"
)
func fnNoExt(fileName string) string {
return fileName[:len(fileName)-len(filepath.Ext(fileName))]
}
func GetAmbiance() ([]string, error) {
files, err := os.ReadDir("./ambiance")
if err != nil {
return nil, err
}
var out []string
for _, file := range files {
out = append(out, fnNoExt(file.Name()))
}
return out, nil
}