New features
- !count - !points - !boardcount - !focus - automaticDoneIndex
This commit is contained in:
parent
4ccbe0f50d
commit
aa1e513477
4 changed files with 1089 additions and 236 deletions
190
configs.js
190
configs.js
|
|
@ -2,8 +2,11 @@ const configs = (function () {
|
|||
"use strict";
|
||||
|
||||
// settings
|
||||
const enableLimit = true; // true or false
|
||||
const limit = 5; // integer
|
||||
const enableLimit = false; // true or false
|
||||
const limit = 10; // integer
|
||||
const automaticDoneIndex = true; // true or false - Automatically assume first unfinished task is complete
|
||||
const pointsName = "points"; // string
|
||||
const pointsPerTask = 10; // integer
|
||||
|
||||
// animation
|
||||
const scrollSpeed = 40; // milliseconds
|
||||
|
|
@ -16,7 +19,7 @@ const configs = (function () {
|
|||
|
||||
const taskListBorderWidth = "0px"; // px
|
||||
const taskListBorderColor = "#ffffff"; // hex or name
|
||||
const taskListBorderRadius = "5px"; // px
|
||||
const taskListBorderRadius = "0px"; // px
|
||||
|
||||
const taskListHorizontalPadding = "0px"; // px
|
||||
const taskListVerticalPadding = "0px"; // px
|
||||
|
|
@ -25,12 +28,12 @@ const configs = (function () {
|
|||
const headerHorizontalPadding = "10px"; // px
|
||||
const headerVerticalPadding = "10px"; // px
|
||||
|
||||
const headerBackgroundColor = "#000000"; // hex only
|
||||
const headerBackgroundOpacity = 0.8; // 0.0 - 1.0
|
||||
const headerBackgroundColor = "#fff"; // hex only
|
||||
const headerBackgroundOpacity = 1; // 0.0 - 1.0
|
||||
|
||||
const headerBorderWidth = "2px"; // px
|
||||
const headerBorderWidth = "0px"; // px
|
||||
const headerBorderColor = "#ffffff"; // hex or name
|
||||
const headerBorderRadius = "5px"; // px
|
||||
const headerBorderRadius = "3px"; // px
|
||||
|
||||
const headerFontFamily = "Fredoka"; // font name
|
||||
const headerGoogleFont = true; // true: use google font, false: use system font
|
||||
|
|
@ -38,10 +41,10 @@ const configs = (function () {
|
|||
const headerFontSize = "25px"; // px
|
||||
const headerFontWeight = "bold"; // normal or bold or number
|
||||
|
||||
const headerFontColor = "#ffffff"; // hex or name
|
||||
const headerFontColor = "#000"; // hex or name
|
||||
|
||||
// body
|
||||
const bodyBackgroundColor = "#000000"; // hex only
|
||||
const bodyBackgroundColor = "#fff"; // hex only
|
||||
const bodyBackgroundOpacity = 0; // 0.0 - 1.0
|
||||
|
||||
const bodyBorderWidth = "0px"; // px
|
||||
|
|
@ -51,27 +54,37 @@ const configs = (function () {
|
|||
// task
|
||||
const lineHeight = 1.5; // number
|
||||
const usernameFontWeight = "bold"; // normal or bold or number
|
||||
const usernameColor = "#ffc0cb"; // hex or name or "" for twitch user color
|
||||
const usernameColor = "pink"; // hex or name or "" for twitch user color
|
||||
|
||||
const taskWidth = "100%";
|
||||
|
||||
const taskBackgroundColor = "#000000"; // hex only
|
||||
const taskBackgroundOpacity = 0.7; // 0.0 - 1.0
|
||||
const taskBackgroundColor = "#fff"; // hex only
|
||||
const taskBackgroundOpacity = 0; // 0.0 - 1.0
|
||||
|
||||
const taskFontFamily = "Poppins"; // font name
|
||||
const taskGoogleFont = true; // true: use google font, false: use system font
|
||||
|
||||
const taskFontSize = "20px"; // px
|
||||
const taskFontColor = "#ffffff"; // hex or name
|
||||
const taskFontColor = "#fff"; // hex or name
|
||||
|
||||
const taskBorderColor = "#000000"; // hex or name
|
||||
const taskBorderColor = "#fff"; // hex or name
|
||||
const taskBorderWidth = "0px"; // px
|
||||
const taskBorderRadius = "5px"; // px
|
||||
const taskBorderRadius = "10px"; // px
|
||||
|
||||
const taskMarginBottom = "5px"; // px
|
||||
const taskMarginBottom = "10px"; // px
|
||||
const taskHorizontalPadding = "20px"; // px
|
||||
const taskVerticalPadding = "10px"; // px
|
||||
|
||||
// focus task
|
||||
const focusTaskBackgroundColor = "#fff"; // hex only
|
||||
const focusTaskBackgroundOpacity = 1; // 0.0 - 1.0
|
||||
const focusTaskBorderRadius = "5px"; // px
|
||||
|
||||
const focusTaskFontColor = "#000"; // hex or name
|
||||
|
||||
const focusTaskHorizontalPadding = "7px"; // px
|
||||
const focusTaskVerticalPadding = "0px"; // px
|
||||
|
||||
// Add task commands - please add commands in the exact format
|
||||
const addTaskCommands = [
|
||||
"!taska",
|
||||
|
|
@ -81,6 +94,7 @@ const configs = (function () {
|
|||
"!task",
|
||||
"!add",
|
||||
"!todo",
|
||||
"!a",
|
||||
];
|
||||
|
||||
// Edit task commands - please add commands in the exact format
|
||||
|
|
@ -90,11 +104,11 @@ const configs = (function () {
|
|||
"!etask",
|
||||
"!edittask",
|
||||
"!edit",
|
||||
"!e",
|
||||
];
|
||||
|
||||
// Delete task commands - please add commands in the exact format
|
||||
const deleteTaskCommands = [
|
||||
"!taskd",
|
||||
"!taskdel",
|
||||
"!taskdelete",
|
||||
"!deltask",
|
||||
|
|
@ -105,6 +119,7 @@ const configs = (function () {
|
|||
"!removetask",
|
||||
"!remove",
|
||||
"!delete",
|
||||
"!r",
|
||||
];
|
||||
|
||||
// Finish task commands - please add commands in the exact format
|
||||
|
|
@ -120,6 +135,7 @@ const configs = (function () {
|
|||
"!finish",
|
||||
"!done",
|
||||
"!finished",
|
||||
"!f",
|
||||
];
|
||||
|
||||
// Unfinish task commands - please add commands in the exact format
|
||||
|
|
@ -134,8 +150,14 @@ const configs = (function () {
|
|||
"!undone",
|
||||
"!unfinish",
|
||||
"!unfinished",
|
||||
"!u",
|
||||
];
|
||||
|
||||
// focus task commands - please add commands in the exact format
|
||||
const focusTaskCommands = ["!focus", "!taskfocus", "!focustask"];
|
||||
|
||||
const unfocusTaskCommands = ["!unfocus", "!taskunfocus", "!unfocustask"];
|
||||
|
||||
// Check task commands - please add commands in the exact format
|
||||
const checkCommands = [
|
||||
"!taskc",
|
||||
|
|
@ -153,6 +175,30 @@ const configs = (function () {
|
|||
// Clear my done commands - please add commands in the exact format
|
||||
const clearMyDoneCommands = ["!clearmydone"];
|
||||
|
||||
// check count commands - please add commands in the exact format
|
||||
const checkCountCommands = [
|
||||
"!taskcount",
|
||||
"!count",
|
||||
"!checkcount",
|
||||
"!mycount",
|
||||
];
|
||||
|
||||
const checkAllCountCommands = [
|
||||
"!taskallcount",
|
||||
"!allcount",
|
||||
"!checkallcount",
|
||||
"!boardcount",
|
||||
"!checkboardcount",
|
||||
"!taskboardcount",
|
||||
];
|
||||
|
||||
const checkMyPointsCommands = [
|
||||
"!taskpoints",
|
||||
"!points",
|
||||
"!mypoints",
|
||||
"!checkpoints",
|
||||
];
|
||||
|
||||
// Help commands - please add commands in the exact format
|
||||
const helpCommands = [
|
||||
"!taskh",
|
||||
|
|
@ -186,6 +232,12 @@ const configs = (function () {
|
|||
"!cleardone",
|
||||
];
|
||||
|
||||
const adminClearTasksCommands = ["!cleartasks"];
|
||||
|
||||
const adminResetBoardCount = ["!resetboardcount", "!resetallcount"];
|
||||
|
||||
const adminResetUsersCount = ["!resetuserscount"];
|
||||
|
||||
const adminClearAllCommands = [
|
||||
"!clearall",
|
||||
"!allclear",
|
||||
|
|
@ -195,37 +247,82 @@ const configs = (function () {
|
|||
"!aclear",
|
||||
];
|
||||
|
||||
// Responses
|
||||
const adminSetBoardCount = ["!setboardcount", "!setallcount"];
|
||||
|
||||
// Responses related to task addition
|
||||
const taskAdded = 'The task(s) "{task}" has been added, {user}!';
|
||||
const noTaskAdded =
|
||||
"Looks like you already hit the limit of incomplete tasks, {user}";
|
||||
const noTaskContent = "Try using !task the-task-you-are-working-on {user}";
|
||||
const taskDeleted =
|
||||
'Task(s) "{task}" has been deleted successfully, {user}';
|
||||
const specifyTaskIndex = "Try specifying the index of the task {user}";
|
||||
|
||||
const duplicateTask =
|
||||
"Looks like you already have the task '{message}' up there {user}!";
|
||||
|
||||
// Responses related to task deletion
|
||||
const taskDeleted =
|
||||
'Task(s) "{task}" has been deleted successfully, {user}';
|
||||
const specifyTaskIndex =
|
||||
"Try specifying the index of the incomplete task(s) {user}";
|
||||
const clearTasksExceptBroadcaster =
|
||||
"All tasks have been cleared except for the streamer's, {user}!";
|
||||
|
||||
const adminDeleteTasks = "All of {mentioned}'s tasks have been deleted";
|
||||
const taskFinished = 'Good job on finishing the task "{task}", {user}!';
|
||||
const allTasksFinished = "Good job on finishing all your tasks, {user}!";
|
||||
|
||||
// Responses related to task completion
|
||||
const taskFinished =
|
||||
'Good job on finishing the task(s) "{task}", {user}! You have earned {pointCount} {pointName} and completed {doneCount} task(s) so far!';
|
||||
const allTasksFinished =
|
||||
"Good job on finishing all your tasks, {user}! You have completed {doneCount} task(s) so far!";
|
||||
const taskUnfinished =
|
||||
'Task(s) "{task}" has been unmarked as done, {user}!';
|
||||
const taskAlreadyFinished =
|
||||
"Looks like you already finished that task {user}";
|
||||
|
||||
// Responses related to task editing
|
||||
const taskEdited =
|
||||
"Task '{originalTask}' has been edited to '{task}' successfully, {user}";
|
||||
const noTaskEdit = "Try doing !edit [index] [new task] {user}";
|
||||
|
||||
// Responses related to task focus
|
||||
const taskFocused = "Task(s) {task} has been focused, {user}!";
|
||||
const clearFocused = "Task(s) has been unfocused, {user}!";
|
||||
const noFocusedTask = "Looks like you don't have a focused task {user}!";
|
||||
const alreadyFocusedTask =
|
||||
"Looks like you already have that task set to focus {user}!";
|
||||
const onlyOneFocus = "You can only focus one task at a time {user}!";
|
||||
const specifyFocusTask =
|
||||
"Try specifying an incomplete task to focus {user}!";
|
||||
|
||||
// Responses related to task existence
|
||||
const noTask = "Looks like you don't have a task up there {user}";
|
||||
const noTaskA = "Looks like there is no task from that user there {user}";
|
||||
|
||||
// Responses related to viewing counts
|
||||
const checkMyPoints = "You have {pointCount} {pointName}, {user}!";
|
||||
const checkUserPoints =
|
||||
"{mentioned} has {pointCount} {pointName}, {user}!";
|
||||
const checkYourCount =
|
||||
"You have completed {doneCount} task(s) so far, {user}!";
|
||||
const checkUserCount =
|
||||
"{mentioned} has completed {doneCount} task(s) so far, {user}!";
|
||||
const checkAllCount =
|
||||
"Everyone has completed {doneCount} task(s) so far, {user}!";
|
||||
const noCountAll = "Looks like no one has completed a task yet {user}";
|
||||
|
||||
// Responses related to permissions
|
||||
const notMod = "Permission denied, {user}; Mods only";
|
||||
const clearedAll = "All tasks have been cleared!";
|
||||
const notStreamer = "Permission denied, {user}; Streamer only";
|
||||
|
||||
// Responses related to clearing tasks / counts
|
||||
const clearedAll = "All tasks and counts have been cleared!";
|
||||
const clearedTasks = "All tasks have been cleared!";
|
||||
const clearedDone = "All completed tasks have been cleared!";
|
||||
const clearedMyDone = "All your completed tasks have been cleared!";
|
||||
const clearedBoardCount = "The board count has been reset!";
|
||||
const clearedUsersCount = "The users count has been reset!";
|
||||
const setBoardCount = "The board count has been set to {count}!";
|
||||
const specifyUser = "Try specifying a user to delete their tasks {user}";
|
||||
const invalidNumber = "Try specifying a valid number {user}";
|
||||
|
||||
// Help response
|
||||
const help = `{user} Use the following commands to help you out - !task !edit !remove !done. For mods, you can do !adel @user. More commmands here: https://github.com/liyunze-coding/Chat-Task-Tic-Overlay/blob/main/MultiTask.md/`;
|
||||
// to edit check task command, go to
|
||||
// scripts/taskList.js
|
||||
|
|
@ -242,12 +339,19 @@ const configs = (function () {
|
|||
"!edit",
|
||||
"!remove",
|
||||
"!done",
|
||||
"!undone",
|
||||
"!botcred",
|
||||
"!count",
|
||||
"!points",
|
||||
"!boardcount",
|
||||
];
|
||||
|
||||
const settings = {
|
||||
enableLimit,
|
||||
limit,
|
||||
automaticDoneIndex,
|
||||
pointsName,
|
||||
pointsPerTask,
|
||||
headerGoogleFont,
|
||||
taskGoogleFont,
|
||||
};
|
||||
|
|
@ -291,6 +395,12 @@ const configs = (function () {
|
|||
taskMarginBottom,
|
||||
taskHorizontalPadding,
|
||||
taskVerticalPadding,
|
||||
focusTaskBackgroundColor,
|
||||
focusTaskBackgroundOpacity,
|
||||
focusTaskFontColor,
|
||||
focusTaskHorizontalPadding,
|
||||
focusTaskVerticalPadding,
|
||||
focusTaskBorderRadius,
|
||||
};
|
||||
|
||||
const animation = {
|
||||
|
|
@ -305,14 +415,23 @@ const configs = (function () {
|
|||
deleteTaskCommands,
|
||||
finishTaskCommands,
|
||||
unfinishTaskCommands,
|
||||
focusTaskCommands,
|
||||
unfocusTaskCommands,
|
||||
helpCommands,
|
||||
checkCommands,
|
||||
listCommands,
|
||||
clearMyDoneCommands,
|
||||
checkCountCommands,
|
||||
checkAllCountCommands,
|
||||
checkMyPointsCommands,
|
||||
adminDeleteCommands,
|
||||
adminClearNotStreamerCommands,
|
||||
adminClearDoneCommands,
|
||||
adminClearAllCommands,
|
||||
adminClearTasksCommands,
|
||||
adminSetBoardCount,
|
||||
adminResetBoardCount,
|
||||
adminResetUsersCount,
|
||||
additionalCommands,
|
||||
};
|
||||
|
||||
|
|
@ -326,18 +445,37 @@ const configs = (function () {
|
|||
taskFinished,
|
||||
allTasksFinished,
|
||||
taskUnfinished,
|
||||
taskAlreadyFinished,
|
||||
taskEdited,
|
||||
noTaskEdit,
|
||||
clearFocused,
|
||||
noFocusedTask,
|
||||
alreadyFocusedTask,
|
||||
onlyOneFocus,
|
||||
specifyFocusTask,
|
||||
taskFocused,
|
||||
noTask,
|
||||
noTaskA,
|
||||
checkMyPoints,
|
||||
checkUserPoints,
|
||||
checkYourCount,
|
||||
checkUserCount,
|
||||
checkAllCount,
|
||||
noCountAll,
|
||||
notMod,
|
||||
notStreamer,
|
||||
help,
|
||||
clearTasksExceptBroadcaster,
|
||||
adminDeleteTasks,
|
||||
clearedMyDone,
|
||||
clearedBoardCount,
|
||||
clearedUsersCount,
|
||||
clearedAll,
|
||||
clearedTasks,
|
||||
clearedDone,
|
||||
setBoardCount,
|
||||
specifyUser,
|
||||
invalidNumber,
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
|||
389
scripts/index.js
389
scripts/index.js
|
|
@ -1,5 +1,4 @@
|
|||
const commands = configs.commands;
|
||||
const responses = configs.responses;
|
||||
|
||||
let params = {};
|
||||
|
||||
|
|
@ -11,6 +10,10 @@ function respond(template, params) {
|
|||
.replace("{mentioned}", `@${params.mentioned}`)
|
||||
.replace("{task}", params.task)
|
||||
.replace("{originalTask}", params.originalTask)
|
||||
.replace("{doneCount}", params.doneCount)
|
||||
.replace("{count}", params.count)
|
||||
.replace("{pointName}", params.pointName)
|
||||
.replace("{pointCount}", params.pointCount)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -18,6 +21,10 @@ function isMod(flags) {
|
|||
return flags.broadcaster || flags.mod;
|
||||
}
|
||||
|
||||
function isStreamer(flags) {
|
||||
return flags.broadcaster;
|
||||
}
|
||||
|
||||
ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
||||
command = `!${command.toLowerCase()}`;
|
||||
|
||||
|
|
@ -27,138 +34,163 @@ ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
|||
mentioned: "",
|
||||
task: "",
|
||||
originalTask: "",
|
||||
doneCount: "",
|
||||
count: "",
|
||||
pointName: configs.settings.pointsName,
|
||||
pointCount: "",
|
||||
};
|
||||
|
||||
if (commands.addTaskCommands.includes(command)) {
|
||||
let addStatus = addTask(user, extra.userColor, message);
|
||||
|
||||
if (addStatus === 0) {
|
||||
// limit has reached
|
||||
respond(responses.noTaskAdded, params);
|
||||
} else if (addStatus === 1) {
|
||||
// duplicate task
|
||||
respond(responses.duplicateTask, params);
|
||||
} else if (addStatus === 2) {
|
||||
// task has no content
|
||||
respond(responses.noTaskContent, params);
|
||||
} else {
|
||||
let addResponse = responses.taskAdded;
|
||||
params.task = addStatus.task;
|
||||
|
||||
if (addStatus.tasksFailedToAdd !== "") {
|
||||
addResponse += ` | Failed to add task(s): "${addStatus.tasksFailedToAdd}"`;
|
||||
}
|
||||
|
||||
// task added
|
||||
respond(addResponse, params);
|
||||
}
|
||||
} else if (commands.editTaskCommands.includes(command)) {
|
||||
let editStatus = editTask(user, message);
|
||||
|
||||
if (editStatus === 0) {
|
||||
// no task
|
||||
respond(responses.noTask, params);
|
||||
} else if (editStatus === 1) {
|
||||
// invalid input
|
||||
respond(responses.noTaskEdit, params);
|
||||
} else {
|
||||
// task edited
|
||||
params.task = editStatus[1];
|
||||
params.originalTask = editStatus[0];
|
||||
respond(responses.taskEdited, params);
|
||||
}
|
||||
} else if (commands.deleteTaskCommands.includes(command)) {
|
||||
let removeStatus = removeTask(user, message);
|
||||
if (removeStatus === 0) {
|
||||
// no task
|
||||
respond(responses.noTask, params);
|
||||
} else if (removeStatus === 1) {
|
||||
// invalid input
|
||||
respond(responses.specifyTaskIndex, params);
|
||||
} else {
|
||||
// task deleted
|
||||
let deletedResponse = responses.taskDeleted;
|
||||
params.task = removeStatus.removedTasks;
|
||||
|
||||
if (removeStatus.failedTasks !== "") {
|
||||
deletedResponse += ` | Failed to delete task(s): "${removeStatus.failedTasks}"`;
|
||||
}
|
||||
|
||||
respond(deletedResponse, params);
|
||||
}
|
||||
} else if (commands.finishTaskCommands.includes(command)) {
|
||||
if (message === "all") {
|
||||
let finishAllStatus = markAllTasksAsDone(user);
|
||||
|
||||
if (finishAllStatus === 0) {
|
||||
// user has no tasks
|
||||
respond(responses.noTask, params);
|
||||
} else {
|
||||
// all tasks finished
|
||||
let finishedResponse = responses.allTasksFinished;
|
||||
|
||||
respond(finishedResponse, params);
|
||||
}
|
||||
let addRequest = addTask(user, extra.userColor, message);
|
||||
|
||||
if (addRequest.status !== 200) {
|
||||
respond(addRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
let finishStatus = markTaskDone(user, message);
|
||||
let addedResponse = responses.taskAdded;
|
||||
params.task = addRequest.body.task;
|
||||
|
||||
if (addRequest.body.tasksFailedToAdd !== "") {
|
||||
addedResponse += ` | Failed to add task(s): "${addRequest.body.tasksFailedToAdd}"`;
|
||||
}
|
||||
|
||||
respond(addedResponse, params);
|
||||
} else if (commands.editTaskCommands.includes(command)) {
|
||||
let editRequest = editTask(user, message);
|
||||
|
||||
if (editRequest.status !== 200) {
|
||||
respond(editRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
let originalTask = editRequest.body.originalTask;
|
||||
let newTask = editRequest.body.newTask;
|
||||
|
||||
params.task = newTask;
|
||||
params.originalTask = originalTask;
|
||||
|
||||
respond(responses.taskEdited, params);
|
||||
} else if (commands.deleteTaskCommands.includes(command)) {
|
||||
let removeRequest = removeTask(user, message);
|
||||
|
||||
if (removeRequest.status !== 200) {
|
||||
respond(removeRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
let deletedResponse = responses.taskDeleted;
|
||||
|
||||
let removedTasks = removeRequest.body.removedTasks;
|
||||
let failedTasks = removeRequest.body.failedTasks;
|
||||
|
||||
params.task = removedTasks;
|
||||
|
||||
if (failedTasks !== "") {
|
||||
deletedResponse += ` | Failed to delete task(s): "${failedTasks}"`;
|
||||
}
|
||||
|
||||
respond(deletedResponse, params);
|
||||
} else if (commands.finishTaskCommands.includes(command)) {
|
||||
if (message === "all") {
|
||||
let finishAllRequest = markAllTasksAsDone(user);
|
||||
|
||||
if (finishAllRequest.status !== 200) {
|
||||
respond(finishAllRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
let finishedAllResponse = responses.allTasksFinished;
|
||||
params.doneCount = completedTasksCount(user);
|
||||
|
||||
respond(finishedAllResponse, params);
|
||||
return;
|
||||
}
|
||||
|
||||
let finishRequest = markTaskDone(user, message);
|
||||
|
||||
if (finishRequest.status !== 200) {
|
||||
respond(finishRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
if (finishStatus === 0) {
|
||||
// user has no tasks
|
||||
respond(responses.noTask, params);
|
||||
} else if (finishStatus === 1) {
|
||||
// invalid input
|
||||
respond(responses.specifyTaskIndex, params);
|
||||
} else {
|
||||
// task finished
|
||||
let finishedResponse = responses.taskFinished;
|
||||
|
||||
params.task = finishStatus.markedTasks;
|
||||
params.task = finishRequest.body.markedTasks;
|
||||
params.doneCount = completedTasksCount(user);
|
||||
params.pointCount =
|
||||
finishRequest.body.markedTasksCount *
|
||||
configs.settings.pointsPerTask;
|
||||
|
||||
if (finishStatus.failedTasks !== "") {
|
||||
finishedResponse += ` | Failed to finish task(s): "${finishStatus.failedTasks}"`;
|
||||
if (finishRequest.body.failedTasks !== "") {
|
||||
finishedResponse += ` | Failed to finish task(s): "${finishRequest.body.failedTasks}"`;
|
||||
}
|
||||
|
||||
respond(finishedResponse, params);
|
||||
}
|
||||
} else if (commands.unfinishTaskCommands.includes(command)) {
|
||||
let unfinishStatus = markTaskUndone(user, message);
|
||||
let unfinishRequest = markTaskUndone(user, message);
|
||||
|
||||
if (unfinishRequest.status !== 200) {
|
||||
respond(unfinishRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
if (unfinishStatus === 0) {
|
||||
// user has no tasks
|
||||
respond(responses.noTask, params);
|
||||
} else if (unfinishStatus === 1) {
|
||||
// invalid input
|
||||
respond(responses.specifyTaskIndex, params);
|
||||
} else {
|
||||
// task unfinished
|
||||
let unfinishedResponse = responses.taskUnfinished;
|
||||
|
||||
params.task = unfinishStatus.markedTasks;
|
||||
params.task = unfinishRequest.body.markedTasks;
|
||||
|
||||
if (unfinishStatus.failedTasks !== "") {
|
||||
unfinishedResponse += ` | Failed to unfinish task(s): "${unfinishStatus.failedTasks}"`;
|
||||
if (unfinishRequest.body.failedTasks !== "") {
|
||||
unfinishedResponse += ` | Failed to unfinish task(s): "${unfinishRequest.body.failedTasks}"`;
|
||||
}
|
||||
|
||||
respond(unfinishedResponse, params);
|
||||
} else if (commands.focusTaskCommands.includes(command)) {
|
||||
let focusRequest = focusTask(user, message);
|
||||
|
||||
if (focusRequest.status !== 200) {
|
||||
respond(focusRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
// task focused
|
||||
let focusedResponse = responses.taskFocused;
|
||||
|
||||
params.task = focusRequest.body.focusedTask;
|
||||
|
||||
respond(focusedResponse, params);
|
||||
} else if (commands.unfocusTaskCommands.includes(command)) {
|
||||
let unfocusRequest = unfocusTask(user);
|
||||
|
||||
if (unfocusRequest.status !== 200) {
|
||||
respond(unfocusRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
// task unfocused
|
||||
let unfocusedResponse = responses.taskUnfocused;
|
||||
|
||||
respond(unfocusedResponse, params);
|
||||
} else if (commands.checkCommands.includes(command)) {
|
||||
if (message === "") {
|
||||
let response = checkTasks(user);
|
||||
if (response === 0) {
|
||||
return respond(responses.noTask, params);
|
||||
let checkRequest = checkTasks(user);
|
||||
if (checkRequest.status !== 200) {
|
||||
// no tasks
|
||||
respond(checkRequest.body.error, params);
|
||||
return;
|
||||
}
|
||||
return ComfyJS.Say(response);
|
||||
|
||||
return ComfyJS.Say(checkRequest.body.reply);
|
||||
} else {
|
||||
let mentioned = message.replace("@", "");
|
||||
let response = checkTasks(mentioned);
|
||||
if (response === 0) {
|
||||
let checkRequest = checkTasks(mentioned);
|
||||
|
||||
if (checkRequest.status !== 200) {
|
||||
// no tasks
|
||||
return respond(responses.noTaskA, params);
|
||||
respond(checkRequest.body.error, params);
|
||||
|
||||
return;
|
||||
}
|
||||
return ComfyJS.Say(response);
|
||||
return ComfyJS.Say(checkRequest.body.reply);
|
||||
}
|
||||
} else if (commands.adminDeleteCommands.includes(command)) {
|
||||
if (!isMod(flags)) {
|
||||
|
|
@ -172,31 +204,40 @@ ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
|||
return;
|
||||
}
|
||||
|
||||
clearUserTasks(mentioned);
|
||||
let clearUserTaskResponse = clearUserTasks(mentioned);
|
||||
|
||||
params.mentioned = mentioned;
|
||||
respond(responses.adminDeleteTasks, params);
|
||||
return mentioned;
|
||||
} else if (commands.adminClearDoneCommands.includes(command)) {
|
||||
if (!isMod(flags)) {
|
||||
respond(responses.notMod, params);
|
||||
|
||||
if (clearUserTaskResponse.status === 0) {
|
||||
// no tasks
|
||||
respond(responses.noTaskA, params);
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
|
||||
respond(responses.adminDeleteTasks, params);
|
||||
return;
|
||||
} else if (commands.adminClearDoneCommands.includes(command)) {
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
|
||||
clearAllDoneTasks();
|
||||
respond(responses.clearedDone, params);
|
||||
}
|
||||
} else if (commands.adminClearAllCommands.includes(command)) {
|
||||
if (!isMod(flags)) {
|
||||
respond(responses.notMod, params);
|
||||
return;
|
||||
} else {
|
||||
clearAllTasks();
|
||||
respond(responses.clearedAll, params);
|
||||
} else if (commands.adminClearAllCommands.includes(command)) {
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
} else if (commands.clearMyDoneCommands.includes(command)) {
|
||||
let response = clearOwnDoneTasks(user);
|
||||
|
||||
if (response === 0) {
|
||||
clearAll();
|
||||
respond(responses.clearedAll, params);
|
||||
return;
|
||||
} else if (commands.clearMyDoneCommands.includes(command)) {
|
||||
let clearOwnDoneResponse = clearOwnDoneTasks(user);
|
||||
|
||||
if (clearOwnDoneResponse.status === 0) {
|
||||
// no tasks
|
||||
respond(responses.noTask, params);
|
||||
return;
|
||||
|
|
@ -204,17 +245,109 @@ ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
|||
|
||||
respond(responses.clearedMyDone, params);
|
||||
} else if (commands.adminClearNotStreamerCommands.includes(command)) {
|
||||
clearAllExceptStreamer(auth.channel);
|
||||
respond(responses.clearTasksExceptBroadcaster, params);
|
||||
} else if (commands.helpCommands.includes(command)) {
|
||||
respond(responses.help, params);
|
||||
} else if (commands.listCommands.includes(command)) {
|
||||
let response = listTasks(user);
|
||||
if (response === 0) {
|
||||
respond(responses.noTask, params);
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
ComfyJS.Say(response);
|
||||
|
||||
clearAllExceptStreamer(auth.channel);
|
||||
respond(responses.clearTasksExceptBroadcaster, params);
|
||||
} else if (commands.adminClearTasksCommands.includes(command)) {
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
|
||||
clearAllTasks();
|
||||
respond(responses.clearedTasks, params);
|
||||
} else if (commands.listCommands.includes(command)) {
|
||||
let listTaskResponse = listTasks(user);
|
||||
|
||||
if (listTaskResponse.status !== 200) {
|
||||
// no tasks
|
||||
respond(listTaskResponse.body.error, params);
|
||||
return;
|
||||
}
|
||||
|
||||
respond(listTaskResponse.body.reply, params);
|
||||
} else if (commands.checkCountCommands.includes(command)) {
|
||||
if (message === "") {
|
||||
let count = completedTasksCount(user);
|
||||
|
||||
params.doneCount = count;
|
||||
|
||||
return respond(responses.checkYourCount, params);
|
||||
} else {
|
||||
let mentioned = message.replace("@", "");
|
||||
let count = completedTasksCount(mentioned);
|
||||
|
||||
params.doneCount = count;
|
||||
params.mentioned = mentioned;
|
||||
|
||||
return respond(responses.checkUserCount, params);
|
||||
}
|
||||
} else if (commands.checkAllCountCommands.includes(command)) {
|
||||
let count = getBoardTotalTaskCount();
|
||||
|
||||
if (count === 0) {
|
||||
respond(responses.noCountAll, params);
|
||||
return;
|
||||
}
|
||||
|
||||
params.doneCount = count;
|
||||
|
||||
respond(responses.checkAllCount, params);
|
||||
} else if (commands.checkMyPointsCommands.includes(command)) {
|
||||
if (message === "") {
|
||||
let points = calculatePoints(user);
|
||||
|
||||
params.pointCount = points;
|
||||
|
||||
return respond(responses.checkMyPoints, params);
|
||||
} else {
|
||||
let mentioned = message.replace("@", "");
|
||||
let points = calculatePoints(mentioned);
|
||||
|
||||
params.pointCount = points;
|
||||
params.mentioned = mentioned;
|
||||
|
||||
return respond(responses.checkUserPoints, params);
|
||||
}
|
||||
} else if (commands.adminSetBoardCount.includes(command)) {
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
|
||||
// check if message is a number using regex
|
||||
if (!/^\d+$/.test(message)) {
|
||||
respond(responses.invalidNumber, params);
|
||||
return;
|
||||
}
|
||||
|
||||
params.count = message;
|
||||
|
||||
setTotalCompleteCount(message);
|
||||
|
||||
respond(responses.setBoardCount, params);
|
||||
} else if (commands.adminResetBoardCount.includes(command)) {
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
|
||||
resetBoardCount();
|
||||
respond(responses.clearedBoardCount, params);
|
||||
} else if (commands.adminResetUsersCount.includes(command)) {
|
||||
if (!isStreamer(flags)) {
|
||||
respond(responses.notStreamer, params);
|
||||
return;
|
||||
}
|
||||
|
||||
resetUsersCount();
|
||||
respond(responses.clearedUsersCount, params);
|
||||
} else if (commands.helpCommands.includes(command)) {
|
||||
respond(responses.help, params);
|
||||
} else if (commands.additionalCommands[command]) {
|
||||
respond(commands.additionalCommands[command], params);
|
||||
} else {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -112,6 +112,8 @@ body {
|
|||
}
|
||||
#main-container .task-wrapper .task-container .task .user-tasks {
|
||||
list-style-position: inside;
|
||||
width: -moz-fit-content;
|
||||
width: fit-content;
|
||||
}
|
||||
#main-container .task-wrapper .task-container .task .user-tasks .todo {
|
||||
overflow: hidden;
|
||||
|
|
@ -120,4 +122,12 @@ body {
|
|||
}
|
||||
#main-container .task-wrapper .task-container .task .user-tasks .done {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
#main-container .task-wrapper .task-container .task .user-tasks .focus {
|
||||
background: var(--focus-task-background-color);
|
||||
color: var(--focus-task-font-color);
|
||||
padding: var(--focus-task-vertical-padding) var(--focus-task-horizontal-padding);
|
||||
border-radius: var(--focus-task-border-radius);
|
||||
width: -moz-fit-content;
|
||||
width: fit-content;
|
||||
}/*# sourceMappingURL=taskList.css.map */
|
||||
Loading…
Reference in a new issue