Skip to content

Commit

Permalink
Merge pull request #35 from andreidimaano/groupBreakPatch
Browse files Browse the repository at this point in the history
hotfix group Break
  • Loading branch information
andreidimaano authored Mar 26, 2021
2 parents 5244093 + fa51acf commit ab47abe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/command/group/GroupPomodoro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { deleteGroupCanceledBreak, deleteGroupCanceledPomodoro, isCanceledGroup,
import { createGroup, deleteGroup } from "../../database/resolvers/GroupPomodoroResolver";
import { endBreakEmbed, startBreakEmbed } from "../pomodoro/BreakEmbed";
import { updateDatabase } from "../pomodoro/Pomodoro";
import { startEmbed } from "../pomodoro/PomodoroEmbed";
import { endGroupEmbed, startGroupEmbed } from "./GroupPomodoroEmbed";

export let GroupPomodoro = async (message: Message, workTime?: number, breakTime?: number) => {
Expand Down
4 changes: 2 additions & 2 deletions src/command/pomodoro/Pomodoro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export let Pomodoro = async ( message: Message, workTime?: number, breakTime?: n
await deleteUserCanceledBreak(authorId);
}

}, 60000 /*1000*/ * breakTimer!);
}, 60000 * breakTimer!);
}
} else {
console.log('Pomodoro was canceled');
await deleteUserCanceledPomodoro(authorId);
}
}, 60000 /*1000*/ * workTimer);
}, 60000 * workTimer);
}

export let errorCheck = (workTime?: number, breakTime?: number) => {
Expand Down
2 changes: 1 addition & 1 deletion src/invokers/MessageInvoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let executeCommand = async (message: Message, args: Arguments) => {
case 'group' : {
let validGroupPomodoro = await canStartGroup(message);
if(validGroupPomodoro) {
await GroupPomodoro(message, args.workTime, args.workTime);
await GroupPomodoro(message, args.workTime, args.breakTime);
}
break;
}
Expand Down
7 changes: 7 additions & 0 deletions src/invokers/messageParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export let parseArguments = (messageContent: string) : Arguments => {
}
}

if(args[0].toLowerCase() === "group" && args[1].toLowerCase() === "cancel") {
command = "cancel";
workTime = 0;
breakTime = 0;
isGroup = true;
}

return {
command: command,
workTime: workTime,
Expand Down

0 comments on commit ab47abe

Please sign in to comment.