One of our forum members is building a chat-based statistics bot, and we’ve gotten almost everything working so far, except for reading the content of the message in which it was mentioned. Is there any way for us to pull the specific message it was mentioned in?
Haven’t tested, but since each chat entry has a specific data-id
, one could maybe use the textContent
property of the specific chat entry data-id
in javascript
Assuming the chat-message-id
is the indentifier:
const chat_text = document.querySelector('[data-id="$chat-message-id"]');
if (chat_text) {
const content = chat_text.textContent;
console.log(`content of specific chat data-id text: ${content}`);
} else {
console.log('no content found');
}
1 Like
That seems like it’d work from browser console, but that wouldn’t work from the API side of things, right?
Yea I’m not sure how you would get the content via API. but I’d probably be looking at some of the functions of the flagging system because if it would seem to do this already. There might be some re-usable functions in a related js file somewhere.
1 Like