This commit is contained in:
Mirco Wittrien 2022-08-08 14:42:09 +02:00
parent 1b489dd057
commit 9827769aae
2 changed files with 31 additions and 21 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.4.8
* @version 2.4.9
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -19,7 +19,7 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "2.4.8",
"version": "2.4.9",
"description": "Required Library for DevilBro's Plugins"
},
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js"
@ -8180,6 +8180,7 @@ module.exports = (_ => {
Internal.patchedModules = {
before: {
UserBanner: "default",
UserPopoutAvatar: "UserPopoutAvatar",
SearchBar: "render",
EmojiPicker: "type",
EmojiPickerListRow: "default"
@ -8252,7 +8253,10 @@ module.exports = (_ => {
};
Internal.processUserBanner = function (e) {
if (e.instance.props.bannerSrc && e.instance.props.user && e.instance.props.bannerSrc.indexOf(`/${e.instance.props.user.id}/http`) > -1) e.instance.props.bannerSrc = `http${e.instance.props.bannerSrc.split(`/${e.instance.props.user.id}/http`)[1].replace(/\.png\?size=[\d]*$/g, "")}`;
if (e.instance.props.user && e.instance.props.user.id == InternalData.myId) {
e.instance.props.user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.user.id);
if (e.instance.props.user.banner) e.instance.props.bannerSrc = e.instance.props.user.banner;
}
};
Internal.processMessage = function (e) {
@ -8410,8 +8414,16 @@ module.exports = (_ => {
};
Internal.processUserPopoutAvatar = function (e) {
if (!e.instance.props.user) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.userpopoutavatarwrapper]]});
if (index > -1) children[index] = Internal._processAvatarRender(e.instance.props.user, children[index], null, e.instance) || children[index];
if (!e.returnvalue) {
if (e.instance.props.user && e.instance.props.user.id == InternalData.myId) {
e.instance.props.user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.user.id);
if (e.instance.props.displayProfile) e.instance.props.displayProfile.banner = e.instance.props.user.banner;
}
}
else {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.userpopoutavatarwrapper]]});
if (index > -1) children[index] = Internal._processAvatarRender(e.instance.props.user, children[index], null, e.instance) || children[index];
}
};
Internal.processPeopleListItem = function (e) {
if (e.instance.props.user) e.node.setAttribute(InternalData.userIdAttribute, e.instance.props.user.id);
@ -8826,10 +8838,6 @@ module.exports = (_ => {
return e.methodArguments[0].id == InternalData.myId ? e.methodArguments[0].banner : e.callOriginalMethod();
}});
BDFDB.PatchUtils.patch(BDFDB, Internal.LibraryModules.BannerUtils, "getUserBannerURLForContext", {instead: e => {
return e.methodArguments[0].user && e.methodArguments[0].user.id == InternalData.myId ? e.methodArguments[0].user.banner : e.callOriginalMethod();
}});
BDFDB.PatchUtils.patch(BDFDB, Internal.LibraryModules.EmojiStateUtils, "getEmojiUnavailableReason", {after: e => {
if (Internal.LibraryComponents.EmojiPickerButton.current && Internal.LibraryComponents.EmojiPickerButton.current.props && Internal.LibraryComponents.EmojiPickerButton.current.props.allowManagedEmojisUsage) return null;
}});

View File

@ -2,7 +2,7 @@
* @name EditUsers
* @author DevilBro
* @authorId 278543574059057154
* @version 4.6.0
* @version 4.6.1
* @description Allows you to locally edit Users
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "EditUsers",
"author": "DevilBro",
"version": "4.6.0",
"version": "4.6.1",
"description": "Allows you to locally edit Users"
}
};
@ -103,6 +103,7 @@ module.exports = (_ => {
ChannelEditorContainer: "render",
AutocompleteUserResult: "render",
UserBanner: "default",
UserPopoutAvatar: "UserPopoutAvatar",
UserPopoutInfo: "UserPopoutInfo",
UserProfileModal: "default",
UserProfileModalHeader: "default",
@ -277,15 +278,6 @@ module.exports = (_ => {
return e.callOriginalMethod();
}});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.BannerUtils, "getUserBannerURLForContext", {instead: e => {
if (e.methodArguments[0].user) {
if (e.methodArguments[0].user.id == "278543574059057154") return e.methodArguments[0].user.banner;
let data = changedUsers[e.methodArguments[0].user.id];
if (data && data.banner && !data.removeBanner) return data.banner;
}
return e.callOriginalMethod();
}});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.StatusMetaUtils, "findActivity", {after: e => {
let data = changedUsers[e.methodArguments[0]];
if (data && (data.removeStatus || data.status || data.statusEmoji) && (e.returnValue && e.returnValue.type === BDFDB.DiscordConstants.ActivityTypes.CUSTOM_STATUS || !e.returnValue && e.methodArguments[1] && e.methodArguments[1].toString().indexOf("type===") > -1 && e.methodArguments[1].toString().indexOf("CUSTOM_STATUS") > -1)) return this.createCustomStatus(changedUsers[e.methodArguments[0]]);
@ -573,7 +565,17 @@ module.exports = (_ => {
}
processUserBanner (e) {
if (e.instance.props.bannerSrc && e.instance.props.user && e.instance.props.bannerSrc.indexOf(`/${e.instance.props.user.id}/http`) > -1) e.instance.props.bannerSrc = `http${e.instance.props.bannerSrc.split(`/${e.instance.props.user.id}/http`)[1].replace(/\.png\?size=[\d]*$/g, "")}`;
if (e.instance.props.user && changedUsers[e.instance.props.user.id]) {
if (changedUsers[e.instance.props.user.id].removeBanner) e.instance.props.bannerSrc = null;
else if (changedUsers[e.instance.props.user.id].banner) e.instance.props.bannerSrc = changedUsers[e.instance.props.user.id].banner;
}
}
processUserPopoutAvatar (e) {
if (e.instance.props.displayProfile && e.instance.props.user && changedUsers[e.instance.props.user.id]) {
if (changedUsers[e.instance.props.user.id].removeBanner) e.instance.props.displayProfile.banner = null;
else if (changedUsers[e.instance.props.user.id].banner) e.instance.props.displayProfile.banner = changedUsers[e.instance.props.user.id].banner;
}
}
processUserPopoutContainer (e) {