fixed existing task error reply

This commit is contained in:
liyunze 2024-11-22 21:42:35 +11:00
parent 17637fe750
commit b7909a3710
5 changed files with 28 additions and 11 deletions

View file

@ -9,13 +9,13 @@
<script src="./auth.js"></script>
<script src="./configs.js"></script>
<script src="scripts/defaultConfigs.js"></script>
<script defer src="scripts/functions.js"></script>
<script defer src="scripts/processCommand.js"></script>
<script defer src="scripts/index.js"></script>
<script defer src="scripts/taskList.js"></script>
<script defer src="./scripts/defaultConfigs.js"></script>
<script defer src="./scripts/functions.js"></script>
<script defer src="./scripts/processCommand.js"></script>
<script defer src="./scripts/index.js"></script>
<script defer src="./scripts/taskList.js"></script>
<link rel="stylesheet" type="text/css" href="styles/taskList.css" />
<link rel="stylesheet" type="text/css" href="./styles/taskList.css" />
<title>Task List</title>
</head>

View file

@ -2,9 +2,12 @@ let params = {};
function respond(template, params) {
Object.keys(params).forEach((key) => {
template = template.replace(`{${key}}`, params[key]);
console.log(`{${key}}: ${params[key]}`);
template = template.replaceAll(`{${key}}`, params[key]);
});
console.log(template);
ComfyJS.Say(template);
}

View file

@ -14,6 +14,7 @@ async function processCommand(user, command, message, flags, extra) {
let addRequest = await addTask(user, extra.userColor, message);
if (addRequest.status !== 200) {
params.task = `${openQuote}${message}${closeQuote}`;
respond(addRequest.body.error, params);
return;
}
@ -25,7 +26,7 @@ async function processCommand(user, command, message, flags, extra) {
addedResponse += ` | Failed to add task(s): "${addRequest.body.tasksFailedToAdd}"`;
}
respond(addedResponse, params);
await respond(addedResponse, params);
} else if (getCommand("editTaskCommands").includes(command)) {
let editRequest = await editTask(user, message);

View file

@ -810,9 +810,9 @@ async function addTask(username, userColor, task) {
let addedTaskIndices = addTaskFunction.body.addedTaskIndices;
let tasksFailedToAdd = addTaskFunction.body.tasksFailedToAdd;
if (!scrolling) {
await renderTaskListToDOM();
}
// if (!scrolling) {
await renderTaskListToDOM();
// }
let displayedTasksAdded = addedTaskIndices.map((t) => {
return `(${t.index + 1}) ${t.task}`;

View file

@ -65,6 +65,19 @@
box-sizing: border-box;
}
@keyframes scroll {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-100%);
}
}
.primary, .secondary {
animation: scroll linear infinite;
}
#main-container {
width: 100%;