mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +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,
|
||||
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({
|
||||
|
@ -86,10 +90,14 @@ export default definePlugin({
|
|||
patches: [
|
||||
{
|
||||
find: "default.Messages.BAN_MULTIPLE_CONFIRM_TITLE",
|
||||
replacement: {
|
||||
match: /=\[([^\\]*?)\]/,
|
||||
replacement: [{
|
||||
match: /=\[[^]*?\]/,
|
||||
replace: "=$self.getReasons()"
|
||||
}
|
||||
},
|
||||
{
|
||||
match: /useState\(0\)/g,
|
||||
replace: "useState($self.isOtherDefault())"
|
||||
}]
|
||||
}
|
||||
],
|
||||
getReasons() {
|
||||
|
@ -97,5 +105,8 @@ export default definePlugin({
|
|||
{ name: reason, value: reason }
|
||||
));
|
||||
},
|
||||
isOtherDefault() {
|
||||
return settings.store.otherOptionDefault ? 1 : 0;
|
||||
},
|
||||
settings,
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue