This commit is contained in:
Mirco Wittrien 2020-08-15 14:24:48 +02:00
parent 083e6d0af8
commit 539192a280
6 changed files with 61 additions and 48 deletions

View File

@ -1234,6 +1234,7 @@
"EmojiPicker", "EmojiPicker",
"ExpressionPicker", "ExpressionPicker",
"GuildFolder", "GuildFolder",
"Messages",
"MessageContent", "MessageContent",
"NowPlayingHeader" "NowPlayingHeader"
]; ];
@ -1304,7 +1305,6 @@
InvitationCard: "invitemodalinviterow", InvitationCard: "invitemodalinviterow",
InviteCard: "guildsettingsinvitecard", InviteCard: "guildsettingsinvitecard",
MemberCard: "guildsettingsmembercard", MemberCard: "guildsettingsmembercard",
Messages: "messages",
MessagesPopout: "messagespopout", MessagesPopout: "messagespopout",
ModalLayer: "layermodal", ModalLayer: "layermodal",
MutualGuilds: "userprofilebody", MutualGuilds: "userprofilebody",
@ -1333,6 +1333,7 @@
}; };
WebModulesData.CodeFinder = { WebModulesData.CodeFinder = {
EmojiPicker: ["allowManagedEmojis", "EMOJI_PICKER_TAB_PANEL_ID", "diversitySelector"], EmojiPicker: ["allowManagedEmojis", "EMOJI_PICKER_TAB_PANEL_ID", "diversitySelector"],
Messages: ["group-spacing-", "canManageMessages"],
SearchResultsInner: ["SEARCH_HIDE_BLOCKED_MESSAGES", "totalResults", "SEARCH_PAGE_SIZE"] SearchResultsInner: ["SEARCH_HIDE_BLOCKED_MESSAGES", "totalResults", "SEARCH_PAGE_SIZE"]
}; };
WebModulesData.PropsFinder = { WebModulesData.PropsFinder = {
@ -1622,7 +1623,7 @@
let patchMethods = {}; let patchMethods = {};
patchMethods[patchType] = e => { patchMethods[patchType] = e => {
return InternalBDFDB.initiateProcess(pluginData.plugin, type, { return InternalBDFDB.initiateProcess(pluginData.plugin, type, {
instance: window != e.thisObject ? e.thisObject : {props:e.methodArguments[0]}, instance: e.thisObject && window != e.thisObject ? e.thisObject : {props:e.methodArguments[0]},
returnvalue: e.returnValue, returnvalue: e.returnValue,
methodname: e.originalMethodName, methodname: e.originalMethodName,
patchtypes: [patchType] patchtypes: [patchType]
@ -2363,19 +2364,18 @@
let MessageRerenderTimeout; let MessageRerenderTimeout;
BDFDB.MessageUtils = {}; BDFDB.MessageUtils = {};
BDFDB.MessageUtils.rerenderAll = function () { BDFDB.MessageUtils.rerenderAll = function (instant) {
BDFDB.TimeUtils.clear(MessageRerenderTimeout); BDFDB.TimeUtils.clear(MessageRerenderTimeout);
MessageRerenderTimeout = BDFDB.TimeUtils.timeout(_ => { MessageRerenderTimeout = BDFDB.TimeUtils.timeout(_ => {
let MessagesIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Messages", unlimited:true}); let LayerProviderIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.messageswrapper), {name:"LayerProvider", unlimited:true, up:true});
let MessagesPrototype = BDFDB.ReactUtils.getValue(MessagesIns, "_reactInternalFiber.type.prototype"); let LayerProviderPrototype = BDFDB.ReactUtils.getValue(LayerProviderIns, "_reactInternalFiber.type.prototype");
if (MessagesIns && MessagesPrototype) { if (LayerProviderIns && LayerProviderPrototype) {
BDFDB.ModuleUtils.patch(BDFDB, MessagesPrototype, "render", {after: e => { BDFDB.ModuleUtils.patch(BDFDB, LayerProviderPrototype, "render", {after: e => {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnValue, {props: ["message", "channel"]}); e.returnValue.props.children = [];
if (index > -1) for (let ele of children) if (ele.props.message) ele.props.message = new BDFDB.DiscordObjects.Message(ele.props.message);
}}, {once: true}); }}, {once: true});
BDFDB.ReactUtils.forceUpdate(MessagesIns); BDFDB.ReactUtils.forceUpdate(LayerProviderIns);
} }
}, 1000); }, instant ? 0 : 1000);
}; };
BDFDB.UserUtils = {}; BDFDB.UserUtils = {};
@ -2543,7 +2543,7 @@
} }
if (unreadChannels.length) BDFDB.ChannelUtils.markAsRead(unreadChannels); if (unreadChannels.length) BDFDB.ChannelUtils.markAsRead(unreadChannels);
}; };
BDFDB.GuildUtils.rerenderAll = function () { BDFDB.GuildUtils.rerenderAll = function (instant) {
BDFDB.TimeUtils.clear(GuildsRerenderTimeout); BDFDB.TimeUtils.clear(GuildsRerenderTimeout);
GuildsRerenderTimeout = BDFDB.TimeUtils.timeout(_ => { GuildsRerenderTimeout = BDFDB.TimeUtils.timeout(_ => {
let GuildsIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Guilds", unlimited:true}); let GuildsIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Guilds", unlimited:true});
@ -2556,7 +2556,7 @@
}}, {once: true}); }}, {once: true});
BDFDB.ReactUtils.forceUpdate(GuildsIns); BDFDB.ReactUtils.forceUpdate(GuildsIns);
} }
}, 1000); }, instant ? 0 : 1000);
}; };
BDFDB.FolderUtils = {}; BDFDB.FolderUtils = {};

File diff suppressed because one or more lines are too long

View File

@ -7,16 +7,20 @@ var ChatFilter = (_ => {
return class ChatFilter { return class ChatFilter {
getName () {return "ChatFilter";} getName () {return "ChatFilter";}
getVersion () {return "3.4.2";} getVersion () {return "3.4.3";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
getDescription () {return "Allows the user to censor words or block complete messages based on words in the chatwindow.";} getDescription () {return "Allows the user to censor words or block complete messages based on words in the chatwindow.";}
constructor () { constructor () {
this.changelog = {
"fixed":[["Message Update","Fixed for yet another message update provided by our best friend discord"]]
};
this.patchedModules = { this.patchedModules = {
after: { after: {
Messages: "render", Messages: "type",
Message: "default", Message: "default",
MessageContent: "type" MessageContent: "type"
} }
@ -256,11 +260,11 @@ var ChatFilter = (_ => {
} }
processMessages (e) { processMessages (e) {
e.instance.props.channelStream = [].concat(e.instance.props.channelStream); e.returnvalue.props.children.props.channelStream = [].concat(e.returnvalue.props.children.props.channelStream);
for (let i in e.instance.props.channelStream) { for (let i in e.returnvalue.props.children.props.channelStream) {
let message = e.instance.props.channelStream[i].content; let message = e.returnvalue.props.children.props.channelStream[i].content;
if (message) { if (message) {
if (BDFDB.ArrayUtils.is(message.attachments)) this.checkMessage(e.instance.props.channelStream[i], message); if (BDFDB.ArrayUtils.is(message.attachments)) this.checkMessage(e.returnvalue.props.children.props.channelStream[i], message);
else if (BDFDB.ArrayUtils.is(message)) for (let j in message) { else if (BDFDB.ArrayUtils.is(message)) for (let j in message) {
let childMessage = message[j].content; let childMessage = message[j].content;
if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(message[j], childMessage); if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(message[j], childMessage);
@ -479,6 +483,7 @@ var ChatFilter = (_ => {
oldCensoredMessages = {}; oldCensoredMessages = {};
BDFDB.ModuleUtils.forceAllUpdates(this); BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
} }
} }
})(); })();

View File

@ -7,18 +7,20 @@ var DisplayLargeMessages = (_ => {
return class DisplayLargeMessages { return class DisplayLargeMessages {
getName () {return "DisplayLargeMessages";} getName () {return "DisplayLargeMessages";}
getVersion () {return "1.0.5";} getVersion () {return "1.0.6";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
getDescription () {return "Injects the contents of large messages that were sent by discord via 'message.txt'.";} getDescription () {return "Injects the contents of large messages that were sent by discord via 'message.txt'.";}
constructor () { constructor () {
this.changelog = {
"fixed":[["Message Update","Fixed for yet another message update provided by our best friend discord"]]
};
this.patchedModules = { this.patchedModules = {
before: {
Messages: "render",
},
after: { after: {
Messages: "type",
Attachment: "default" Attachment: "default"
} }
}; };
@ -38,7 +40,8 @@ var DisplayLargeMessages = (_ => {
} }
${BDFDB.dotCN._displaylargemessagesinjectbutton}:hover { ${BDFDB.dotCN._displaylargemessagesinjectbutton}:hover {
color: var(--interactive-hover); color: var(--interactive-hover);
}`; }
`;
this.defaults = { this.defaults = {
settings: { settings: {
@ -167,7 +170,7 @@ var DisplayLargeMessages = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "uninject-attachment"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "uninject-attachment"),
action: _ => { action: _ => {
delete encodedMessages[e.instance.props.message.id]; delete encodedMessages[e.instance.props.message.id];
BDFDB.ModuleUtils.forceAllUpdates(this, ["Messages", "Attachment"]); BDFDB.MessageUtils.rerenderAll(true);
} }
}) })
})); }));
@ -176,11 +179,11 @@ var DisplayLargeMessages = (_ => {
} }
processMessages (e) { processMessages (e) {
e.instance.props.channelStream = [].concat(e.instance.props.channelStream); e.returnvalue.props.children.props.channelStream = [].concat(e.returnvalue.props.children.props.channelStream);
for (let i in e.instance.props.channelStream) { for (let i in e.returnvalue.props.children.props.channelStream) {
let message = e.instance.props.channelStream[i].content; let message = e.returnvalue.props.children.props.channelStream[i].content;
if (message) { if (message) {
if (BDFDB.ArrayUtils.is(message.attachments)) this.checkMessage(e.instance, e.instance.props.channelStream[i], message); if (BDFDB.ArrayUtils.is(message.attachments)) this.checkMessage(e.instance, e.returnvalue.props.children.props.channelStream[i], message);
else if (BDFDB.ArrayUtils.is(message)) for (let j in message) { else if (BDFDB.ArrayUtils.is(message)) for (let j in message) {
let childMessage = message[j].content; let childMessage = message[j].content;
if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(e.instance, message[j], childMessage); if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(e.instance, message[j], childMessage);
@ -243,7 +246,7 @@ var DisplayLargeMessages = (_ => {
content: message.content || "", content: message.content || "",
attachment: body || "" attachment: body || ""
}; };
BDFDB.ModuleUtils.forceAllUpdates(this, "Messages"); BDFDB.MessageUtils.rerenderAll(true);
}); });
} }
} }

View File

@ -29,7 +29,7 @@ var GoogleTranslateOption = (_ => {
return class GoogleTranslateOption { return class GoogleTranslateOption {
getName () {return "GoogleTranslateOption";} getName () {return "GoogleTranslateOption";}
getVersion () {return "2.0.8";} getVersion () {return "2.0.9";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -37,18 +37,18 @@ var GoogleTranslateOption = (_ => {
constructor () { constructor () {
this.changelog = { this.changelog = {
"fixed":[["Channel Mentions","No longer break while translating"]] "fixed":[["Message Update","Fixed for yet another message update provided by our best friend discord"]]
}; };
this.patchedModules = { this.patchedModules = {
before: { before: {
ChannelTextAreaForm: "render", ChannelTextAreaForm: "render",
ChannelEditorContainer: "render", ChannelEditorContainer: "render",
Messages: "render",
Embed: "render" Embed: "render"
}, },
after: { after: {
ChannelTextAreaContainer: "render", ChannelTextAreaContainer: "render",
Messages: "type",
MessageContent: "type", MessageContent: "type",
Embed: "render" Embed: "render"
} }
@ -352,11 +352,11 @@ var GoogleTranslateOption = (_ => {
} }
processMessages (e) { processMessages (e) {
e.instance.props.channelStream = [].concat(e.instance.props.channelStream); e.returnvalue.props.children.props.channelStream = [].concat(e.returnvalue.props.children.props.channelStream);
for (let i in e.instance.props.channelStream) { for (let i in e.returnvalue.props.children.props.channelStream) {
let message = e.instance.props.channelStream[i].content; let message = e.returnvalue.props.children.props.channelStream[i].content;
if (message) { if (message) {
if (BDFDB.ArrayUtils.is(message.attachments)) this.checkMessage(e.instance.props.channelStream[i], message); if (BDFDB.ArrayUtils.is(message.attachments)) this.checkMessage(e.returnvalue.props.children.props.channelStream[i], message);
else if (BDFDB.ArrayUtils.is(message)) for (let j in message) { else if (BDFDB.ArrayUtils.is(message)) for (let j in message) {
let childMessage = message[j].content; let childMessage = message[j].content;
if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(message[j], childMessage); if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(message[j], childMessage);
@ -549,7 +549,7 @@ var GoogleTranslateOption = (_ => {
if (!message) return; if (!message) return;
if (translatedMessages[message.id]) { if (translatedMessages[message.id]) {
delete translatedMessages[message.id]; delete translatedMessages[message.id];
BDFDB.ModuleUtils.forceAllUpdates(this, ["Messages", "Embed"]); BDFDB.MessageUtils.rerenderAll(true);
} }
else { else {
let content = message.content || ""; let content = message.content || "";
@ -564,7 +564,7 @@ var GoogleTranslateOption = (_ => {
embeds[message.embeds[i].id] = (strings.shift() || message.embeds[i].rawDescription).trim(); embeds[message.embeds[i].id] = (strings.shift() || message.embeds[i].rawDescription).trim();
} }
translatedMessages[message.id] = {content, embeds, input, output}; translatedMessages[message.id] = {content, embeds, input, output};
BDFDB.ModuleUtils.forceAllUpdates(this, ["Messages", "Embed"]); BDFDB.MessageUtils.rerenderAll(true);
} }
}); });
} }
@ -893,6 +893,7 @@ var GoogleTranslateOption = (_ => {
this.setLanguages(); this.setLanguages();
BDFDB.ModuleUtils.forceAllUpdates(this); BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
} }
setLabelsByLanguage () { setLabelsByLanguage () {

View File

@ -4,16 +4,20 @@ var RemoveBlockedMessages = (_ => {
return class RemoveBlockedMessages { return class RemoveBlockedMessages {
getName () {return "RemoveBlockedMessages";} getName () {return "RemoveBlockedMessages";}
getVersion () {return "1.0.2";} getVersion () {return "1.0.3";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
getDescription () {return "Removes blocked messages completely.";} getDescription () {return "Removes blocked messages completely.";}
constructor () { constructor () {
this.changelog = {
"fixed":[["Message Update","Fixed for yet another message update provided by our best friend discord"]]
};
this.patchedModules = { this.patchedModules = {
before: { after: {
Messages: "render" Messages: "type"
} }
}; };
} }
@ -47,7 +51,7 @@ var RemoveBlockedMessages = (_ => {
if (this.started) return; if (this.started) return;
BDFDB.PluginUtils.init(this); BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this); BDFDB.MessageUtils.rerenderAll();
} }
else { else {
console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!'); console.error(`%c[${this.getName()}]%c`, 'color: #3a71c1; font-weight: 700;', '', 'Fatal Error: Could not load BD functions!');
@ -58,7 +62,7 @@ var RemoveBlockedMessages = (_ => {
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) { if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
this.stopping = true; this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this); BDFDB.MessageUtils.rerenderAll();
BDFDB.PluginUtils.clear(this); BDFDB.PluginUtils.clear(this);
} }
@ -68,7 +72,7 @@ var RemoveBlockedMessages = (_ => {
// Begin of own functions // Begin of own functions
processMessages (e) { processMessages (e) {
if (BDFDB.ArrayUtils.is(e.instance.props.channelStream)) e.instance.props.channelStream = [].concat(e.instance.props.channelStream.filter(n => n.type != "MESSAGE_GROUP_BLOCKED")); if (BDFDB.ArrayUtils.is(e.returnvalue.props.children.props.channelStream)) e.returnvalue.props.children.props.channelStream = [].concat(e.returnvalue.props.children.props.channelStream.filter(n => n.type != "MESSAGE_GROUP_BLOCKED"));
if (BDFDB.ObjectUtils.is(e.instance.props.messages) && BDFDB.ArrayUtils.is(e.instance.props.messages._array)) { if (BDFDB.ObjectUtils.is(e.instance.props.messages) && BDFDB.ArrayUtils.is(e.instance.props.messages._array)) {
let messages = e.instance.props.messages; let messages = e.instance.props.messages;
e.instance.props.messages = new BDFDB.DiscordObjects.Messages(messages); e.instance.props.messages = new BDFDB.DiscordObjects.Messages(messages);