Fix MessageLogger (#1888)
Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
parent
38daf6ec2b
commit
53cd14844f
|
@ -1,10 +1,10 @@
|
||||||
/* Message content highlighting */
|
/* Message content highlighting */
|
||||||
.messagelogger-deleted [class*="contents-"] > :is(div, h1, h2, h3, p) {
|
.messagelogger-deleted [class*="contents"] > :is(div, h1, h2, h3, p) {
|
||||||
color: #f04747 !important;
|
color: #f04747 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bot "thinking" text highlighting */
|
/* Bot "thinking" text highlighting */
|
||||||
.messagelogger-deleted [class*="colorStandard-"] {
|
.messagelogger-deleted [class*="colorStandard"] {
|
||||||
color: #f04747 !important;
|
color: #f04747 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ export default definePlugin({
|
||||||
ignoreGuilds.includes(ChannelStore.getChannel(message.channel_id)?.guild_id);
|
ignoreGuilds.includes(ChannelStore.getChannel(message.channel_id)?.guild_id);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Based on canary 9ab8626bcebceaea6da570b9c586172d02b9c996
|
// Based on canary 63b8f1b4f2025213c5cf62f0966625bee3d53136
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
// MessageStore
|
// MessageStore
|
||||||
|
@ -219,7 +219,7 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Add deleted=true to all target messages in the MESSAGE_DELETE event
|
// Add deleted=true to all target messages in the MESSAGE_DELETE event
|
||||||
match: /MESSAGE_DELETE:function\((\w)\){var .+?((?:\w{1,2}\.){2})getOrCreate.+?},/,
|
match: /MESSAGE_DELETE:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/,
|
||||||
replace:
|
replace:
|
||||||
"MESSAGE_DELETE:function($1){" +
|
"MESSAGE_DELETE:function($1){" +
|
||||||
" var cache = $2getOrCreate($1.channelId);" +
|
" var cache = $2getOrCreate($1.channelId);" +
|
||||||
|
@ -229,7 +229,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event
|
// Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event
|
||||||
match: /MESSAGE_DELETE_BULK:function\((\w)\){var .+?((?:\w{1,2}\.){2})getOrCreate.+?},/,
|
match: /MESSAGE_DELETE_BULK:function\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?},/,
|
||||||
replace:
|
replace:
|
||||||
"MESSAGE_DELETE_BULK:function($1){" +
|
"MESSAGE_DELETE_BULK:function($1){" +
|
||||||
" var cache = $2getOrCreate($1.channelId);" +
|
" var cache = $2getOrCreate($1.channelId);" +
|
||||||
|
@ -239,7 +239,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Add current cached content + new edit time to cached message's editHistory
|
// Add current cached content + new edit time to cached message's editHistory
|
||||||
match: /(MESSAGE_UPDATE:function\((\w)\).+?)\.update\((\w)/,
|
match: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/,
|
||||||
replace: "$1" +
|
replace: "$1" +
|
||||||
".update($3,m =>" +
|
".update($3,m =>" +
|
||||||
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message)) ? m :" +
|
" (($2.message.flags & 64) === 64 || $self.shouldIgnore($2.message)) ? m :" +
|
||||||
|
@ -251,8 +251,8 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// fix up key (edit last message) attempting to edit a deleted message
|
// fix up key (edit last message) attempting to edit a deleted message
|
||||||
match: /(?<=getLastEditableMessage=.{0,200}\.find\(\(function\((\i)\)\{)return/,
|
match: /(?<=getLastEditableMessage\(\i\)\{.{0,200}\.find\((\i)=>)/,
|
||||||
replace: "return !$1.deleted &&"
|
replace: "!$1.deleted &&"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -260,13 +260,13 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
// Message domain model
|
// Message domain model
|
||||||
// Module 451
|
// Module 451
|
||||||
find: "isFirstMessageInForumPost=function",
|
find: "}addReaction(",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(\w)\.customRenderedContent=(\w)\.customRenderedContent;/,
|
match: /this\.customRenderedContent=(\i)\.customRenderedContent,/,
|
||||||
replace: "$1.customRenderedContent = $2.customRenderedContent;" +
|
replace: "this.customRenderedContent = $1.customRenderedContent," +
|
||||||
"$1.deleted = $2.deleted || false;" +
|
"this.deleted = $1.deleted || false," +
|
||||||
"$1.editHistory = $2.editHistory || [];"
|
"this.editHistory = $1.editHistory || [],"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -283,7 +283,7 @@ export default definePlugin({
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
||||||
match: /interactionData:(\w)\.interactionData/,
|
match: /interactionData:(\i)\.interactionData/,
|
||||||
replace:
|
replace:
|
||||||
"interactionData:$1.interactionData," +
|
"interactionData:$1.interactionData," +
|
||||||
"deleted:$1.deleted," +
|
"deleted:$1.deleted," +
|
||||||
|
@ -299,7 +299,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
// Construct new edited message and add editHistory & deleted (ref above)
|
// Construct new edited message and add editHistory & deleted (ref above)
|
||||||
// Pass in custom data to attachment parser to mark attachments deleted as well
|
// Pass in custom data to attachment parser to mark attachments deleted as well
|
||||||
match: /attachments:(\w{1,2})\((\w)\)/,
|
match: /attachments:(\i)\((\i)\)/,
|
||||||
replace:
|
replace:
|
||||||
"attachments: $1((() => {" +
|
"attachments: $1((() => {" +
|
||||||
" let old = arguments[1]?.attachments;" +
|
" let old = arguments[1]?.attachments;" +
|
||||||
|
@ -315,7 +315,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Preserve deleted attribute on attachments
|
// Preserve deleted attribute on attachments
|
||||||
match: /(\((\w)\){return null==\2\.attachments.+?)spoiler:/,
|
match: /(\((\i)\){return null==\2\.attachments.+?)spoiler:/,
|
||||||
replace:
|
replace:
|
||||||
"$1deleted: arguments[0]?.deleted," +
|
"$1deleted: arguments[0]?.deleted," +
|
||||||
"spoiler:"
|
"spoiler:"
|
||||||
|
@ -326,15 +326,15 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
// Attachment renderer
|
// Attachment renderer
|
||||||
// Module 96063
|
// Module 96063
|
||||||
find: "().removeAttachmentHoverButton",
|
find: ".removeAttachmentHoverButton",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /((\w)\.className,\w=\2\.attachment),/,
|
match: /(className:\i,attachment:\i),/,
|
||||||
replace: "$1,deleted=$2.attachment?.deleted,"
|
replace: "$1,attachment: {deleted},"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /\["className","attachment".+?className:/,
|
match: /\[\i\.obscured\]:.+?,/,
|
||||||
replace: "$& (deleted ? 'messagelogger-deleted-attachment ' : '') +"
|
replace: "$& 'messagelogger-deleted-attachment': deleted,"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -371,11 +371,11 @@ export default definePlugin({
|
||||||
find: "displayName=\"ReferencedMessageStore\"",
|
find: "displayName=\"ReferencedMessageStore\"",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /MESSAGE_DELETE:function\((\w)\).+?},/,
|
match: /MESSAGE_DELETE:function\((\i)\).+?},/,
|
||||||
replace: "MESSAGE_DELETE:function($1){},"
|
replace: "MESSAGE_DELETE:function($1){},"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /MESSAGE_DELETE_BULK:function\((\w)\).+?},/,
|
match: /MESSAGE_DELETE_BULK:function\((\i)\).+?},/,
|
||||||
replace: "MESSAGE_DELETE_BULK:function($1){},"
|
replace: "MESSAGE_DELETE_BULK:function($1){},"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -384,7 +384,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
// Message context base menu
|
// Message context base menu
|
||||||
// Module 600300
|
// Module 600300
|
||||||
find: "id:\"remove-reactions\"",
|
find: "useMessageMenu:",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Remove the first section if message is deleted
|
// Remove the first section if message is deleted
|
||||||
|
|
Loading…
Reference in a new issue