This commit is contained in:
Mirco Wittrien 2022-10-15 13:16:02 +02:00
parent bcb256a9e8
commit d673c45864
4 changed files with 43 additions and 25 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.7.7
* @version 2.7.8
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -8013,6 +8013,8 @@ module.exports = (_ => {
before: [
"BlobMask",
"EmojiPickerListRow",
"Menu",
"MessageActionsContextMenu",
"MessageHeader",
"SearchBar"
],
@ -8226,6 +8228,9 @@ module.exports = (_ => {
Internal.processMemberListItem = function (e) {
Internal._processAvatarMount(e.instance.props.user, e.node.querySelector(BDFDB.dotCN.avatarwrapper), e.node);
};
Internal.processMessageActionsContextMenu = function (e) {
e.instance.props.updatePosition = _ => {};
};
Internal.processMessageHeader = function (e) {
if (e.instance.props.message && e.instance.props.message.author) {
if (e.instance.props.avatar && e.instance.props.avatar.props && typeof e.instance.props.avatar.props.children == "function") {
@ -8281,8 +8286,11 @@ module.exports = (_ => {
let module = e.methodArguments[0] && (e.methodArguments[0].type || e.methodArguments[0].render || e.methodArguments[0]);
if (!module || typeof module != "function") return;
if (PluginStores.modulePatches.before) for (const type in PluginStores.modulePatches.before) if (Internal.isCorrectModule(module, type, true)) {
let children = [...e.methodArguments].slice(2);
if (children.length && (!e.methodArguments[1].children || !e.methodArguments[1].children.length)) e.methodArguments[1].children = children;
let hasArgumentChildren = false, children = [...e.methodArguments].slice(2);
if (children.length && e.methodArguments[1].children === undefined) {
hasArgumentChildren = true;
e.methodArguments[1].children = children;
}
for (let plugin of PluginStores.modulePatches.before[type].flat(10)) Internal.initiatePatch(plugin, type, {
arguments: e.methodArguments,
instance: {props: e.methodArguments[1]},
@ -8292,6 +8300,11 @@ module.exports = (_ => {
methodname: "default",
patchtypes: ["before"]
});
if (hasArgumentChildren) {
[].splice.call(e.methodArguments, 2);
for (let child of e.methodArguments[1].children) [].push.call(e.methodArguments, child);
delete e.methodArguments[1].children;
}
break;
}
if (PluginStores.modulePatches.after && module.prototype && typeof module.prototype.render == "function") {

View File

@ -333,7 +333,6 @@
"GuildEntryContextMenu": "guild-entry-context",
"GuildHeaderContextMenu": "guild-header-popout",
"ImageContextMenu": "image-context",
"MessageActionsContextMenu": "message-actions",
"MessageContextMenu": "message",
"ThreadContextMenu": "thread-context",
"UserContextMenu": "user-context",
@ -368,10 +367,12 @@
"Menu": {"strings": ["\"empty\"", "getItemProps", "isUsingKeyboardNavigation"]},
"Message": {"strings": ["childrenMessageContent", "childrenRepliedMessage", "zalgo", ".buttonContainer"]},
"MessageAccessories": {"protos": ["renderGiftCodes", "renderEmbeds", "renderActivityInvite"]},
"MessageActionsContextMenu": {"strings": ["REPORT_MESSAGE_MENU_OPTION", "message-actions"]},
"MessageContextMenu": {"strings": ["MESSAGE_ACTIONS_MENU_LABEL", "navId:\"message", "getGuildId"]},
"MessageHeader": {"strings": ["showTimestampOnHover", "usernameClassName", "isVisibleOnlyOnHover:"]},
"Messages": {"strings": ["messageGroupSpacing", "groupSpacing", "jumpToPresent"]},
"MessageSearchResultContextMenu": {"strings": ["MESSAGE_ACTIONS_MENU_LABEL", "navId:\"message"], "nonStrings": ["getGuildId"]},
"MessageToolbar": {"strings": ["Messages.MORE", "hasDeveloperMode", "openPopoutType"]},
"ModalCarousel": {"strings": [".gotoNext", "currentIndex", "gotoPrevThrottled"]},
"NowPlayingHeader": {"strings": ["ACTIVITY_FEED_NOW_PLAYING_HEADER", "partiedMembers"]},
"NowPlayingItem": {"strings": [".wrapper", "padded:"]},

View File

@ -2,7 +2,7 @@
* @name BetterNsfwTag
* @author DevilBro
* @authorId 278543574059057154
* @version 1.3.1
* @version 1.3.2
* @description Adds a more noticeable Tag to NSFW Channels
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -59,7 +59,7 @@ module.exports = (_ => {
return class BetterNsfwTag extends Plugin {
onLoad () {
this.modulePatches = {
after: [
before: [
"ChannelItem"
]
};

View File

@ -2,7 +2,7 @@
* @name CopyRawMessage
* @author DevilBro
* @authorId 278543574059057154
* @version 1.1.3
* @version 1.1.4
* @description Allows you to copy the raw Contents of a Message
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -57,7 +57,14 @@ module.exports = (_ => {
}
} : (([Plugin, BDFDB]) => {
return class CopyRawMessage extends Plugin {
onLoad () {}
onLoad () {
this.modulePatches = {
after: [
"MessageActionsContextMenu",
"MessageToolbar"
]
};
}
onStart () {}
@ -107,27 +114,24 @@ module.exports = (_ => {
})
].filter(n => n);
if (entries.length) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
children.splice(index > -1 ? index : children.length, 0, );
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: entries.length > 1 ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-raw-submenu"),
children: entries.map(n => {
n.props.label = n.props.type;
delete n.props.type;
delete n.props.icon;
return n;
})
}) : entries
}));
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-link"});
children.splice(index > -1 ? index + 1 : children.length, 0, entries.length > 1 ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-raw-submenu"),
children: entries.map(n => {
n.props.label = n.props.type;
delete n.props.type;
delete n.props.icon;
return n;
})
}) : entries);
}
}
}
onMessageOptionContextMenu (e) {
processMessageActionsContextMenu (e) {
if (e.instance.props.message && e.instance.props.message.content) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mark-unread"});
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-link"});
children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)",
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message-raw"),
@ -139,7 +143,7 @@ module.exports = (_ => {
}
}
onMessageOptionToolbar (e) {
processMessageToolbar (e) {
if (e.instance.props.expanded && e.instance.props.message && e.instance.props.channel) {
e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: "copy-message-raw",