From 578174e878693ff4cd49c406e59ed5ea4bf7608c Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Tue, 12 Oct 2021 13:38:52 -0400 Subject: [PATCH] Only accept certain formats. --- discordMessage.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/discordMessage.go b/discordMessage.go index 76bd09b..daad13c 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -109,6 +109,18 @@ func handlePM(s *discordgo.Session, m *discordgo.MessageCreate) { s.ChannelMessageSend(m.ChannelID, "You have tried to send an unsupported file (HEIC). Please try again using an image (jpeg, jpg, png, etc).") return } + if strings.HasSuffix(strings.ToUpper(m.Attachments[0].ProxyURL), "MP4") { + s.ChannelMessageSend(m.ChannelID, "You have tried to send an unsupported file (MP4 Video). Please try again using an image (jpeg, jpg, png, etc).") + return + } + if strings.HasSuffix(strings.ToUpper(m.Attachments[0].ProxyURL), "MP3") { + s.ChannelMessageSend(m.ChannelID, "You have tried to send an unsupported file (MP3 Audio). Please try again using an image (jpeg, jpg, png, etc).") + return + } + if !strings.HasSuffix(strings.ToUpper(m.Attachments[0].ProxyURL), "JPG") || !strings.HasSuffix(strings.ToUpper(m.Attachments[0].ProxyURL), "JPEG") || !strings.HasSuffix(strings.ToUpper(m.Attachments[0].ProxyURL), "PNG") || !strings.HasSuffix(strings.ToUpper(m.Attachments[0].ProxyURL), "BMP") { + s.ChannelMessageSend(config.AdminChannel, "You have tried to send an unsupported file. Please try again using an image (jpeg, jpg, png, etc).") + //return + } delete(config.Unverified, m.Author.ID) var v Verification v.Submitted = time.Now()