Skip to content

Commit

Permalink
docs: show forward info in message tool
Browse files Browse the repository at this point in the history
  • Loading branch information
irgendwr committed Jun 18, 2024
1 parent 7389389 commit a442806
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions docs/message-tool.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ <h3 id="messages">Received Messages</h3>
return;
}

console.log("Data:");
console.log(data);
console.log("Data:", data);

status.textContent = 'Success';
data.result.forEach(entry => {
Expand All @@ -79,8 +78,7 @@ <h3 id="messages">Received Messages</h3>
});
})
.catch(err => {
console.log("Error:");
console.log(err);
console.error(err);

status.textContent = `Error: ${err}`;
});
Expand Down Expand Up @@ -119,6 +117,30 @@ <h3 id="messages">Received Messages</h3>
msg.append(userText);
}

let forward_from = message.forward_from;
if (forward_from) {
msg.innerHTML += "<h4>Forwarded from User</h4>";
let userText = document.createElement("p");
userText.append(`ID: ${message.forward_from.id}`);
userText.innerHTML += "<br>";
userText.append(`Name: ${forward_from.first_name||''} ${forward_from.last_name||''} ${forward_from.username ? `(@${forward_from.username})` : ''}`);
msg.append(userText);
}

let forward_from_chat = message.forward_from_chat;
if (forward_from_chat) {
msg.innerHTML += "<h4>Forwarded from Chat</h4>";
let chatText = document.createElement("p");
chatText.append(`ID: ${forward_from_chat.id}`);
if (forward_from_chat.title) {
chatText.innerHTML += "<br>";
chatText.append(`Title: ${forward_from_chat.title}`);
}
chatText.innerHTML += "<br>";
chatText.append(`Type: ${forward_from_chat.type}`);
msg.append(chatText);
}

return msg;
}
</script>

0 comments on commit a442806

Please sign in to comment.