From a54f98c130bc8fff7333bc64a0f75cc52381c05a Mon Sep 17 00:00:00 2001 From: MAOXIONGKAI Date: Tue, 17 Sep 2024 18:40:55 +0800 Subject: [PATCH] Update messages to give Gopher a unique personality The current messages sent by gopher makes him sounds like a robot, which makes the application quite monotonous, this may reduce user experience because the interactions are not very entertaining Hence, some of the messages are rewritten to make sure that Gopher's messages are more friendly to the user, so as to enhance overall user experience --- src/main/java/gopher/Gopher.java | 2 +- .../exception/UnknownCommandException.java | 2 +- src/main/java/gopher/ui/UI.java | 50 +++++++++++-------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/main/java/gopher/Gopher.java b/src/main/java/gopher/Gopher.java index 8473172a6d..784f58771f 100644 --- a/src/main/java/gopher/Gopher.java +++ b/src/main/java/gopher/Gopher.java @@ -144,7 +144,7 @@ public static String executeUpdateTaskCommand(String userInput) { try { String[] tokens = userInput.split(" "); if (tokens.length < 2) { - return "Update command cannot be empty...\nPlease try again..."; + return "I don't know how you want the task to be updated\nPlease try again..."; } taskList.update(tokens); return "Hi I have updated this task for you already!"; diff --git a/src/main/java/gopher/exception/UnknownCommandException.java b/src/main/java/gopher/exception/UnknownCommandException.java index 659e7f8193..f83474cfc7 100644 --- a/src/main/java/gopher/exception/UnknownCommandException.java +++ b/src/main/java/gopher/exception/UnknownCommandException.java @@ -12,7 +12,7 @@ public UnknownCommandException(String command) { @Override public String getMessage() { - return "Unknown Command: " + return "Sorry, but I can't recognize this command: " + this.command + "\nPlease try again...\n\n"; } diff --git a/src/main/java/gopher/ui/UI.java b/src/main/java/gopher/ui/UI.java index 7d3c5fa977..27d00a0e3e 100644 --- a/src/main/java/gopher/ui/UI.java +++ b/src/main/java/gopher/ui/UI.java @@ -12,15 +12,19 @@ public class UI { * Get the greeting message to show to the user */ public static String getGreetMessage() { - return "Hi, welcome to Gopher!\n" - + "Here are the available commands:\n" + return "Hi, nice to meet you! I am Gopher!\n" + + "I will be your task managing assistant for today!\n" + + "If you want me to handle any task-related issues, here are the available commands:\n\n" + """ - 1. todo/deadline/event - Create event of these types - 2. mark/unmark X - Mark X-th task as done/not done - 3. find [keyword] - Find matching tasks based on keywords - 4. delete X - Delete X-th task - 5. list - List out the current tasks - 6. bye - End the interaction + 1. todo [name] - Create a todo task + 2. deadline [name] /by [due date] - Create a deadline that due by the given date + 3. event [name] /from [start date] /to [end date] - Create an Event with specified start and end dates + 4. mark/unmark X Y Z... - Mark tasks at position X Y Z as done/not done + 5. find [keyword] - Find matching tasks based on keywords + 6. delete X Y Z - Delete tasks at position X Y Z + 7. list - List out the current tasks + 8. update X [name] [fields] [detail] - update task at position X with the specified name and fields + 9. bye - End the interaction """; } @@ -30,7 +34,7 @@ public static String getGreetMessage() { * @param tasks TaskList object to be printed */ public static String getTaskListMessage(TaskList tasks) { - return String.format("You currently have %d %s in the list\n%s", + return String.format("You currently have %d %s in the task list\n%s", tasks.getSize(), tasks.getSize() == 1 ? "task" : "tasks", tasks); @@ -42,7 +46,7 @@ public static String getTaskListMessage(TaskList tasks) { * @param tasks TaskList object containing all the matched tasks */ public static String getMatchedTasksMessage(TaskList tasks) { - return String.format("Found %d matching %s in your list:\n%s", + return String.format("I have found %d matching %s in your task list:\n%s", tasks.getSize(), tasks.getSize() == 1 ? "task" : "tasks", tasks @@ -55,7 +59,7 @@ public static String getMatchedTasksMessage(TaskList tasks) { * @param task task to be added */ public static String getAddTaskMessage(Task task) { - return "Got it! I have added this task:\n" + task; + return "Got it! I have added this task for you:\n" + task; } /** @@ -64,7 +68,7 @@ public static String getAddTaskMessage(Task task) { * @param task task to be marked as done */ public static String getMarkAsDoneMessage(Task task) { - return String.format("Nice! I've marked this task as done:\n%s\n", task); + return String.format("I've marked this task as done:\n%s\nWell done! Keep up the good work!", task); } /** @@ -101,26 +105,30 @@ public static String getUnknownCommandWarning(UnknownCommandException e) { return e.getMessage() + """ - Current Supported Commands: + Currently I can understand the following commands: 1. todo - Create a ToDo Task 2. deadline - Create a Deadline Task 3. event - Create an Event Task - 4. mark - Mark a task as done - 5. unmark - Mark a task as not done + 4. mark - Mark tasks as done + 5. unmark - Mark tasks as not done 6. find - Find tasks based on keywords - 7. bye - Exit the chatbot + 7. update - Update a task with provided information + 8. delete - Delete tasks from the task list + 9. bye - Exit the chatbot - Note: The command is case-insensitive, + Note that the command is case-insensitive, as long as the input characters match, - the chatbot would be able to respond to the given command"""; + I would be able to respond to the given command"""; } /** * Get the helping message when user inputs invalid date. */ public static String getInvalidDateWarning() { - return ("Oops...Seems like you have passed in invalid date...\n" - + "Please try again with valid date and correct format...\n" - + "Current accepted date format: YYYY-MM-DD or YYYY-MM-DD hh:mm"); + return ("Oops...Seems like you have provided me an invalid date...\n" + + "Please try again with a valid date in correct format...\n" + + "Currently I can read date inputs in the following formats:\n" + + " 1. YYYY-MM-DD\n" + + " 2. YYYY-MM-DD hh:mm"); } }