Added !a command to Tsundere

This commit is contained in:
Eduard Urbach 2018-04-15 12:13:19 +02:00
parent 4411efc0fe
commit 8d8f096d25

View File

@ -3,6 +3,8 @@ package main
import ( import (
"strings" "strings"
"github.com/animenotifier/arn"
"github.com/bwmarrin/discordgo" "github.com/bwmarrin/discordgo"
) )
@ -34,11 +36,6 @@ func OnMessageCreate(s *discordgo.Session, msg *discordgo.MessageCreate) {
return return
} }
if strings.HasPrefix(msg.Content, "!anime ") {
s.ChannelMessageSend(msg.ChannelID, "https://notify.moe/anime/"+strings.Split(msg.Content, " ")[1])
return
}
if strings.HasPrefix(msg.Content, "!animelist ") { if strings.HasPrefix(msg.Content, "!animelist ") {
s.ChannelMessageSend(msg.ChannelID, "https://notify.moe/+"+strings.Split(msg.Content, " ")[1]+"/animelist") s.ChannelMessageSend(msg.ChannelID, "https://notify.moe/+"+strings.Split(msg.Content, " ")[1]+"/animelist")
return return
@ -59,40 +56,20 @@ func OnMessageCreate(s *discordgo.Session, msg *discordgo.MessageCreate) {
return return
} }
// if strings.HasPrefix(msg.Content, "!s ") { if strings.HasPrefix(msg.Content, "!a ") {
// term := msg.Content[len("!s "):] term := msg.Content[len("!a "):]
// users, animes, posts, threads, tracks, characters := arn.Search(term, 3, 3, 3, 3, 3, 3) animes := arn.SearchAnime(term, 3)
// message := "" message := ""
// for _, user := range users { for _, anime := range animes {
// message += "https://notify.moe" + user.Link() + "\n" message += "https://notify.moe" + anime.Link() + "\n"
// } }
// for _, anime := range animes { if len(animes) == 0 {
// message += "https://notify.moe" + anime.Link() + "\n" message = "Sorry, I couldn't find anything using that term."
// } }
// for _, post := range posts { s.ChannelMessageSend(msg.ChannelID, message)
// message += "https://notify.moe" + post.Link() + "\n" return
// } }
// for _, thread := range threads {
// message += "https://notify.moe" + thread.Link() + "\n"
// }
// for _, track := range tracks {
// message += "https://notify.moe" + track.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."
// }
// s.ChannelMessageSend(msg.ChannelID, message)
// return
// }
} }