From b01a92fd046324c52cb452a54605acb1785cbbb5 Mon Sep 17 00:00:00 2001
From: Eduard Urbach <eduard@urbach.dev>
Date: Fri, 14 Mar 2025 14:54:36 +0100
Subject: [PATCH] Updated Discord username validator

---
 arn/UserAPI.go                  | 2 +-
 arn/validate/Validate.go        | 2 +-
 bots/discord/commands/Verify.go | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arn/UserAPI.go b/arn/UserAPI.go
index fec4de5a..47dbc217 100644
--- a/arn/UserAPI.go
+++ b/arn/UserAPI.go
@@ -112,7 +112,7 @@ func (user *User) Edit(ctx aero.Context, key string, value reflect.Value, newVal
 		}
 
 		if !validate.DiscordNick(newNick) {
-			return true, errors.New("Discord username must include your name and the 4-digit Discord tag (e.g. Yandere#1234)")
+			return true, errors.New("Not a valid Discord username")
 		}
 
 		// Trim spaces
diff --git a/arn/validate/Validate.go b/arn/validate/Validate.go
index 94de54d1..e323db1d 100644
--- a/arn/validate/Validate.go
+++ b/arn/validate/Validate.go
@@ -22,7 +22,7 @@ const (
 )
 
 var (
-	discordNickRegex = regexp.MustCompile(`^([^#]{2,32})#(\d{4})$`)
+	discordNickRegex = regexp.MustCompile(`^([^#]{2,32})$`)
 	emailRegex       = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
 )
 
diff --git a/bots/discord/commands/Verify.go b/bots/discord/commands/Verify.go
index 00c2887f..df4adb39 100644
--- a/bots/discord/commands/Verify.go
+++ b/bots/discord/commands/Verify.go
@@ -30,7 +30,7 @@ const (
 
 // Verify verifies that the given user has an account on notify.moe.
 func Verify(s *discordgo.Session, msg *discordgo.MessageCreate) bool {
-	discordTag := msg.Author.Username + "#" + msg.Author.Discriminator
+	discordTag := msg.Author.Username
 
 	if msg.Content == "!verify" {
 		_, err := s.ChannelMessageSend(msg.ChannelID, fmt.Sprintf("To verify your account, first add `%s` as your Discord account on https://notify.moe/settings/accounts, then type `!verify` followed by your username on notify.moe, e.g. `!verify MyName`", discordTag))