Vencord/src/plugins/isStaff.ts
BanTheNons e685e399f9
fix(plugin): fix isStaff returning true for all users (#83)
Co-authored-by: nmsturcke <30734036+nmsturcke@users.noreply.github.com>
2022-10-10 23:45:11 +02:00

34 lines
1,003 B
TypeScript

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,
{
name: "Nickyux",
id: 427146305651998721n
},
{
name: "BanTheNons",
id: 460478012794863637n
}
],
patches: [
{
find: ".isStaff=function(){",
replacement: [
{
match: /return\s*(\w+)\.hasFlag\((.+?)\.STAFF\)}/,
replace: "return Vencord.Webpack.Common.UserStore.getCurrentUser().id===$1.id||$1.hasFlag($2.STAFF)}"
},
{
match: /hasFreePremium=function\(\){return this.isStaff\(\)\s*\|\|/,
replace: "hasFreePremium=function(){return ",
},
],
},
],
});