1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 01:22:48 +00:00

play random audio from end point

This commit is contained in:
2019-07-22 19:59:24 -05:00
parent 4ea1586277
commit 6ed712c23d
3 changed files with 13 additions and 89 deletions

View File

@@ -104,7 +104,7 @@ func (conn *AudioConnection) handleMessage(m *discordgo.MessageCreate) {
conn.clipAudio(m)
case "random":
conn.playRandomAudio(m)
conn.PlayRandomAudio(m)
default:
conn.PlayAudio(command, m)
@@ -167,7 +167,7 @@ func (conn *AudioConnection) summon(m *discordgo.MessageCreate) {
}
// play a random sound clip
func (conn *AudioConnection) playRandomAudio(m *discordgo.MessageCreate) {
func (conn *AudioConnection) PlayRandomAudio(m *discordgo.MessageCreate) {
files, _ := ioutil.ReadDir(config.Config.SoundsPath)
if len(files) > 0 {
randomIndex := rand.Intn(len(files))