From 46585efc029fd9e99deeef7f9d0f0b6446480a35 Mon Sep 17 00:00:00 2001 From: megumin Date: Sun, 2 Oct 2022 17:59:37 +0100 Subject: [PATCH] feat(plugins): Add isStaff plugin (#25) * feat(plugins): Add isStaff plugin * fix(plugins/isStaff): Improve patches --- src/plugins/isStaff.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/plugins/isStaff.ts diff --git a/src/plugins/isStaff.ts b/src/plugins/isStaff.ts new file mode 100644 index 00000000..aacfc4d4 --- /dev/null +++ b/src/plugins/isStaff.ts @@ -0,0 +1,28 @@ +import { Devs } from "../utils/constants"; +import definePlugin from "../utils/types"; + +export default definePlugin({ + name: "isStaff", + description: + "Gives access to client devtools & other things locked behind isStaff", + authors: [Devs.Megu], + patches: [ + { + find: ".isStaff=function(){", + replacement: [ + { + match: /(\w+)\.isStaff=function\(\){return\s*!1};/, + replace: "$1.isStaff=function(){return true};", + }, + { + match: /return\s*\w+\.hasFlag\(.+?STAFF\)}/, + replace: "return true}", + }, + { + match: /hasFreePremium=function\(\){return this.isStaff\(\)\s*\|\|/, + replace: "hasFreePremium=function(){return ", + }, + ], + }, + ], +});