ThemeAttributes: add data-author-username to messages (#2422)
This commit is contained in:
parent
2eb8ba1841
commit
9b328da4ce
2 changed files with 5 additions and 2 deletions
|
@ -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…
Reference in a new issue