From 1b877ce11796d761d004e5599e7bd58721d53d38 Mon Sep 17 00:00:00 2001 From: kageru Date: Fri, 25 May 2018 17:21:17 +0200 Subject: [PATCH] find wink emotes by regex and delete them --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index f270cf2..948ef7c 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,11 @@ package main import ( "fmt" "encoding/json" - "strings" + //"strings" "os" "os/signal" "syscall" + "regexp" "github.com/bwmarrin/discordgo" ) @@ -56,8 +57,10 @@ func genericReply(s *discordgo.Session, m *discordgo.MessageCreate) { return } - if strings.Contains(m.Content, ";)") { + winks, _ := regexp.MatchString("([()|DoO];|;[()|DoOpP])", m.Content) + if winks { s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("<@%s> faggot", m.Author.ID)) + s.ChannelMessageDelete(m.ChannelID, m.ID) return }