Fix Notices

Have I ever mentioned how terrible Discord's Notices code is?
This commit is contained in:
Vendicated 2022-12-20 18:03:58 +01:00
parent 1742bb6020
commit 9dcafbf468
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -16,12 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("NoticesAPI", "NoticesApi");
export default definePlugin({ export default definePlugin({
name: "NoticesAPI", name: "NoticesAPI",
description: "Fixes notices being automatically dismissed", description: "Fixes notices being automatically dismissed",
@ -29,12 +26,12 @@ export default definePlugin({
required: true, required: true,
patches: [ patches: [
{ {
find: "updateNotice:", find: 'displayName="NoticeStore"',
replacement: [ replacement: [
{ {
match: /;(.{1,2}=null;)(?=.{0,50}updateNotice)/g, match: /;.{1,2}=null;.{0,70}getPremiumSubscription/g,
replace: replace:
";if(Vencord.Api.Notices.currentNotice)return !1;$1" ";if(Vencord.Api.Notices.currentNotice)return false$&"
}, },
{ {
match: /(?<=NOTICE_DISMISS:function.+?){(?=if\(null==(.+?)\))/, match: /(?<=NOTICE_DISMISS:function.+?){(?=if\(null==(.+?)\))/,