This commit is contained in:
liyunze 2024-05-28 09:48:13 +08:00
parent 24d58867c9
commit b40f670411
3 changed files with 59 additions and 60 deletions

View file

@ -51,19 +51,19 @@ const configs = (function () {
headerHorizontalPadding: "10px", // px headerHorizontalPadding: "10px", // px
headerVerticalPadding: "10px", // px headerVerticalPadding: "10px", // px
headerBackgroundColor: "#fff", // hex only headerBackgroundColor: "#000", // hex only
headerBackgroundOpacity: 1, // 0.0 - 1.0 headerBackgroundOpacity: 0.9, // 0.0 - 1.0
headerBorderWidth: "0px", // px headerBorderWidth: "0px", // px
headerBorderColor: "#ffffff", // hex or name headerBorderColor: "#ffffff", // hex or name
headerBorderRadius: "3px", // px headerBorderRadius: "10px", // px
headerFontFamily: "Fredoka", // font name headerFontFamily: "Fredoka", // font name
headerFontSize: "25px", // px headerFontSize: "25px", // px
headerFontWeight: "bold", // normal or bold or number headerFontWeight: "bold", // normal or bold or number
headerFontColor: "#000", // hex or name headerFontColor: "#fff", // hex or name
// body // body
bodyBackgroundColor: "#fff", // hex only bodyBackgroundColor: "#fff", // hex only
@ -76,13 +76,13 @@ const configs = (function () {
// task // task
lineHeight: 1.5, // number lineHeight: 1.5, // number
usernameFontWeight: "bold", // normal or bold or number usernameFontWeight: "bold", // normal or bold or number
usernameColor: "pink", // hex or name or "" for twitch user color usernameColor: "white", // hex or name or "" for twitch user color
usernameFontSize: "20px", // px usernameFontSize: "20px", // px
taskWidth: "100%", taskWidth: "100%",
taskBackgroundColor: "#000", // hex only taskBackgroundColor: "#000", // hex only
taskBackgroundOpacity: 0, // 0.0 - 1.0 taskBackgroundOpacity: 0.8, // 0.0 - 1.0
taskFontFamily: "Poppins", // font name taskFontFamily: "Poppins", // font name
@ -313,7 +313,7 @@ const configs = (function () {
duplicateTask: duplicateTask:
"Looks like you already have the {taskName} {message} up there {user}!", "Looks like you already have the {taskName} {message} up there {user}!",
taskEdited: taskEdited:
'{taskName} "{originalTask}" has been edited to {task} successfully, {user}', "{taskName} {originalTask} has been edited to {task} successfully, {user}",
noTaskEdit: "Try doing !edit [index] [new task] {user}", noTaskEdit: "Try doing !edit [index] [new task] {user}",
nowTask: nowTask:
"{taskName} {task} is now the task you are working on, {user}!", "{taskName} {task} is now the task you are working on, {user}!",

View file

@ -51,19 +51,19 @@ const defaultConfigs = (function () {
headerHorizontalPadding: "10px", // px headerHorizontalPadding: "10px", // px
headerVerticalPadding: "10px", // px headerVerticalPadding: "10px", // px
headerBackgroundColor: "#fff", // hex only headerBackgroundColor: "#000", // hex only
headerBackgroundOpacity: 1, // 0.0 - 1.0 headerBackgroundOpacity: 0.9, // 0.0 - 1.0
headerBorderWidth: "0px", // px headerBorderWidth: "0px", // px
headerBorderColor: "#ffffff", // hex or name headerBorderColor: "#ffffff", // hex or name
headerBorderRadius: "3px", // px headerBorderRadius: "10px", // px
headerFontFamily: "Fredoka", // font name headerFontFamily: "Fredoka", // font name
headerFontSize: "25px", // px headerFontSize: "25px", // px
headerFontWeight: "bold", // normal or bold or number headerFontWeight: "bold", // normal or bold or number
headerFontColor: "#000", // hex or name headerFontColor: "#fff", // hex or name
// body // body
bodyBackgroundColor: "#fff", // hex only bodyBackgroundColor: "#fff", // hex only
@ -76,13 +76,13 @@ const defaultConfigs = (function () {
// task // task
lineHeight: 1.5, // number lineHeight: 1.5, // number
usernameFontWeight: "bold", // normal or bold or number usernameFontWeight: "bold", // normal or bold or number
usernameColor: "pink", // hex or name or "" for twitch user color usernameColor: "white", // hex or name or "" for twitch user color
usernameFontSize: "20px", // px usernameFontSize: "20px", // px
taskWidth: "100%", taskWidth: "100%",
taskBackgroundColor: "#000", // hex only taskBackgroundColor: "#000", // hex only
taskBackgroundOpacity: 0, // 0.0 - 1.0 taskBackgroundOpacity: 0.8, // 0.0 - 1.0
taskFontFamily: "Poppins", // font name taskFontFamily: "Poppins", // font name
@ -311,9 +311,9 @@ const defaultConfigs = (function () {
noTaskContent: noTaskContent:
"Try using !task the-{taskName}-you-are-working-on {user}", "Try using !task the-{taskName}-you-are-working-on {user}",
duplicateTask: duplicateTask:
"Looks like you already have that {taskName} up there {user}!", "Looks like you already have the {taskName} {message} up there {user}!",
taskEdited: taskEdited:
'{taskName} "{originalTask}" has been edited to {task} successfully, {user}', "{taskName} {originalTask} has been edited to {task} successfully, {user}",
noTaskEdit: "Try doing !edit [index] [new task] {user}", noTaskEdit: "Try doing !edit [index] [new task] {user}",
nowTask: nowTask:
"{taskName} {task} is now the task you are working on, {user}!", "{taskName} {task} is now the task you are working on, {user}!",

View file

@ -22,7 +22,6 @@ DB structure:
const styles = configs.styles; const styles = configs.styles;
const scrollSpeed = configs.animation.scrollSpeed; const scrollSpeed = configs.animation.scrollSpeed;
const responses = configs.responses;
var openQuote = getSetting("openQuote"); var openQuote = getSetting("openQuote");
var closeQuote = getSetting("closeQuote"); var closeQuote = getSetting("closeQuote");
let scrolling = false; let scrolling = false;
@ -820,14 +819,14 @@ async function addTask(username, userColor, task) {
if (taskExists) { if (taskExists) {
return createErrorResponse( return createErrorResponse(
`@${username} already has this task`, `@${username} already has this task`,
responses.duplicateTask getResponse("duplicateTask")
); );
} }
if (taskIsInvalid) { if (taskIsInvalid) {
return createErrorResponse( return createErrorResponse(
`@${username} empty task or reserved keyword used`, `@${username} empty task or reserved keyword used`,
responses.noTaskContent getResponse("noTaskContent")
); );
} }
@ -836,7 +835,7 @@ async function addTask(username, userColor, task) {
`@${username} has reached the limit of ${getSetting( `@${username} has reached the limit of ${getSetting(
"limit" "limit"
)} tasks`, )} tasks`,
responses.noTaskAdded getResponse("noTaskAdded")
); );
} }
@ -915,14 +914,14 @@ async function nowTask(username, userColor, task) {
if (taskExists) { if (taskExists) {
return createErrorResponse( return createErrorResponse(
`@${username} already has this task`, `@${username} already has this task`,
responses.duplicateTask getResponse("duplicateTask")
); );
} }
if (taskIsInvalid) { if (taskIsInvalid) {
return createErrorResponse( return createErrorResponse(
`@${username} empty task or reserved keyword used`, `@${username} empty task or reserved keyword used`,
responses.noTaskContent getResponse("noTaskContent")
); );
} }
@ -931,14 +930,14 @@ async function nowTask(username, userColor, task) {
`@${username} has reached the limit of ${getSetting( `@${username} has reached the limit of ${getSetting(
"limit" "limit"
)} tasks`, )} tasks`,
responses.noTaskAdded getResponse("noTaskAdded")
); );
} }
if (taskHasSeparators) { if (taskHasSeparators) {
return createErrorResponse( return createErrorResponse(
`@${username} cannot add multiple tasks with now`, `@${username} cannot add multiple tasks with now`,
responses.noTaskContent getResponse("noTaskContent")
); );
} }
@ -993,14 +992,14 @@ async function nowTask(username, userColor, task) {
if (taskExists) { if (taskExists) {
return createErrorResponse( return createErrorResponse(
`@${username} already has this task`, `@${username} already has this task`,
responses.duplicateTask getResponse("duplicateTask")
); );
} }
if (taskIsInvalid) { if (taskIsInvalid) {
return createErrorResponse( return createErrorResponse(
`@${username} empty task or reserved keyword used`, `@${username} empty task or reserved keyword used`,
responses.noTaskContent getResponse("noTaskContent")
); );
} }
@ -1009,14 +1008,14 @@ async function nowTask(username, userColor, task) {
`@${username} has reached the limit of ${getSetting( `@${username} has reached the limit of ${getSetting(
"limit" "limit"
)} tasks`, )} tasks`,
responses.noTaskAdded getResponse("noTaskAdded")
); );
} }
if (taskHasSeparators) { if (taskHasSeparators) {
return createErrorResponse( return createErrorResponse(
`@${username} cannot add multiple tasks with now`, `@${username} cannot add multiple tasks with now`,
responses.noTaskContent getResponse("noTaskContent")
); );
} }
@ -1053,7 +1052,7 @@ async function focusTask(username, task) {
if (!tasks[username] || tasks[username].todos.length === 0) { if (!tasks[username] || tasks[username].todos.length === 0) {
return createErrorResponse( return createErrorResponse(
`@${username} has no tasks`, `@${username} has no tasks`,
responses.noTask getResponse("noTask")
); );
} }
@ -1061,14 +1060,14 @@ async function focusTask(username, task) {
if (incompleteTasks.length === 0) { if (incompleteTasks.length === 0) {
return createErrorResponse( return createErrorResponse(
`@${username} has no incomplete tasks`, `@${username} has no incomplete tasks`,
responses.noTask getResponse("noTask")
); );
} }
if (taskSeparator.some((separator) => task.includes(separator))) { if (taskSeparator.some((separator) => task.includes(separator))) {
return createErrorResponse( return createErrorResponse(
`@${username} need to specify ONLY ONE task`, `@${username} need to specify ONLY ONE task`,
responses.onlyOneFocus getResponse("onlyOneFocus")
); );
} }
@ -1084,21 +1083,21 @@ async function focusTask(username, task) {
} else { } else {
return createErrorResponse( return createErrorResponse(
`@${username} invalid input`, `@${username} invalid input`,
responses.specifyFocusTask getResponse("specifyFocusTask")
); );
} }
if (index < 0 || index > tasks[username].todos.length - 1) { if (index < 0 || index > tasks[username].todos.length - 1) {
return createErrorResponse( return createErrorResponse(
`@${username} invalid input`, `@${username} invalid input`,
responses.specifyFocusTask getResponse("specifyFocusTask")
); );
} }
} else { } else {
if (tasks[username].todos[index].done) { if (tasks[username].todos[index].done) {
return createErrorResponse( return createErrorResponse(
`@${username} task is already completed`, `@${username} task is already completed`,
responses.specifyFocusTask getResponse("specifyFocusTask")
); );
} }
} }
@ -1109,7 +1108,7 @@ async function focusTask(username, task) {
if (tasks[username].todos[index].focus) { if (tasks[username].todos[index].focus) {
return createErrorResponse( return createErrorResponse(
`@${username} task is already focused`, `@${username} task is already focused`,
responses.alreadyFocusedTask getResponse("alreadyFocusedTask")
); );
} }
@ -1117,7 +1116,7 @@ async function focusTask(username, task) {
if (tasks[username].todos[index].done) { if (tasks[username].todos[index].done) {
return createErrorResponse( return createErrorResponse(
`@${username} task is already completed`, `@${username} task is already completed`,
responses.specifyTaskIndex getResponse("specifyTaskIndex")
); );
} }
@ -1155,7 +1154,7 @@ async function unfocusTask(username) {
if (!tasks[username] || tasks[username].todos.length === 0) { if (!tasks[username] || tasks[username].todos.length === 0) {
return createErrorResponse( return createErrorResponse(
`@${username} has no tasks`, `@${username} has no tasks`,
responses.noTask getResponse("noTask")
); );
} }
@ -1163,7 +1162,7 @@ async function unfocusTask(username) {
if (!tasks[username].todos.find((t) => t.focus)) { if (!tasks[username].todos.find((t) => t.focus)) {
return createErrorResponse( return createErrorResponse(
`@${username} no tasks are focused`, `@${username} no tasks are focused`,
responses.noFocusedTask getResponse("noFocusedTask")
); );
} }
@ -1197,7 +1196,7 @@ async function removeTask(username, task) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -1258,7 +1257,7 @@ async function removeTask(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1304,7 +1303,7 @@ async function removeTask(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1314,7 +1313,7 @@ async function removeTask(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1628,7 +1627,7 @@ async function clearOwnDoneTasks(username) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -1664,7 +1663,7 @@ async function markTaskDone(username, task) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -1676,7 +1675,7 @@ async function markTaskDone(username, task) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no incomplete tasks`, "error message": `@${username} has no incomplete tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -1749,7 +1748,7 @@ async function markTaskDone(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1798,7 +1797,7 @@ async function markTaskDone(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1808,7 +1807,7 @@ async function markTaskDone(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1820,7 +1819,7 @@ async function markTaskDone(username, task) {
status: 2, status: 2,
body: { body: {
"error message": `@${username} task is already completed`, "error message": `@${username} task is already completed`,
error: responses.alreadyDoneTask, error: getResponse("alreadyDoneTask"),
}, },
}; };
} }
@ -1859,7 +1858,7 @@ async function markAllTasksAsDone(username) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -1894,7 +1893,7 @@ async function markTaskUndone(username, task) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -1954,7 +1953,7 @@ async function markTaskUndone(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -1990,7 +1989,7 @@ async function markTaskUndone(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -2000,7 +1999,7 @@ async function markTaskUndone(username, task) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -2058,7 +2057,7 @@ async function editTask(username, message) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -2081,7 +2080,7 @@ async function editTask(username, message) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -2098,7 +2097,7 @@ async function editTask(username, message) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.noTaskContent, error: getResponse("noTaskContent"),
}, },
}; };
} }
@ -2108,7 +2107,7 @@ async function editTask(username, message) {
status: 1, status: 1,
body: { body: {
"error message": `@${username} invalid input`, "error message": `@${username} invalid input`,
error: responses.specifyTaskIndex, error: getResponse("specifyTaskIndex"),
}, },
}; };
} }
@ -2217,7 +2216,7 @@ async function listTasks(username) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -2229,7 +2228,7 @@ async function listTasks(username) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no incomplete tasks`, "error message": `@${username} has no incomplete tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }
@ -2275,7 +2274,7 @@ async function clearUserTasks(username) {
status: 0, status: 0,
body: { body: {
"error message": `@${username} has no tasks`, "error message": `@${username} has no tasks`,
error: responses.noTask, error: getResponse("noTask"),
}, },
}; };
} }