Add user profile modal data attributes
This commit is contained in:
parent
17575fc6a1
commit
0944c0708f
|
@ -298,6 +298,7 @@ export class ReactAutoPatcher {
|
||||||
await this.patchGuild();
|
await this.patchGuild();
|
||||||
await this.patchChannel();
|
await this.patchChannel();
|
||||||
await this.patchChannelList();
|
await this.patchChannelList();
|
||||||
|
await this.patchUserProfileModal();
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,6 +368,17 @@ export class ReactAutoPatcher {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async patchUserProfileModal() {
|
||||||
|
this.UserProfileModal = await ReactComponents.getComponent('UserProfileModal', { selector: '.root-2sNHUF' }, Filters.byPrototypeFields(['renderHeader', 'renderBadges']));
|
||||||
|
this.unpatchUserProfileModal = MonkeyPatch('BD:ReactComponents', this.UserProfileModal.component.prototype).after('render', (component, args, retVal) => {
|
||||||
|
const { user } = component.props;
|
||||||
|
if (!user) return;
|
||||||
|
retVal.props['data-user-id'] = user.id;
|
||||||
|
if (user.bot) retVal.props.className += ' bd-isBot';
|
||||||
|
if (user.id === DiscordApi.currentUser.id) retVal.props.className += ' bd-isCurrentUser';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static forceUpdate() {
|
static forceUpdate() {
|
||||||
for (const e of document.querySelectorAll('.message, .message-group, .guild, .containerDefault-7RImuF, .channel-members .member-2FrNV0')) {
|
for (const e of document.querySelectorAll('.message, .message-group, .guild, .containerDefault-7RImuF, .channel-members .member-2FrNV0')) {
|
||||||
Reflection(e).forceUpdate();
|
Reflection(e).forceUpdate();
|
||||||
|
|
Loading…
Reference in New Issue