mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
Updated regex and added option to use other option by default
This commit is contained in:
parent
ddd883b988
commit
8208b528c0
1 changed files with 14 additions and 3 deletions
|
@ -77,6 +77,10 @@ const settings = definePluginSettings({
|
||||||
type: OptionType.COMPONENT,
|
type: OptionType.COMPONENT,
|
||||||
component: ReasonsComponent,
|
component: ReasonsComponent,
|
||||||
},
|
},
|
||||||
|
otherOptionDefault: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: 'Shows a text input instead of a select menu by default. (Equivalent to clicking the "Other" option)'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
|
@ -86,10 +90,14 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "default.Messages.BAN_MULTIPLE_CONFIRM_TITLE",
|
find: "default.Messages.BAN_MULTIPLE_CONFIRM_TITLE",
|
||||||
replacement: {
|
replacement: [{
|
||||||
match: /=\[([^\\]*?)\]/,
|
match: /=\[[^]*?\]/,
|
||||||
replace: "=$self.getReasons()"
|
replace: "=$self.getReasons()"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
match: /useState\(0\)/g,
|
||||||
|
replace: "useState($self.isOtherDefault())"
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
getReasons() {
|
getReasons() {
|
||||||
|
@ -97,5 +105,8 @@ export default definePlugin({
|
||||||
{ name: reason, value: reason }
|
{ name: reason, value: reason }
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
|
isOtherDefault() {
|
||||||
|
return settings.store.otherOptionDefault ? 1 : 0;
|
||||||
|
},
|
||||||
settings,
|
settings,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue