SupportHelper: fix DM warning card

This commit is contained in:
Vendicated 2024-10-09 03:18:31 +02:00
parent 47db61d00e
commit 89bb3ee30a
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -149,8 +149,8 @@ export default definePlugin({
patches: [{ patches: [{
find: ".BEGINNING_DM.format", find: ".BEGINNING_DM.format",
replacement: { replacement: {
match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,100}userId:(\i\.getRecipientId\(\)))/, match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,300}(\i)\.isMultiUserDM)/,
replace: "$& $self.ContributorDmWarningCard({ userId: $1 })," replace: "$& $self.renderContributorDmWarningCard({ channel: $1 }),"
} }
}], }],
@ -235,7 +235,8 @@ export default definePlugin({
} }
}, },
ContributorDmWarningCard: ErrorBoundary.wrap(({ userId }) => { renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => {
const userId = channel.getRecipientId();
if (!isPluginDev(userId)) return null; if (!isPluginDev(userId)) return null;
if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id)) return null; if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id)) return null;