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

File diff suppressed because one or more lines are too long

View File

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

View File

@ -7,18 +7,20 @@ var DisplayLargeMessages = (_ => {
return class DisplayLargeMessages {
getName () {return "DisplayLargeMessages";}
getVersion () {return "1.0.5";}
getVersion () {return "1.0.6";}
getAuthor () {return "DevilBro";}
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 = {
before: {
Messages: "render",
},
after: {
Messages: "type",
Attachment: "default"
}
};
@ -38,7 +40,8 @@ var DisplayLargeMessages = (_ => {
}
${BDFDB.dotCN._displaylargemessagesinjectbutton}:hover {
color: var(--interactive-hover);
}`;
}
`;
this.defaults = {
settings: {
@ -167,7 +170,7 @@ var DisplayLargeMessages = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "uninject-attachment"),
action: _ => {
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) {
e.instance.props.channelStream = [].concat(e.instance.props.channelStream);
for (let i in e.instance.props.channelStream) {
let message = e.instance.props.channelStream[i].content;
e.returnvalue.props.children.props.channelStream = [].concat(e.returnvalue.props.children.props.channelStream);
for (let i in e.returnvalue.props.children.props.channelStream) {
let message = e.returnvalue.props.children.props.channelStream[i].content;
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) {
let childMessage = message[j].content;
if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(e.instance, message[j], childMessage);
@ -243,7 +246,7 @@ var DisplayLargeMessages = (_ => {
content: message.content || "",
attachment: body || ""
};
BDFDB.ModuleUtils.forceAllUpdates(this, "Messages");
BDFDB.MessageUtils.rerenderAll(true);
});
}
}

View File

@ -29,7 +29,7 @@ var GoogleTranslateOption = (_ => {
return class GoogleTranslateOption {
getName () {return "GoogleTranslateOption";}
getVersion () {return "2.0.8";}
getVersion () {return "2.0.9";}
getAuthor () {return "DevilBro";}
@ -37,18 +37,18 @@ var GoogleTranslateOption = (_ => {
constructor () {
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 = {
before: {
ChannelTextAreaForm: "render",
ChannelEditorContainer: "render",
Messages: "render",
Embed: "render"
},
after: {
ChannelTextAreaContainer: "render",
Messages: "type",
MessageContent: "type",
Embed: "render"
}
@ -352,11 +352,11 @@ var GoogleTranslateOption = (_ => {
}
processMessages (e) {
e.instance.props.channelStream = [].concat(e.instance.props.channelStream);
for (let i in e.instance.props.channelStream) {
let message = e.instance.props.channelStream[i].content;
e.returnvalue.props.children.props.channelStream = [].concat(e.returnvalue.props.children.props.channelStream);
for (let i in e.returnvalue.props.children.props.channelStream) {
let message = e.returnvalue.props.children.props.channelStream[i].content;
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) {
let childMessage = message[j].content;
if (childMessage && BDFDB.ArrayUtils.is(childMessage.attachments)) this.checkMessage(message[j], childMessage);
@ -549,7 +549,7 @@ var GoogleTranslateOption = (_ => {
if (!message) return;
if (translatedMessages[message.id]) {
delete translatedMessages[message.id];
BDFDB.ModuleUtils.forceAllUpdates(this, ["Messages", "Embed"]);
BDFDB.MessageUtils.rerenderAll(true);
}
else {
let content = message.content || "";
@ -564,7 +564,7 @@ var GoogleTranslateOption = (_ => {
embeds[message.embeds[i].id] = (strings.shift() || message.embeds[i].rawDescription).trim();
}
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();
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
setLabelsByLanguage () {

View File

@ -4,16 +4,20 @@ var RemoveBlockedMessages = (_ => {
return class RemoveBlockedMessages {
getName () {return "RemoveBlockedMessages";}
getVersion () {return "1.0.2";}
getVersion () {return "1.0.3";}
getAuthor () {return "DevilBro";}
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 = {
before: {
Messages: "render"
after: {
Messages: "type"
}
};
}
@ -47,7 +51,7 @@ var RemoveBlockedMessages = (_ => {
if (this.started) return;
BDFDB.PluginUtils.init(this);
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
}
else {
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) {
this.stopping = true;
BDFDB.ModuleUtils.forceAllUpdates(this);
BDFDB.MessageUtils.rerenderAll();
BDFDB.PluginUtils.clear(this);
}
@ -68,7 +72,7 @@ var RemoveBlockedMessages = (_ => {
// Begin of own functions
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)) {
let messages = e.instance.props.messages;
e.instance.props.messages = new BDFDB.DiscordObjects.Messages(messages);