Fix message history by adding new clear function for internal command

This commit is contained in:
Raven Scott 2024-06-14 01:17:18 -04:00
parent 458954c1e1
commit 59e72998c6
2 changed files with 13 additions and 2 deletions

13
app.js
View File

@ -739,7 +739,7 @@ async function updateIcon(username, avatarBuffer) {
}
}
function clearMessages() {
function clearMessagesCMD() {
const messagesContainer = document.querySelector('#messages');
while (messagesContainer.firstChild) {
messagesContainer.removeChild(messagesContainer.firstChild);
@ -750,6 +750,17 @@ function clearMessages() {
messagesStore[topic] = [];
}
function clearMessages() {
const messagesContainer = document.querySelector('#messages');
while (messagesContainer.firstChild) {
messagesContainer.removeChild(messagesContainer.firstChild);
}
// Clear the messages from the store for the current room
// const topic = currentTopic();
// messagesStore[topic] = [];
}
function toggleSetupView() {
const setupDiv = document.querySelector('#setup');
setupDiv.classList.toggle('hidden');

View File

@ -20,7 +20,7 @@ export default async function handleCommand(command, context) {
switch (cmd) {
case '~clear':
clearMessages();
clearMessagesCMD();
break;
case '~ping':
addMessage('LinkUp', 'pong', agentAvatar, currentTopic());