Fixed discord bot source

This commit is contained in:
Eduard Urbach 2018-03-18 05:49:30 +01:00
parent 19f6a2b572
commit 9772729ea7

View File

@ -3,7 +3,6 @@ package main
import (
"strings"
"github.com/animenotifier/arn"
"github.com/bwmarrin/discordgo"
)
@ -60,40 +59,40 @@ func OnMessageCreate(s *discordgo.Session, msg *discordgo.MessageCreate) {
return
}
if strings.HasPrefix(msg.Content, "!s ") {
term := msg.Content[len("!s "):]
users, animes, posts, threads, tracks, characters := arn.Search(term, 3, 3, 3, 3, 3, 3)
message := ""
// if strings.HasPrefix(msg.Content, "!s ") {
// term := msg.Content[len("!s "):]
// users, animes, posts, threads, tracks, characters := arn.Search(term, 3, 3, 3, 3, 3, 3)
// message := ""
for _, user := range users {
message += "https://notify.moe" + user.Link() + "\n"
}
// for _, user := range users {
// message += "https://notify.moe" + user.Link() + "\n"
// }
for _, anime := range animes {
message += "https://notify.moe" + anime.Link() + "\n"
}
// for _, anime := range animes {
// message += "https://notify.moe" + anime.Link() + "\n"
// }
for _, post := range posts {
message += "https://notify.moe" + post.Link() + "\n"
}
// for _, post := range posts {
// message += "https://notify.moe" + post.Link() + "\n"
// }
for _, thread := range threads {
message += "https://notify.moe" + thread.Link() + "\n"
}
// for _, thread := range threads {
// message += "https://notify.moe" + thread.Link() + "\n"
// }
for _, track := range tracks {
message += "https://notify.moe" + track.Link() + "\n"
}
// for _, track := range tracks {
// message += "https://notify.moe" + track.Link() + "\n"
// }
for _, character := range characters {
message += "https://notify.moe" + character.Link() + "\n"
}
// for _, character := range characters {
// message += "https://notify.moe" + character.Link() + "\n"
// }
if len(users) == 0 && len(animes) == 0 && len(posts) == 0 && len(threads) == 0 && len(tracks) == 0 {
message = "Sorry, I couldn't find anything using that term."
}
// if len(users) == 0 && len(animes) == 0 && len(posts) == 0 && len(threads) == 0 && len(tracks) == 0 {
// message = "Sorry, I couldn't find anything using that term."
// }
s.ChannelMessageSend(msg.ChannelID, message)
return
}
// s.ChannelMessageSend(msg.ChannelID, message)
// return
// }
}