Skip to content

Commit

Permalink
Platform Indicators Fix (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrodevkaan authored Apr 6, 2024
1 parent c6521dc commit 96d1787
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions PlatformIndicators/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class PlatformIndicators {
obj.decorators = [
obj.decorators,
<StatusIndicators
userId={props.user.id}
userId={props.user?.id}
type="MemberList"
/>
];
Expand Down Expand Up @@ -66,28 +66,32 @@ export default class PlatformIndicators {
const MemberItem = Webpack.getByKeys("AVATAR_DECORATION_PADDING");

Patcher.after(MemberItem, "default", (_, [props], ret) => {
const obj = findInReactTree(ret, e => e?.avatar && e?.name);

const children = ret.props.children();
const obj = findInReactTree(children, e => e?.avatar && e?.name);
if (obj) {
obj.decorators = [
obj.decorators,
children.props.decorators?.props?.children.push(
<StatusIndicators
userId={props.user.id}
type="MemberList"
/>
];
)
}
// discord made it a method to return the children :(
ret.props.children = () => {
return children;
};
});
}

patchUsername() {
const ChatUsername = Webpack.getByKeys("UsernameDecorationTypes");

Patcher.before(ChatUsername, "default", (_, [props]) => {
if (!Array.isArray(props.decorations[1])) props.decorations[1] = [];
props.decorations[1].unshift(
Patcher.before(ChatUsername, "default", (_, props) => {
const mainProps = props[0];
if (!Array.isArray(mainProps.decorations[1])) mainProps.decorations[1] = [];
mainProps.decorations[1].unshift(
<StatusIndicators
userId={props.message.author.id}
userId={mainProps.message.author.id}
type="Chat"
/>
);
Expand Down
2 changes: 1 addition & 1 deletion PlatformIndicators/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "APlatformIndicators",
"version": "1.5.4",
"version": "1.5.5",
"authors": [
{
"name": "Strencher",
Expand Down

0 comments on commit 96d1787

Please sign in to comment.