Plugin
Experiments
Enable Access to Experiments & other dev-only features in Discord!
1
import { definePluginSettings } from "@api/Settings";2
import { disableStyle, enableStyle } from "@api/Styles";3
import ErrorBoundary from "@components/ErrorBoundary";4
import { ErrorCard } from "@components/ErrorCard";5
import { Paragraph } from "@components/Paragraph";6
import { Devs, IS_MAC } from "@utils/constants";7
import { Margins } from "@utils/margins";8
import definePlugin, { OptionType } from "@utils/types";9
import { findByPropsLazy } from "@webpack";10
import { ExperimentStore, Forms, React } from "@webpack/common";11
12
import hideBugReport from "./hideBugReport.css?managed";13
14
const KbdStyles = findByPropsLazy("key", "combo");15
16
const modKey = IS_MAC ? "cmd" : "ctrl";17
const altKey = IS_MAC ? "opt" : "alt";18
19
const settings = definePluginSettings({20
toolbarDevMenu: {21
type: OptionType.BOOLEAN,22
description: "Change the Help (?) toolbar button (top right in chat) to Discord039;s developer menu",23
default: false,24
restartNeeded: true25
}26
});27
28
export default definePlugin({29
name: "Experiments",30
description: "Enable Access to Experiments & other dev-only features in Discord!",31
tags: ["Developers", "Utility"],32
authors: [33
Devs.Megu,34
Devs.Ven,35
Devs.Nickyux,36
Devs.BanTheNons,37
Devs.Nuckyz,38
],39
40
settings,41
42
patches: [43
{44
find: "Object.defineProperties(this,{isDeveloper",45
replacement: {46
match: /(?<={isDeveloper:\{[^}]+?,get:\(\)=>)\i/,47
replace: "true"48
}49
},50
{51
find: 039;type:"user",revision039;,52
replacement: {53
match: /!(\i)(?=&&"CONNECTION_OPEN")/,54
replace: "!($1=true)"55
}56
},57
{58
find: 039;placeholder:"Search experiments"039;,59
replacement: [60
{61
match: /(?<=children:\[)(?=null!=.{0,150}"Installation ID:)/,62
replace: "$self.WarningCard(),"63
},64
// for some reason the installation id and copy buttons are on65
// different lines so it looks stupid when the card above is added66
{67
match: /(?<=,marginBottom:16)(?=\},children:\[)/,68
replace: 039;,flexDirection:"row",alignItems:"center"039;69
}70
]71
},72
// Change top right toolbar button from the help one to the dev one73
{74
find: 039;?"BACK_FORWARD_NAVIGATION":039;,75
replacement: {76
match: /hasBugReporterAccess:(\i)/,77
replace: "_hasBugReporterAccess:$1=true"78
},79
predicate: () => settings.store.toolbarDevMenu80
},81
// Disable opening the bug report menu when clicking the top right toolbar dev button82
{83
find: 039;navId:"staff-help-popout"039;,84
replacement: {85
match: /(isShown.+?)onClick:\i/,86
replace: (_, rest) => `${rest}onClick:()=>{}`87
}88
},89
// Enable experiment embed on sent experiment links90
{91
find: "Clear Treatment ",92
replacement: [93
{94
match: /\i\?\.isStaff\(\)/,95
replace: "true"96
},97
// Fix some tricky experiments name causing a client crash98
{99
match: /\.isStaffPersonal\(\).+?if\(null==(\i)\|\|null==\i(?=\)return null;)/,100
replace: "$&||({})[$1]!=null"101
}102
]103
},104
// Fix another function which cases crashes with tricky experiment names and the experiment embed105
{106
find: "}getServerAssignment(",107
replacement: {108
match: /}getServerAssignment\((\i),\i,\i\){/,109
replace: "$&if($1==null)return;"110
}111
},112
113
],114
115
start: () => ExperimentStore.getUserExperimentBucket("2026-01-bug-reporter") > 0 && enableStyle(hideBugReport),116
stop: () => disableStyle(hideBugReport),117
118
settingsAboutComponent: () => {119
return (120
<React.Fragment>121
<Forms.FormTitle tag="h3">More Information</Forms.FormTitle>122
<Paragraph size="md">123
You can open Discord039;s DevTools via {" "}124
<div className={KbdStyles.combo} style={{ display: "inline-flex" }}>125
<kbd className={KbdStyles.key}>{modKey}</kbd>{" "}126
<kbd className={KbdStyles.key}>{altKey}</kbd>{" "}127
<kbd className={KbdStyles.key}>O</kbd>{" "}128
</div>129
</Paragraph>130
</React.Fragment>131
);132
},133
134
WarningCard: ErrorBoundary.wrap(() => (135
<ErrorCard id="vc-experiments-warning-card" className={Margins.bottom16}>136
<Forms.FormTitle tag="h2">Hold on!!</Forms.FormTitle>137
138
<Forms.FormText>139
Experiments are unreleased Discord features. They might not work, or even break your client or get your account disabled.140
</Forms.FormText>141
142
<Forms.FormText className={Margins.top8}>143
Only use experiments if you know what you039;re doing. Vencord is not responsible for any damage caused by enabling experiments.144
145
If you don039;t know what an experiment does, ignore it. Do not ask us what experiments do either, we probably don039;t know.146
</Forms.FormText>147
148
<Forms.FormText className={Margins.top8}>149
No, you cannot use server-side features like checking the "Send to Client" box.150
</Forms.FormText>151
</ErrorCard>152
), { noop: true })153
});154