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";
|
"use strict";
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
const enableLimit = true; // true or false
|
const enableLimit = false; // true or false
|
||||||
const limit = 5; // integer
|
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
|
// animation
|
||||||
const scrollSpeed = 40; // milliseconds
|
const scrollSpeed = 40; // milliseconds
|
||||||
|
|
@ -16,7 +19,7 @@ const configs = (function () {
|
||||||
|
|
||||||
const taskListBorderWidth = "0px"; // px
|
const taskListBorderWidth = "0px"; // px
|
||||||
const taskListBorderColor = "#ffffff"; // hex or name
|
const taskListBorderColor = "#ffffff"; // hex or name
|
||||||
const taskListBorderRadius = "5px"; // px
|
const taskListBorderRadius = "0px"; // px
|
||||||
|
|
||||||
const taskListHorizontalPadding = "0px"; // px
|
const taskListHorizontalPadding = "0px"; // px
|
||||||
const taskListVerticalPadding = "0px"; // px
|
const taskListVerticalPadding = "0px"; // px
|
||||||
|
|
@ -25,12 +28,12 @@ const configs = (function () {
|
||||||
const headerHorizontalPadding = "10px"; // px
|
const headerHorizontalPadding = "10px"; // px
|
||||||
const headerVerticalPadding = "10px"; // px
|
const headerVerticalPadding = "10px"; // px
|
||||||
|
|
||||||
const headerBackgroundColor = "#000000"; // hex only
|
const headerBackgroundColor = "#fff"; // hex only
|
||||||
const headerBackgroundOpacity = 0.8; // 0.0 - 1.0
|
const headerBackgroundOpacity = 1; // 0.0 - 1.0
|
||||||
|
|
||||||
const headerBorderWidth = "2px"; // px
|
const headerBorderWidth = "0px"; // px
|
||||||
const headerBorderColor = "#ffffff"; // hex or name
|
const headerBorderColor = "#ffffff"; // hex or name
|
||||||
const headerBorderRadius = "5px"; // px
|
const headerBorderRadius = "3px"; // px
|
||||||
|
|
||||||
const headerFontFamily = "Fredoka"; // font name
|
const headerFontFamily = "Fredoka"; // font name
|
||||||
const headerGoogleFont = true; // true: use google font, false: use system font
|
const headerGoogleFont = true; // true: use google font, false: use system font
|
||||||
|
|
@ -38,10 +41,10 @@ const configs = (function () {
|
||||||
const headerFontSize = "25px"; // px
|
const headerFontSize = "25px"; // px
|
||||||
const headerFontWeight = "bold"; // normal or bold or number
|
const headerFontWeight = "bold"; // normal or bold or number
|
||||||
|
|
||||||
const headerFontColor = "#ffffff"; // hex or name
|
const headerFontColor = "#000"; // hex or name
|
||||||
|
|
||||||
// body
|
// body
|
||||||
const bodyBackgroundColor = "#000000"; // hex only
|
const bodyBackgroundColor = "#fff"; // hex only
|
||||||
const bodyBackgroundOpacity = 0; // 0.0 - 1.0
|
const bodyBackgroundOpacity = 0; // 0.0 - 1.0
|
||||||
|
|
||||||
const bodyBorderWidth = "0px"; // px
|
const bodyBorderWidth = "0px"; // px
|
||||||
|
|
@ -51,27 +54,37 @@ const configs = (function () {
|
||||||
// task
|
// task
|
||||||
const lineHeight = 1.5; // number
|
const lineHeight = 1.5; // number
|
||||||
const usernameFontWeight = "bold"; // normal or bold or 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 taskWidth = "100%";
|
||||||
|
|
||||||
const taskBackgroundColor = "#000000"; // hex only
|
const taskBackgroundColor = "#fff"; // hex only
|
||||||
const taskBackgroundOpacity = 0.7; // 0.0 - 1.0
|
const taskBackgroundOpacity = 0; // 0.0 - 1.0
|
||||||
|
|
||||||
const taskFontFamily = "Poppins"; // font name
|
const taskFontFamily = "Poppins"; // font name
|
||||||
const taskGoogleFont = true; // true: use google font, false: use system font
|
const taskGoogleFont = true; // true: use google font, false: use system font
|
||||||
|
|
||||||
const taskFontSize = "20px"; // px
|
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 taskBorderWidth = "0px"; // px
|
||||||
const taskBorderRadius = "5px"; // px
|
const taskBorderRadius = "10px"; // px
|
||||||
|
|
||||||
const taskMarginBottom = "5px"; // px
|
const taskMarginBottom = "10px"; // px
|
||||||
const taskHorizontalPadding = "20px"; // px
|
const taskHorizontalPadding = "20px"; // px
|
||||||
const taskVerticalPadding = "10px"; // 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
|
// Add task commands - please add commands in the exact format
|
||||||
const addTaskCommands = [
|
const addTaskCommands = [
|
||||||
"!taska",
|
"!taska",
|
||||||
|
|
@ -81,6 +94,7 @@ const configs = (function () {
|
||||||
"!task",
|
"!task",
|
||||||
"!add",
|
"!add",
|
||||||
"!todo",
|
"!todo",
|
||||||
|
"!a",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Edit task commands - please add commands in the exact format
|
// Edit task commands - please add commands in the exact format
|
||||||
|
|
@ -90,11 +104,11 @@ const configs = (function () {
|
||||||
"!etask",
|
"!etask",
|
||||||
"!edittask",
|
"!edittask",
|
||||||
"!edit",
|
"!edit",
|
||||||
|
"!e",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Delete task commands - please add commands in the exact format
|
// Delete task commands - please add commands in the exact format
|
||||||
const deleteTaskCommands = [
|
const deleteTaskCommands = [
|
||||||
"!taskd",
|
|
||||||
"!taskdel",
|
"!taskdel",
|
||||||
"!taskdelete",
|
"!taskdelete",
|
||||||
"!deltask",
|
"!deltask",
|
||||||
|
|
@ -105,6 +119,7 @@ const configs = (function () {
|
||||||
"!removetask",
|
"!removetask",
|
||||||
"!remove",
|
"!remove",
|
||||||
"!delete",
|
"!delete",
|
||||||
|
"!r",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Finish task commands - please add commands in the exact format
|
// Finish task commands - please add commands in the exact format
|
||||||
|
|
@ -120,6 +135,7 @@ const configs = (function () {
|
||||||
"!finish",
|
"!finish",
|
||||||
"!done",
|
"!done",
|
||||||
"!finished",
|
"!finished",
|
||||||
|
"!f",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Unfinish task commands - please add commands in the exact format
|
// Unfinish task commands - please add commands in the exact format
|
||||||
|
|
@ -134,8 +150,14 @@ const configs = (function () {
|
||||||
"!undone",
|
"!undone",
|
||||||
"!unfinish",
|
"!unfinish",
|
||||||
"!unfinished",
|
"!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
|
// Check task commands - please add commands in the exact format
|
||||||
const checkCommands = [
|
const checkCommands = [
|
||||||
"!taskc",
|
"!taskc",
|
||||||
|
|
@ -153,6 +175,30 @@ const configs = (function () {
|
||||||
// Clear my done commands - please add commands in the exact format
|
// Clear my done commands - please add commands in the exact format
|
||||||
const clearMyDoneCommands = ["!clearmydone"];
|
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
|
// Help commands - please add commands in the exact format
|
||||||
const helpCommands = [
|
const helpCommands = [
|
||||||
"!taskh",
|
"!taskh",
|
||||||
|
|
@ -186,6 +232,12 @@ const configs = (function () {
|
||||||
"!cleardone",
|
"!cleardone",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const adminClearTasksCommands = ["!cleartasks"];
|
||||||
|
|
||||||
|
const adminResetBoardCount = ["!resetboardcount", "!resetallcount"];
|
||||||
|
|
||||||
|
const adminResetUsersCount = ["!resetuserscount"];
|
||||||
|
|
||||||
const adminClearAllCommands = [
|
const adminClearAllCommands = [
|
||||||
"!clearall",
|
"!clearall",
|
||||||
"!allclear",
|
"!allclear",
|
||||||
|
|
@ -195,37 +247,82 @@ const configs = (function () {
|
||||||
"!aclear",
|
"!aclear",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Responses
|
const adminSetBoardCount = ["!setboardcount", "!setallcount"];
|
||||||
|
|
||||||
|
// Responses related to task addition
|
||||||
const taskAdded = 'The task(s) "{task}" has been added, {user}!';
|
const taskAdded = 'The task(s) "{task}" has been added, {user}!';
|
||||||
const noTaskAdded =
|
const noTaskAdded =
|
||||||
"Looks like you already hit the limit of incomplete tasks, {user}";
|
"Looks like you already hit the limit of incomplete tasks, {user}";
|
||||||
const noTaskContent = "Try using !task the-task-you-are-working-on {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 =
|
const duplicateTask =
|
||||||
"Looks like you already have the task '{message}' up there {user}!";
|
"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 =
|
const clearTasksExceptBroadcaster =
|
||||||
"All tasks have been cleared except for the streamer's, {user}!";
|
"All tasks have been cleared except for the streamer's, {user}!";
|
||||||
|
|
||||||
const adminDeleteTasks = "All of {mentioned}'s tasks have been deleted";
|
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 =
|
const taskUnfinished =
|
||||||
'Task(s) "{task}" has been unmarked as done, {user}!';
|
'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 =
|
const taskEdited =
|
||||||
"Task '{originalTask}' has been edited to '{task}' successfully, {user}";
|
"Task '{originalTask}' has been edited to '{task}' successfully, {user}";
|
||||||
const noTaskEdit = "Try doing !edit [index] [new task] {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 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}";
|
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 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 clearedDone = "All completed tasks have been cleared!";
|
||||||
const clearedMyDone = "All your 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 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/`;
|
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
|
// to edit check task command, go to
|
||||||
// scripts/taskList.js
|
// scripts/taskList.js
|
||||||
|
|
@ -242,12 +339,19 @@ const configs = (function () {
|
||||||
"!edit",
|
"!edit",
|
||||||
"!remove",
|
"!remove",
|
||||||
"!done",
|
"!done",
|
||||||
|
"!undone",
|
||||||
"!botcred",
|
"!botcred",
|
||||||
|
"!count",
|
||||||
|
"!points",
|
||||||
|
"!boardcount",
|
||||||
];
|
];
|
||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
enableLimit,
|
enableLimit,
|
||||||
limit,
|
limit,
|
||||||
|
automaticDoneIndex,
|
||||||
|
pointsName,
|
||||||
|
pointsPerTask,
|
||||||
headerGoogleFont,
|
headerGoogleFont,
|
||||||
taskGoogleFont,
|
taskGoogleFont,
|
||||||
};
|
};
|
||||||
|
|
@ -291,6 +395,12 @@ const configs = (function () {
|
||||||
taskMarginBottom,
|
taskMarginBottom,
|
||||||
taskHorizontalPadding,
|
taskHorizontalPadding,
|
||||||
taskVerticalPadding,
|
taskVerticalPadding,
|
||||||
|
focusTaskBackgroundColor,
|
||||||
|
focusTaskBackgroundOpacity,
|
||||||
|
focusTaskFontColor,
|
||||||
|
focusTaskHorizontalPadding,
|
||||||
|
focusTaskVerticalPadding,
|
||||||
|
focusTaskBorderRadius,
|
||||||
};
|
};
|
||||||
|
|
||||||
const animation = {
|
const animation = {
|
||||||
|
|
@ -305,14 +415,23 @@ const configs = (function () {
|
||||||
deleteTaskCommands,
|
deleteTaskCommands,
|
||||||
finishTaskCommands,
|
finishTaskCommands,
|
||||||
unfinishTaskCommands,
|
unfinishTaskCommands,
|
||||||
|
focusTaskCommands,
|
||||||
|
unfocusTaskCommands,
|
||||||
helpCommands,
|
helpCommands,
|
||||||
checkCommands,
|
checkCommands,
|
||||||
listCommands,
|
listCommands,
|
||||||
clearMyDoneCommands,
|
clearMyDoneCommands,
|
||||||
|
checkCountCommands,
|
||||||
|
checkAllCountCommands,
|
||||||
|
checkMyPointsCommands,
|
||||||
adminDeleteCommands,
|
adminDeleteCommands,
|
||||||
adminClearNotStreamerCommands,
|
adminClearNotStreamerCommands,
|
||||||
adminClearDoneCommands,
|
adminClearDoneCommands,
|
||||||
adminClearAllCommands,
|
adminClearAllCommands,
|
||||||
|
adminClearTasksCommands,
|
||||||
|
adminSetBoardCount,
|
||||||
|
adminResetBoardCount,
|
||||||
|
adminResetUsersCount,
|
||||||
additionalCommands,
|
additionalCommands,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -326,18 +445,37 @@ const configs = (function () {
|
||||||
taskFinished,
|
taskFinished,
|
||||||
allTasksFinished,
|
allTasksFinished,
|
||||||
taskUnfinished,
|
taskUnfinished,
|
||||||
|
taskAlreadyFinished,
|
||||||
taskEdited,
|
taskEdited,
|
||||||
noTaskEdit,
|
noTaskEdit,
|
||||||
|
clearFocused,
|
||||||
|
noFocusedTask,
|
||||||
|
alreadyFocusedTask,
|
||||||
|
onlyOneFocus,
|
||||||
|
specifyFocusTask,
|
||||||
|
taskFocused,
|
||||||
noTask,
|
noTask,
|
||||||
noTaskA,
|
noTaskA,
|
||||||
|
checkMyPoints,
|
||||||
|
checkUserPoints,
|
||||||
|
checkYourCount,
|
||||||
|
checkUserCount,
|
||||||
|
checkAllCount,
|
||||||
|
noCountAll,
|
||||||
notMod,
|
notMod,
|
||||||
|
notStreamer,
|
||||||
help,
|
help,
|
||||||
clearTasksExceptBroadcaster,
|
clearTasksExceptBroadcaster,
|
||||||
adminDeleteTasks,
|
adminDeleteTasks,
|
||||||
clearedMyDone,
|
clearedMyDone,
|
||||||
|
clearedBoardCount,
|
||||||
|
clearedUsersCount,
|
||||||
clearedAll,
|
clearedAll,
|
||||||
|
clearedTasks,
|
||||||
clearedDone,
|
clearedDone,
|
||||||
|
setBoardCount,
|
||||||
specifyUser,
|
specifyUser,
|
||||||
|
invalidNumber,
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
415
scripts/index.js
415
scripts/index.js
|
|
@ -1,5 +1,4 @@
|
||||||
const commands = configs.commands;
|
const commands = configs.commands;
|
||||||
const responses = configs.responses;
|
|
||||||
|
|
||||||
let params = {};
|
let params = {};
|
||||||
|
|
||||||
|
|
@ -11,6 +10,10 @@ function respond(template, params) {
|
||||||
.replace("{mentioned}", `@${params.mentioned}`)
|
.replace("{mentioned}", `@${params.mentioned}`)
|
||||||
.replace("{task}", params.task)
|
.replace("{task}", params.task)
|
||||||
.replace("{originalTask}", params.originalTask)
|
.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;
|
return flags.broadcaster || flags.mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isStreamer(flags) {
|
||||||
|
return flags.broadcaster;
|
||||||
|
}
|
||||||
|
|
||||||
ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
||||||
command = `!${command.toLowerCase()}`;
|
command = `!${command.toLowerCase()}`;
|
||||||
|
|
||||||
|
|
@ -27,138 +34,163 @@ ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
||||||
mentioned: "",
|
mentioned: "",
|
||||||
task: "",
|
task: "",
|
||||||
originalTask: "",
|
originalTask: "",
|
||||||
|
doneCount: "",
|
||||||
|
count: "",
|
||||||
|
pointName: configs.settings.pointsName,
|
||||||
|
pointCount: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (commands.addTaskCommands.includes(command)) {
|
if (commands.addTaskCommands.includes(command)) {
|
||||||
let addStatus = addTask(user, extra.userColor, message);
|
let addRequest = 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (addRequest.status !== 200) {
|
||||||
|
respond(addRequest.body.error, params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let finishStatus = markTaskDone(user, message);
|
let addedResponse = responses.taskAdded;
|
||||||
|
params.task = addRequest.body.task;
|
||||||
|
|
||||||
if (finishStatus === 0) {
|
if (addRequest.body.tasksFailedToAdd !== "") {
|
||||||
// user has no tasks
|
addedResponse += ` | Failed to add task(s): "${addRequest.body.tasksFailedToAdd}"`;
|
||||||
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;
|
respond(addedResponse, params);
|
||||||
|
} else if (commands.editTaskCommands.includes(command)) {
|
||||||
|
let editRequest = editTask(user, message);
|
||||||
|
|
||||||
if (finishStatus.failedTasks !== "") {
|
if (editRequest.status !== 200) {
|
||||||
finishedResponse += ` | Failed to finish task(s): "${finishStatus.failedTasks}"`;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
respond(finishedResponse, params);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
let finishedResponse = responses.taskFinished;
|
||||||
|
|
||||||
|
params.task = finishRequest.body.markedTasks;
|
||||||
|
params.doneCount = completedTasksCount(user);
|
||||||
|
params.pointCount =
|
||||||
|
finishRequest.body.markedTasksCount *
|
||||||
|
configs.settings.pointsPerTask;
|
||||||
|
|
||||||
|
if (finishRequest.body.failedTasks !== "") {
|
||||||
|
finishedResponse += ` | Failed to finish task(s): "${finishRequest.body.failedTasks}"`;
|
||||||
|
}
|
||||||
|
|
||||||
|
respond(finishedResponse, params);
|
||||||
} else if (commands.unfinishTaskCommands.includes(command)) {
|
} else if (commands.unfinishTaskCommands.includes(command)) {
|
||||||
let unfinishStatus = markTaskUndone(user, message);
|
let unfinishRequest = markTaskUndone(user, message);
|
||||||
|
|
||||||
if (unfinishStatus === 0) {
|
if (unfinishRequest.status !== 200) {
|
||||||
// user has no tasks
|
respond(unfinishRequest.body.error, params);
|
||||||
respond(responses.noTask, params);
|
return;
|
||||||
} else if (unfinishStatus === 1) {
|
|
||||||
// invalid input
|
|
||||||
respond(responses.specifyTaskIndex, params);
|
|
||||||
} else {
|
|
||||||
// task unfinished
|
|
||||||
let unfinishedResponse = responses.taskUnfinished;
|
|
||||||
|
|
||||||
params.task = unfinishStatus.markedTasks;
|
|
||||||
|
|
||||||
if (unfinishStatus.failedTasks !== "") {
|
|
||||||
unfinishedResponse += ` | Failed to unfinish task(s): "${unfinishStatus.failedTasks}"`;
|
|
||||||
}
|
|
||||||
|
|
||||||
respond(unfinishedResponse, params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// task unfinished
|
||||||
|
let unfinishedResponse = responses.taskUnfinished;
|
||||||
|
|
||||||
|
params.task = unfinishRequest.body.markedTasks;
|
||||||
|
|
||||||
|
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)) {
|
} else if (commands.checkCommands.includes(command)) {
|
||||||
if (message === "") {
|
if (message === "") {
|
||||||
let response = checkTasks(user);
|
let checkRequest = checkTasks(user);
|
||||||
if (response === 0) {
|
if (checkRequest.status !== 200) {
|
||||||
return respond(responses.noTask, params);
|
// no tasks
|
||||||
|
respond(checkRequest.body.error, params);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return ComfyJS.Say(response);
|
|
||||||
|
return ComfyJS.Say(checkRequest.body.reply);
|
||||||
} else {
|
} else {
|
||||||
let mentioned = message.replace("@", "");
|
let mentioned = message.replace("@", "");
|
||||||
let response = checkTasks(mentioned);
|
let checkRequest = checkTasks(mentioned);
|
||||||
if (response === 0) {
|
|
||||||
|
if (checkRequest.status !== 200) {
|
||||||
// no tasks
|
// 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)) {
|
} else if (commands.adminDeleteCommands.includes(command)) {
|
||||||
if (!isMod(flags)) {
|
if (!isMod(flags)) {
|
||||||
|
|
@ -172,31 +204,40 @@ ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearUserTasks(mentioned);
|
let clearUserTaskResponse = clearUserTasks(mentioned);
|
||||||
|
|
||||||
params.mentioned = mentioned;
|
params.mentioned = mentioned;
|
||||||
respond(responses.adminDeleteTasks, params);
|
|
||||||
return mentioned;
|
|
||||||
} else if (commands.adminClearDoneCommands.includes(command)) {
|
|
||||||
if (!isMod(flags)) {
|
|
||||||
respond(responses.notMod, params);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
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.clearMyDoneCommands.includes(command)) {
|
|
||||||
let response = clearOwnDoneTasks(user);
|
|
||||||
|
|
||||||
if (response === 0) {
|
if (clearUserTaskResponse.status === 0) {
|
||||||
|
// no tasks
|
||||||
|
respond(responses.noTaskA, params);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
respond(responses.adminDeleteTasks, params);
|
||||||
|
return;
|
||||||
|
} else if (commands.adminClearDoneCommands.includes(command)) {
|
||||||
|
if (!isStreamer(flags)) {
|
||||||
|
respond(responses.notStreamer, params);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearAllDoneTasks();
|
||||||
|
respond(responses.clearedDone, params);
|
||||||
|
return;
|
||||||
|
} else if (commands.adminClearAllCommands.includes(command)) {
|
||||||
|
if (!isStreamer(flags)) {
|
||||||
|
respond(responses.notStreamer, params);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearAll();
|
||||||
|
respond(responses.clearedAll, params);
|
||||||
|
return;
|
||||||
|
} else if (commands.clearMyDoneCommands.includes(command)) {
|
||||||
|
let clearOwnDoneResponse = clearOwnDoneTasks(user);
|
||||||
|
|
||||||
|
if (clearOwnDoneResponse.status === 0) {
|
||||||
// no tasks
|
// no tasks
|
||||||
respond(responses.noTask, params);
|
respond(responses.noTask, params);
|
||||||
return;
|
return;
|
||||||
|
|
@ -204,17 +245,109 @@ ComfyJS.onCommand = (user, command, message, flags, extra) => {
|
||||||
|
|
||||||
respond(responses.clearedMyDone, params);
|
respond(responses.clearedMyDone, params);
|
||||||
} else if (commands.adminClearNotStreamerCommands.includes(command)) {
|
} else if (commands.adminClearNotStreamerCommands.includes(command)) {
|
||||||
clearAllExceptStreamer(auth.channel);
|
if (!isStreamer(flags)) {
|
||||||
respond(responses.clearTasksExceptBroadcaster, params);
|
respond(responses.notStreamer, 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);
|
|
||||||
return;
|
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]) {
|
} else if (commands.additionalCommands[command]) {
|
||||||
respond(commands.additionalCommands[command], params);
|
respond(commands.additionalCommands[command], params);
|
||||||
} else {
|
} 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 {
|
#main-container .task-wrapper .task-container .task .user-tasks {
|
||||||
list-style-position: inside;
|
list-style-position: inside;
|
||||||
|
width: -moz-fit-content;
|
||||||
|
width: fit-content;
|
||||||
}
|
}
|
||||||
#main-container .task-wrapper .task-container .task .user-tasks .todo {
|
#main-container .task-wrapper .task-container .task .user-tasks .todo {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
@ -120,4 +122,12 @@ body {
|
||||||
}
|
}
|
||||||
#main-container .task-wrapper .task-container .task .user-tasks .done {
|
#main-container .task-wrapper .task-container .task .user-tasks .done {
|
||||||
text-decoration: line-through;
|
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 */
|
}/*# sourceMappingURL=taskList.css.map */
|
||||||
Loading…
Reference in a new issue