Skip to content
Open
Show file tree
Hide file tree
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 Feb 7, 2025
303dc88
Level-1: Echo feature added
himethT Feb 7, 2025
c346b3f
Level-2: Add and List feature implemented
himethT Feb 7, 2025
3bf3953
Level-3: Mark as Done
himethT Feb 7, 2025
c7eed91
Completed Level-3: Mark as Done
himethT Feb 7, 2025
939475c
Level-4: Added support for ToDos, Deadlines, and Events
himethT Feb 8, 2025
58239b4
Add BuddyException class
himethT Feb 14, 2025
64e7da9
Add BuddyException class
himethT Feb 14, 2025
ee484f5
implement error handling with BuddyException (Level-5)
himethT Feb 24, 2025
d724241
Implement Level-6: Task Deletion Feature
himethT Feb 24, 2025
db6f55b
Resolve merge conflicts
himethT Mar 1, 2025
1dcf586
Implemented Level-6: Delete task feature
himethT Mar 1, 2025
2efca9d
Resolved merge conflicts for Level-6
himethT Mar 1, 2025
a0701af
Refactored BuddyBot to A-MoreOOP structure
himethT Mar 13, 2025
25b958f
Update README.md
himethcodes Mar 13, 2025
54e1247
Update BuddyBot.java
himethcodes Apr 1, 2025
515bb1e
Update BuddyException.java
himethcodes Apr 1, 2025
6b72961
Update Command.java
himethcodes Apr 1, 2025
e583251
Update Deadline.java
himethcodes Apr 1, 2025
88b9ad8
Update Event.java
himethcodes Apr 1, 2025
f5f9c94
Update Parser.java
himethcodes Apr 1, 2025
2663883
Update Storage.java
himethcodes Apr 1, 2025
dc30117
Update Task.java
himethcodes Apr 1, 2025
eba159a
Update TaskList.java
himethcodes Apr 1, 2025
b9ae938
Update Todo.java
himethcodes Apr 1, 2025
647ec96
Update Ui.java
himethcodes Apr 1, 2025
f8914fe
Update DeadlineCommand.java
himethcodes Apr 1, 2025
dfb635a
Update DeleteCommand.java
himethcodes Apr 1, 2025
7931a0d
Update EventCommand.java
himethcodes Apr 1, 2025
7726b63
Update ExitCommand.java
himethcodes Apr 1, 2025
bdccdac
Update FindCommand.java
himethcodes Apr 1, 2025
b348061
Update ListCommand.java
himethcodes Apr 1, 2025
3d2d513
Update MarkCommand.java
himethcodes Apr 1, 2025
72a3150
Update ToDoCommand.java
himethcodes Apr 1, 2025
1a301d1
Update UnmarkCommand.java
himethcodes Apr 1, 2025
8741aac
Update README.md
himethcodes Apr 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions README.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/README.md

This file was deleted.

File renamed without changes.
Binary file added ip/BuddyBot.jar
Binary file not shown.
File renamed without changes.
88 changes: 88 additions & 0 deletions ip/README.md
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)
1 change: 1 addition & 0 deletions ip/data/Duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 | Finish project
87 changes: 87 additions & 0 deletions ip/docs/README.md
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.
49 changes: 49 additions & 0 deletions ip/src/main/java/BuddyBot.java
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();
}
}
9 changes: 9 additions & 0 deletions ip/src/main/java/BuddyException.java
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);
}
}
23 changes: 23 additions & 0 deletions ip/src/main/java/Command.java
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;
}
}
38 changes: 38 additions & 0 deletions ip/src/main/java/Deadline.java
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 + ")";
Copy link
Copy Markdown

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

}

@Override
public String toFileFormat() {
return "D | " + (isDone ? "1" : "0") + " | " + description + " | " + by;
}
}
27 changes: 27 additions & 0 deletions ip/src/main/java/DeadlineCommand.java
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());
}
}
Loading