Discord Timestamp with Seconds

This script provides users with the capability to view seconds in the timestamps of Discord messages, allows users to view the time that has elapsed since a message was sent, and enhances the date formatting.

< 腳本Discord Timestamp with Seconds的回應

評論:普通 - 腳本能使用,但有一些問題

§
發表於:2025-10-07

Hello,

The script stopped working for me and when I consulted ChatGPT it said the following (I tried the fix and it worked):
As of the last few days (around early October 2025), Discord has changed the HTML structure of time elements in chat.

Discord no longer uses aria-label to display the time — they replaced it with a data-tooltip or a completely new internal React component.

As a result:

timeElement.getAttribute('aria-label') returns null;

then the code tries to call originalLabel.includes(...), which shows an error in the console and breaks the entire updateTimestamps() function.

👉 The DOM structure has changed, and the script no longer finds the data it needs.

✅ Quick fix

You can edit your script and replace all places where aria-label is used with the following safe option:

🔧 Change this (old):
const originalLabel = timeElement.getAttribute('aria-label');

🆕 With this (new):
const originalLabel = timeElement.getAttribute('aria-label')
|| timeElement.getAttribute('data-tooltip')
|| timeElement.textContent;

發表回覆

登入以回覆