|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"os/signal" |
|
|
|
"os/signal" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"syscall" |
|
|
|
"syscall" |
|
|
|
"time" |
|
|
|
"time" |
|
|
@ -429,22 +430,18 @@ func idFromUsername(username string) string { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func findVerification(s *discordgo.Session, m *discordgo.MessageCreate) { |
|
|
|
func findVerification(s *discordgo.Session, m *discordgo.MessageCreate) { |
|
|
|
|
|
|
|
defer log.PanicSafe() |
|
|
|
parts := strings.Split(m.Content, " ") |
|
|
|
parts := strings.Split(m.Content, " ") |
|
|
|
discordId := parts[1] |
|
|
|
discordId := parts[1] |
|
|
|
|
|
|
|
_, err := strconv.Atoi(discordId) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
discordId = idFromUsername(discordId) |
|
|
|
|
|
|
|
} |
|
|
|
user, err := s.GuildMember(config.GuildID, discordId) |
|
|
|
user, err := s.GuildMember(config.GuildID, discordId) |
|
|
|
uidFound := true |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.LogErrorType(err) |
|
|
|
log.LogErrorType(err) |
|
|
|
uidFound = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if !uidFound { |
|
|
|
|
|
|
|
discordId = idFromUsername(discordId) |
|
|
|
|
|
|
|
user, err = s.GuildMember(config.GuildID, discordId) |
|
|
|
|
|
|
|
uidFound = true |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
log.LogErrorType(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
matches, err := filepath.Glob(fmt.Sprintf("./verifications/*%+v*", discordId)) |
|
|
|
matches, err := filepath.Glob(fmt.Sprintf("./verifications/*%+v*", discordId)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.LogErrorType(err) |
|
|
|
log.LogErrorType(err) |
|
|
|