ThemeAttributes: add data-author-username to messages (#2422)

main
Overcast Warmth System 6 months ago committed by GitHub
parent 2eb8ba1841
commit 9b328da4ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,6 +15,7 @@ This allows themes to more easily theme those elements or even do things that ot
### Chat Messages ### Chat Messages
- `data-author-id` contains the id of the author - `data-author-id` contains the id of the author
- `data-author-username` contains the username of the author
- `data-is-self` is a boolean indicating whether this is the current user's message - `data-is-self` is a boolean indicating whether this is the current user's message
![image](https://github.com/Vendicated/Vencord/assets/45497981/34bd5053-3381-402f-82b2-9c812cc7e122) ![image](https://github.com/Vendicated/Vencord/assets/45497981/34bd5053-3381-402f-82b2-9c812cc7e122)

@ -36,10 +36,12 @@ export default definePlugin({
], ],
getMessageProps(props: { message: Message; }) { getMessageProps(props: { message: Message; }) {
const authorId = props.message?.author?.id; const author = props.message?.author;
const authorId = author?.id;
return { return {
"data-author-id": authorId, "data-author-id": authorId,
"data-is-self": authorId && authorId === UserStore.getCurrentUser()?.id "data-author-username": author?.username,
"data-is-self": authorId && authorId === UserStore.getCurrentUser()?.id,
}; };
} }
}); });

Loading…
Cancel
Save