-
Notifications
You must be signed in to change notification settings - Fork 196
[Himeth Thewmika] iP #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
himethcodes
wants to merge
36
commits into
nus-cs2113-AY2425S2:master
Choose a base branch
from
himethcodes:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Himeth Thewmika] iP #193
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
ff10a43
Level-0: Rename, Greet, Exit
himethT 303dc88
Level-1: Echo feature added
himethT c346b3f
Level-2: Add and List feature implemented
himethT 3bf3953
Level-3: Mark as Done
himethT c7eed91
Completed Level-3: Mark as Done
himethT 939475c
Level-4: Added support for ToDos, Deadlines, and Events
himethT 58239b4
Add BuddyException class
himethT 64e7da9
Add BuddyException class
himethT ee484f5
implement error handling with BuddyException (Level-5)
himethT d724241
Implement Level-6: Task Deletion Feature
himethT db6f55b
Resolve merge conflicts
himethT 1dcf586
Implemented Level-6: Delete task feature
himethT 2efca9d
Resolved merge conflicts for Level-6
himethT a0701af
Refactored BuddyBot to A-MoreOOP structure
himethT 25b958f
Update README.md
himethcodes 54e1247
Update BuddyBot.java
himethcodes 515bb1e
Update BuddyException.java
himethcodes 6b72961
Update Command.java
himethcodes e583251
Update Deadline.java
himethcodes 88b9ad8
Update Event.java
himethcodes f5f9c94
Update Parser.java
himethcodes 2663883
Update Storage.java
himethcodes dc30117
Update Task.java
himethcodes eba159a
Update TaskList.java
himethcodes b9ae938
Update Todo.java
himethcodes 647ec96
Update Ui.java
himethcodes f8914fe
Update DeadlineCommand.java
himethcodes dfb635a
Update DeleteCommand.java
himethcodes 7931a0d
Update EventCommand.java
himethcodes 7726b63
Update ExitCommand.java
himethcodes bdccdac
Update FindCommand.java
himethcodes b348061
Update ListCommand.java
himethcodes 3d2d513
Update MarkCommand.java
himethcodes 72a3150
Update ToDoCommand.java
himethcodes 1a301d1
Update UnmarkCommand.java
himethcodes 8741aac
Update README.md
himethcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Binary file not shown.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # BuddyBot project template | ||
|
|
||
| BuddyBot is a simple task management chatbot that helps you keep track of your to-dos, deadlines, and events. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| 1. Run BuddyBot using the command: | ||
| ``` | ||
| java -jar BuddyBot.jar | ||
| ``` | ||
| If you are using IntelliJ, you can also run it by clicking the Run button. | ||
|
|
||
| 2. Use commands to add, view, and manage your tasks | ||
|
|
||
| 3. Tasks are automatically saved between sessions | ||
|
|
||
| ## Available Commands | ||
|
|
||
| ### Adding Tasks | ||
|
|
||
| | Command | Format | Example | Description | | ||
| |---------|--------|---------|-------------| | ||
| | `todo` | `todo TASK_DESCRIPTION` | `todo read book` | Adds a simple to-do task | | ||
| | `deadline` | `deadline TASK_DESCRIPTION /by DEADLINE` | `deadline return book /by June 6th` | Adds a task with a deadline | | ||
| | `event` | `event TASK_DESCRIPTION /from START_TIME /to END_TIME` | `event team meeting /from Monday 2pm /to Monday 4pm` | Adds an event with start and end times | | ||
|
|
||
| ### Managing Tasks | ||
|
|
||
| | Command | Format | Example | Description | | ||
| |---------|--------|---------|-------------| | ||
| | `list` | `list` | `list` | Shows all tasks | | ||
| | `mark` | `mark TASK_NUMBER` | `mark 3` | Marks a task as done | | ||
| | `unmark` | `unmark TASK_NUMBER` | `unmark 2` | Marks a task as not done | | ||
| | `delete` | `delete TASK_NUMBER` | `delete 1` | Removes a task | | ||
| | `find` | `find KEYWORD` | `find book` | Finds tasks containing the keyword | | ||
| | `bye` | `bye` | `bye` | Exits the program | | ||
|
|
||
| ## Task Formats | ||
|
|
||
| Tasks are displayed in the following format: | ||
|
|
||
| - **To-Do**: `[T][✓] read book` (✓ means done, ✗ means not done) | ||
| - **Deadline**: `[D][✓] return book (by: June 6th)` | ||
| - **Event**: `[E][✓] team meeting (from: Monday 2pm to: Monday 4pm)` | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Adding Different Types of Tasks | ||
|
|
||
| ``` | ||
| todo finish homework | ||
| deadline complete project /by Friday | ||
| event doctor appointment /from Tuesday 10am /to Tuesday 11am | ||
| ``` | ||
|
|
||
| ### Managing Your Tasks | ||
|
|
||
| ``` | ||
| list | ||
| mark 2 | ||
| unmark 3 | ||
| delete 1 | ||
| ``` | ||
|
|
||
| ### Finding Tasks | ||
|
|
||
| ``` | ||
| find project | ||
| ____________________________________________________________ | ||
| Here are the matching tasks in your list: | ||
| 1.[T][✗] start new project | ||
| 2.[D][✓] complete project (by: Friday) | ||
| ``` | ||
|
|
||
| ## Tips | ||
|
|
||
| - Task numbers start from 1 (not 0) | ||
| - All commands are case-insensitive (`TODO` works the same as `todo`) | ||
| - Your tasks are automatically saved to a file for your next session | ||
| - Use specific keywords when searching to find relevant tasks more easily | ||
|
|
||
| ## Error Messages | ||
|
|
||
| If you see an error message, check that you're using the correct command format: | ||
|
|
||
| - For deadlines, use `/by` to specify the due date | ||
| - For events, use both `/from` and `/to` to specify start and end times | ||
| - Task numbers must be valid (can't mark or delete task #5 if you only have 3 tasks) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 0 | Finish project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # BuddyBot User Guide | ||
|
|
||
| Introduction | ||
| BuddyBot is an intelligent chatbot designed to help users manage their tasks efficiently. Whether you need to keep track of deadlines, events, or simple to-dos, BuddyBot makes it easy with an intuitive command-based interface. | ||
|
|
||
|
|
||
| ## Adding deadlines | ||
|
|
||
| Description: Adds a task with a deadline. | ||
|
|
||
| Command: /deadline <task description> /by <yyyy-mm-dd> | ||
|
|
||
| Example: /deadline Finish CS2103T project /by 2025-02-28 | ||
|
|
||
| Expected Output: Task added: Finish CS2103T project (by: 28 Feb 2025) | ||
|
|
||
| ## Adding Events | ||
|
|
||
| Description: Adds an event with a specific date and time. | ||
|
|
||
| Command : /event <event description> /at <yyyy-mm-dd hh:mm> | ||
|
|
||
| Example: /event NUS Hackathon /at 2025-03-05 14:00 | ||
|
|
||
| Expected Output: Event added: NUS Hackathon (at: 5 Mar 2025, 2:00 PM) | ||
|
|
||
| ## Adding To-Dos | ||
|
|
||
| Description: Adds a task without a deadline. | ||
|
|
||
| Command : /todo <task description> | ||
|
|
||
| Example: /todo Buy groceries | ||
|
|
||
| Expected Output: Task added: Buy groceries | ||
|
|
||
|
|
||
| ## Viewing Tasks | ||
|
|
||
| Description: Displays all stored tasks. | ||
|
|
||
| Command: /list | ||
|
|
||
| Expected Output: | ||
| 1. [T] Buy groceries | ||
| 2. [D] Finish CS2103T project (by: 28 Feb 2025) | ||
| 3. [E] NUS Hackathon (at: 5 Mar 2025, 2:00 PM) | ||
|
|
||
| ## Marking Tasks as Done | ||
|
|
||
| Description: Marks a specific task as completed. | ||
|
|
||
| Command: /done <task number> | ||
|
|
||
| Example: /done 2 | ||
|
|
||
| Expected Output: Task marked as done: Finish CS2103T project | ||
|
|
||
|
|
||
| ## Deleting Tasks | ||
|
|
||
| Description: Removes a task from the list. | ||
|
|
||
| Command : /delete <task number> | ||
|
|
||
| Example: /delete 1 | ||
|
|
||
| Expected Output: Task deleted: Buy groceries | ||
|
|
||
|
|
||
| ## Finding Tasks | ||
|
|
||
| Description: Searches for tasks containing a specific keyword. | ||
|
|
||
| Command: /find <keyword> | ||
|
|
||
| Example: /find project | ||
|
|
||
| Expected Output: 1. [D] Finish CS2103T project (by: 28 Feb 2025) | ||
|
|
||
| ## Exiting the Program | ||
|
|
||
| Description: Exits BuddyBot. | ||
|
|
||
| Command: /bye | ||
|
|
||
| Expected Output: Goodbye! See you soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import java.util.ArrayList; | ||
|
|
||
| /** | ||
| * A chatbot program that tracks different types of tasks. | ||
| */ | ||
|
|
||
|
|
||
| public class BuddyBot { | ||
| private Storage storage; | ||
| private TaskList tasks; | ||
| private Ui ui; | ||
| private Parser parser; | ||
|
|
||
|
|
||
| public BuddyBot(String filePath) { | ||
| ui = new Ui(); | ||
| storage = new Storage(filePath); | ||
| try { | ||
| tasks = new TaskList(storage.load()); | ||
| } catch (BuddyException e) { | ||
| ui.showLoadingError(); | ||
| tasks = new TaskList(); | ||
| } | ||
| parser = new Parser(); | ||
| } | ||
|
|
||
| public void run() { | ||
| ui.showWelcome(); | ||
| boolean isExit = false; | ||
|
|
||
| while (!isExit) { | ||
| try { | ||
| String fullCommand = ui.readCommand(); | ||
| ui.showLine(); | ||
| Command command = parser.parse(fullCommand); | ||
| command.execute(tasks, ui, storage); | ||
| isExit = command.isExit(); | ||
| } catch (BuddyException e) { | ||
| ui.showError(e.getMessage()); | ||
| } finally { | ||
| ui.showLine(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| new BuddyBot("data/duke.txt").run(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * Custom exception for handling specific errors in the application. | ||
| */ | ||
|
|
||
| public class BuddyException extends Exception { | ||
| public BuddyException(String message) { | ||
| super(message); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * Abstract class for all commands in Buddybot. | ||
| */ | ||
| public abstract class Command { | ||
| /** | ||
| * Executes the command. | ||
| * | ||
| * @param tasks The task list to operate on. | ||
| * @param ui The UI to display messages. | ||
| * @param storage The storage to save tasks. | ||
| * @throws BuddyException If there's an error executing the command. | ||
| */ | ||
| public abstract void execute(TaskList tasks, Ui ui, Storage storage) throws BuddyException; | ||
|
|
||
| /** | ||
| * Checks if this command is an exit command. | ||
| * | ||
| * @return True if this is an exit command, false otherwise. | ||
| */ | ||
| public boolean isExit() { | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
|
|
||
| public class Deadline extends Task { | ||
| protected String by; | ||
|
|
||
| /** | ||
| * Constructs a Deadline task. | ||
| * | ||
| * @param description Description of the task. | ||
| * @param by Deadline date/time. | ||
| */ | ||
| public Deadline(String description, String by) { | ||
| super(description); | ||
| this.by = by; | ||
| } | ||
|
|
||
| /** | ||
| * Constructs a Deadline task with a completion status. | ||
| * Used when loading from a file. | ||
| * | ||
| * @param description Description of the task. | ||
| * @param by Deadline date/time. | ||
| * @param isDone Whether the task is completed. | ||
| */ | ||
| public Deadline(String description, String by, boolean isDone) { | ||
| super(description, isDone); | ||
| this.by = by; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "[D]" + super.toString() + " (by: " + by + ")"; | ||
| } | ||
|
|
||
| @Override | ||
| public String toFileFormat() { | ||
| return "D | " + (isDone ? "1" : "0") + " | " + description + " | " + by; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /** | ||
| * Command to add a Deadline task. | ||
| */ | ||
|
|
||
| public class DeadlineCommand extends Command { | ||
| private String description; | ||
| private String by; | ||
|
|
||
| /** | ||
| * Creates a DeadlineCommand with the specified description and deadline. | ||
| * | ||
| * @param description Description of the Deadline task. | ||
| * @param by Deadline date/time. | ||
| */ | ||
| public DeadlineCommand(String description, String by) { | ||
| this.description = description; | ||
| this.by = by; | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(TaskList tasks, Ui ui, Storage storage) throws BuddyException { | ||
| Task task = new Deadline(description, by); | ||
| tasks.addTask(task); | ||
| ui.showTaskAdded(task, tasks.size()); | ||
| storage.save(tasks.getTasks()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid the usage of magic strings