stuff
This commit is contained in:
parent
23b535e67f
commit
fc7c85f0cd
|
@ -2,7 +2,7 @@
|
|||
* @name BDFDB
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 2.4.9
|
||||
* @version 2.5.0
|
||||
* @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.9",
|
||||
"version": "2.5.0",
|
||||
"description": "Required Library for DevilBro's Plugins"
|
||||
},
|
||||
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js"
|
||||
|
@ -3256,10 +3256,9 @@ module.exports = (_ => {
|
|||
if (!user) return window.location.origin + "/assets/1f0bfc0865d324c2587920a7d80c609b.png";
|
||||
else return ((user.avatar ? "" : window.location.origin) + Internal.LibraryModules.IconUtils.getUserAvatarURL(user)).split("?")[0];
|
||||
};
|
||||
BDFDB.UserUtils.getBanner = function (id = BDFDB.UserUtils.me.id, canAnimate = false) {
|
||||
let user = Internal.LibraryModules.UserStore.getUser(id);
|
||||
if (!user || !user.banner) return "";
|
||||
return Internal.LibraryModules.IconUtils.getUserBannerURL(Object.assign({}, user, {canAnimate})).split("?")[0];
|
||||
BDFDB.UserUtils.getBanner = function (id = BDFDB.UserUtils.me.id, guildId = Internal.LibraryModules.LastGuildStore.getGuildId(), canAnimate = false) {
|
||||
let displayProfile = Internal.LibraryModules.MemberDisplayUtils.getDisplayProfile(id, guildId);
|
||||
return (Internal.LibraryModules.IconUtils.getUserBannerURL(Object.assign({banner: displayProfile.banner, id: id}, {canAnimate})) || "").split("?")[0];
|
||||
};
|
||||
BDFDB.UserUtils.can = function (permission, id = BDFDB.UserUtils.me.id, channelId = Internal.LibraryModules.LastChannelStore.getChannelId()) {
|
||||
if (!BDFDB.DiscordConstants.Permissions[permission]) BDFDB.LogUtils.warn([permission, "not found in Permissions"]);
|
||||
|
@ -8179,8 +8178,6 @@ module.exports = (_ => {
|
|||
|
||||
Internal.patchedModules = {
|
||||
before: {
|
||||
UserBanner: "default",
|
||||
UserPopoutAvatar: "UserPopoutAvatar",
|
||||
SearchBar: "render",
|
||||
EmojiPicker: "type",
|
||||
EmojiPickerListRow: "default"
|
||||
|
@ -8252,13 +8249,6 @@ module.exports = (_ => {
|
|||
if (index > -1) children[index] = BDFDB.ReactUtils.createElement(AppViewExport.exports.default, children[index].props);
|
||||
};
|
||||
|
||||
Internal.processUserBanner = function (e) {
|
||||
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) {
|
||||
if (e.returnvalue && e.returnvalue.props && e.returnvalue.props.children && e.returnvalue.props.children.props) {
|
||||
let message;
|
||||
|
@ -8414,16 +8404,8 @@ module.exports = (_ => {
|
|||
};
|
||||
Internal.processUserPopoutAvatar = function (e) {
|
||||
if (!e.instance.props.user) return;
|
||||
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];
|
||||
}
|
||||
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);
|
||||
|
@ -8822,22 +8804,6 @@ module.exports = (_ => {
|
|||
Internal.setDefaultProps(Internal.LibraryComponents.GuildComponents.BlobMask, extraDefaultProps);
|
||||
}
|
||||
|
||||
BDFDB.PatchUtils.patch(BDFDB, Internal.LibraryModules.GuildStore, "getGuild", {after: e => {
|
||||
if (e.returnValue && e.methodArguments[0] == InternalData.myGuildId) e.returnValue.banner = `https://mwittrien.github.io/BetterDiscordAddons/Library/_res/BDFDB.banner.png`;
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(BDFDB, Internal.LibraryModules.UserStore, "getUser", {after: e => {
|
||||
if (e.returnValue && e.methodArguments[0] == InternalData.myId) e.returnValue.banner = `https://mwittrien.github.io/BetterDiscordAddons/Library/_res/DevilBro.banner.png`;
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(BDFDB, Internal.LibraryModules.IconUtils, "getGuildBannerURL", {instead: e => {
|
||||
return e.methodArguments[0].id == InternalData.myGuildId ? e.methodArguments[0].banner : e.callOriginalMethod();
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(BDFDB, Internal.LibraryModules.IconUtils, "getUserBannerURL", {instead: e => {
|
||||
return e.methodArguments[0].id == InternalData.myId ? e.methodArguments[0].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;
|
||||
}});
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"LibraryRequires": ["electron", "fs", "path", "process", "request"],
|
||||
"DiscordObjects": {
|
||||
"Channel": {"props": ["getRecipientId", "isManaged", "getGuildId"]},
|
||||
"DisplayProfile": {"props": ["isUsingGuildMemberBio", "getBannerURL"]},
|
||||
"Guild": {"props": ["getIconURL", "getMaxEmojiSlots", "getRole"]},
|
||||
"Invite": {"props": ["getExpiresAt", "isExpired"]},
|
||||
"Message": {"props": ["getReaction", "isEdited", "getChannelId"]},
|
||||
|
@ -81,6 +82,7 @@
|
|||
"MediaComponentUtils": {"props": ["renderImageComponent", "renderAudioComponent"]},
|
||||
"MediaDeviceSetUtils": {"props": ["setOutputDevice", "setInputDevice"]},
|
||||
"MediaDeviceUtils": {"props": ["getOutputDevices", "getInputDevices"]},
|
||||
"MemberDisplayUtils": {"props": ["getDisplayProfile"]},
|
||||
"MemberCountUtils": {"props": ["getMemberCount", "getMemberCounts"]},
|
||||
"MemberStore": {"props": ["getMember", "getMembers"]},
|
||||
"MentionUtils": {"props": ["isRawMessageMentioned", "isMentioned"]},
|
||||
|
|
|
@ -269,15 +269,23 @@ module.exports = (_ => {
|
|||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getUserBannerURL", {instead: e => {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.methodArguments[0].id);
|
||||
if (user) {
|
||||
if (user.id == "278543574059057154") return user.banner;
|
||||
let data = changedUsers[user.id];
|
||||
if (data && data.banner && !data.removeBanner) return data.banner;
|
||||
let data = changedUsers[e.methodArguments[0].id];
|
||||
if (data) {
|
||||
if (data.removeBanner) return null;
|
||||
else if (data.banner) return data.banner;
|
||||
}
|
||||
return e.callOriginalMethod();
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MemberDisplayUtils, "getDisplayProfile", {after: e => {
|
||||
let data = changedUsers[e.methodArguments[0]];
|
||||
if (data && (data.banner || data.removeBanner)) {
|
||||
e.returnValue = new BDFDB.DiscordObjects.DisplayProfile(e.returnValue, e.returnValue);
|
||||
if (data.removeBanner) e.returnValue.banner = null;
|
||||
else if (data.banner) e.returnValue.banner = data.banner;
|
||||
}
|
||||
}});
|
||||
|
||||
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]]);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name ImageUtilities
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 4.8.0
|
||||
* @version 4.8.1
|
||||
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "ImageUtilities",
|
||||
"author": "DevilBro",
|
||||
"version": "4.8.0",
|
||||
"version": "4.8.1",
|
||||
"description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)"
|
||||
}
|
||||
};
|
||||
|
@ -1381,10 +1381,8 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processUserBanner (e) {
|
||||
let banner = e.instance.props.user && this.settings.places.userAvatars && BDFDB.UserUtils.getBanner(e.instance.props.user.id);
|
||||
if (banner) e.returnvalue.props.onContextMenu = event => {
|
||||
const member = BDFDB.LibraryModules.MemberStore.getMember(e.instance.props.guildId, e.instance.props.user.id);
|
||||
let validUrls = this.filterUrls(banner, BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.banner) && BDFDB.UserUtils.getBanner(e.instance.props.user.id, true), member && member.banner && BDFDB.LibraryModules.BannerUtils.getUserBannerURLForContext({user: e.instance.props.user, guildMember: member, canAnimate: false}), member && member.banner && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(member.banner) && BDFDB.LibraryModules.BannerUtils.getUserBannerURLForContext({user: e.instance.props.user, guildMember: member, canAnimate: true}));
|
||||
if (this.settings.places.userAvatars && e.instance.props.displayProfile.banner) e.returnvalue.props.onContextMenu = event => {
|
||||
let validUrls = this.filterUrls(BDFDB.UserUtils.getBanner(e.instance.props.user.id, null, false), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.displayProfile._userProfile.banner) && BDFDB.UserUtils.getBanner(e.instance.props.user.id, null, true), e.instance.props.displayProfile._guildMemberProfile.banner && BDFDB.UserUtils.getBanner(e.instance.props.user.id, e.instance.props.guildId, false), e.instance.props.displayProfile._guildMemberProfile.banner && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.displayProfile._guildMemberProfile.banner) && BDFDB.UserUtils.getBanner(e.instance.props.user.id, e.instance.props.guildId, true));
|
||||
if (validUrls.length) BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: validUrls.length == 1 ? this.createSubMenus({
|
||||
instance: {},
|
||||
|
|
Loading…
Reference in New Issue