Skip to content

Commit

Permalink
what do
Browse files Browse the repository at this point in the history
  • Loading branch information
ducc committed Oct 10, 2016
1 parent 50ac4a8 commit 3f4258e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ func main() {
botId = user.ID
discord.AddHandler(commandHandler)
discord.AddHandler(func(discord *discordgo.Session, ready *discordgo.Ready) {
fmt.Println("Ready..")
fmt.Println("Ready")
discord.UpdateStatus(0, "boyyyy")
})
err = discord.Open()
if err != nil {
fmt.Println("Error opening connection,", err)
return
}
fmt.Println("Started!")
fmt.Println("Started")
<-make(chan struct{})
}

Expand All @@ -54,15 +54,28 @@ func registerCommands() {
cmdManager.register("stop", stopCommand)
}

var joined = false

func commandHandler(discord *discordgo.Session, message *discordgo.MessageCreate) {
user := message.Author
if user.ID == botId || user.Bot {
return
}
content := message.Content
if strings.Contains(strings.ToLower(content), "what do") {
if !joined {
chanManager.joinChannel(discord, "110373943822540800", "117018183365427204", false, true)
joined = true
}
chanManager.connections["117018183365427204"].connection.play(Song{"music/what_do.mp3"})
return
}
if len(content) <= len(PREFIX) {
return
}
if content[:len(PREFIX)] != PREFIX {
return
}
content = content[len(PREFIX) + 1:]
if len(content) < 1 {
return
Expand Down

0 comments on commit 3f4258e

Please # to comment.