From 7bbbeeae9588fb68f3ad0aa9366aad4e978cc43c Mon Sep 17 00:00:00 2001 From: Caen Jones <131218155+CaenJones@users.noreply.github.com> Date: Wed, 16 Aug 2023 21:56:20 -0400 Subject: [PATCH 1/7] Update promptCMD so incorrect user syntax does not hid username When I attempted to use "prompt" in the past, it hid my username so I could only see it after I sent a message. --- commands.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 6f51a15f..062ceb5a 100644 --- a/commands.go +++ b/commands.go @@ -488,10 +488,24 @@ func nickCMD(line string, u *User) { } func promptCMD(line string, u *User) { - u.Prompt = line - u.formatPrompt() + err := setPrompt(line, u) + if err != nil { + fmt.Println("Error setting prompt:", err) + return + } + u.formatPrompt() } +func setPrompt(line string, u *User) error { + if line == "" { + return errors.New("Empty prompt") + } + + u.Prompt = line + return nil +} + + func listBansCMD(_ string, u *User) { msg := "Bans by ID: \n" for i := 0; i < len(Bans); i++ { From d9a0d1914f6b353b5717fb72aa6b14b25e7bb5b4 Mon Sep 17 00:00:00 2001 From: Caen Jones <131218155+CaenJones@users.noreply.github.com> Date: Fri, 18 Aug 2023 08:02:41 -0400 Subject: [PATCH 2/7] Update commands.go --- commands.go | 1 + 1 file changed, 1 insertion(+) diff --git a/commands.go b/commands.go index 062ceb5a..2e13dfe7 100644 --- a/commands.go +++ b/commands.go @@ -14,6 +14,7 @@ import ( "strings" "sync" "time" + "errors" "github.com/alecthomas/chroma" chromastyles "github.com/alecthomas/chroma/styles" From 73e2b36a8170c391c96dd3fc68b74246ad52fbeb Mon Sep 17 00:00:00 2001 From: Caen Jones <131218155+CaenJones@users.noreply.github.com> Date: Fri, 18 Aug 2023 19:56:54 -0400 Subject: [PATCH 3/7] Update commands.go --- commands.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/commands.go b/commands.go index 2e13dfe7..5d53eb9b 100644 --- a/commands.go +++ b/commands.go @@ -14,7 +14,6 @@ import ( "strings" "sync" "time" - "errors" "github.com/alecthomas/chroma" chromastyles "github.com/alecthomas/chroma/styles" @@ -489,24 +488,16 @@ func nickCMD(line string, u *User) { } func promptCMD(line string, u *User) { - err := setPrompt(line, u) - if err != nil { - fmt.Println("Error setting prompt:", err) - return - } + u.Prompt = line u.formatPrompt() -} -func setPrompt(line string, u *User) error { if line == "" { - return errors.New("Empty prompt") + fmt.Println("(Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info)") + } else { + fmt.Println("Prompt set successfully") } - - u.Prompt = line - return nil } - func listBansCMD(_ string, u *User) { msg := "Bans by ID: \n" for i := 0; i < len(Bans); i++ { From 25affe26d3599c350665fd9a2e694de131919f0b Mon Sep 17 00:00:00 2001 From: Caen Jones <131218155+CaenJones@users.noreply.github.com> Date: Sat, 19 Aug 2023 12:05:03 -0400 Subject: [PATCH 4/7] Update commands.go --- commands.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/commands.go b/commands.go index 5d53eb9b..7dd7c808 100644 --- a/commands.go +++ b/commands.go @@ -492,10 +492,8 @@ func promptCMD(line string, u *User) { u.formatPrompt() if line == "" { - fmt.Println("(Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info)") - } else { - fmt.Println("Prompt set successfully") - } + User.broadcast(Devbot, ("Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info") + } } func listBansCMD(_ string, u *User) { From efa95ff790f16603ff90262272b79332802125da Mon Sep 17 00:00:00 2001 From: Caen Jones <131218155+CaenJones@users.noreply.github.com> Date: Sat, 19 Aug 2023 12:09:39 -0400 Subject: [PATCH 5/7] sorry --- commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 7dd7c808..b202831e 100644 --- a/commands.go +++ b/commands.go @@ -492,8 +492,8 @@ func promptCMD(line string, u *User) { u.formatPrompt() if line == "" { - User.broadcast(Devbot, ("Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info") - } + User.broadcast(Devbot, "Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info") + } } func listBansCMD(_ string, u *User) { From 42d758d45953f103ac77aadaac254fce0718dfd0 Mon Sep 17 00:00:00 2001 From: Caen Jones <131218155+CaenJones@users.noreply.github.com> Date: Sat, 19 Aug 2023 12:13:03 -0400 Subject: [PATCH 6/7] Update commands.go --- commands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands.go b/commands.go index b202831e..f9365479 100644 --- a/commands.go +++ b/commands.go @@ -492,7 +492,7 @@ func promptCMD(line string, u *User) { u.formatPrompt() if line == "" { - User.broadcast(Devbot, "Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info") + MainRoom.broadcast(Devbot, "Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info") } } From 6a79ee97c0c49a62a388c78d8fb772f26b091db8 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Mon, 21 Aug 2023 16:34:42 -0400 Subject: [PATCH 7/7] Update commands.go --- commands.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/commands.go b/commands.go index f9365479..10303925 100644 --- a/commands.go +++ b/commands.go @@ -488,12 +488,11 @@ func nickCMD(line string, u *User) { } func promptCMD(line string, u *User) { - u.Prompt = line - u.formatPrompt() - - if line == "" { - MainRoom.broadcast(Devbot, "Your prompt is now empty. Did you mean to get more info about your prompt? Run man prompt for more info") - } + u.Prompt = line + u.formatPrompt() + if line == "" { + u.writeln(Devbot, "(Your prompt is now empty. Did you mean to get more info about your prompt? Run `man prompt` for more info)") + } } func listBansCMD(_ string, u *User) {