mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
Compare commits
6 commits
816447b8f3
...
205a16984f
Author | SHA1 | Date | |
---|---|---|---|
|
205a16984f | ||
|
b875ebf92d | ||
|
f9dec90f34 | ||
|
cd8729700e | ||
|
f969d80dc3 | ||
|
748a456cfb |
5 changed files with 65 additions and 7 deletions
5
src/plugins/defaultStatusForever/README.md
Normal file
5
src/plugins/defaultStatusForever/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# DefaultStatusForever
|
||||||
|
|
||||||
|
Makes the custom status screen default to "Don't Clear" as the duration
|
||||||
|
|
||||||
|
![The custom status screen, with "Don't Clear" selected and as the first option](https://github.com/Vendicated/Vencord/assets/44179559/e8cf0ca1-589c-43ef-9a6d-4fa3ed03a1f9)
|
48
src/plugins/defaultStatusForever/index.ts
Normal file
48
src/plugins/defaultStatusForever/index.ts
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
interface Choice {
|
||||||
|
key: number;
|
||||||
|
value: any;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "DefaultStatusForever",
|
||||||
|
description: "Make statuses default to last forever",
|
||||||
|
authors: [Devs.ImLvna],
|
||||||
|
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
// hardcode default status duration to null
|
||||||
|
find: "this.clearAfterOptions",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=value:)\i(?=,options:this.clearAfterOptions)/,
|
||||||
|
replace: "null"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// reorder the list to put "Dont't Clear" at the top
|
||||||
|
find: "get clearAfterOptions",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=get clearAfterOptions\(\){return).*?}]/,
|
||||||
|
replace: " $self.patchChoices($&)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
patchChoices(choices: Choice[]) {
|
||||||
|
const nullChoice = choices.find(choice => choice.value === null);
|
||||||
|
if (nullChoice) {
|
||||||
|
choices.splice(choices.indexOf(nullChoice), 1);
|
||||||
|
choices.unshift(nullChoice);
|
||||||
|
}
|
||||||
|
return choices;
|
||||||
|
}
|
||||||
|
});
|
|
@ -103,7 +103,7 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
|
||||||
<UserSummaryItem
|
<UserSummaryItem
|
||||||
users={users}
|
users={users}
|
||||||
renderIcon={false}
|
renderIcon={false}
|
||||||
max={7}
|
max={14}
|
||||||
size={18}
|
size={18}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -159,6 +159,7 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChanne
|
||||||
<Tooltip
|
<Tooltip
|
||||||
text={<VoiceChannelTooltip channel={channel} />}
|
text={<VoiceChannelTooltip channel={channel} />}
|
||||||
tooltipClassName={cl("tooltip-container")}
|
tooltipClassName={cl("tooltip-container")}
|
||||||
|
tooltipContentClassName={cl("tooltip-content")}
|
||||||
>
|
>
|
||||||
{props =>
|
{props =>
|
||||||
isLocked ?
|
isLocked ?
|
||||||
|
|
|
@ -32,7 +32,7 @@ const settings = definePluginSettings({
|
||||||
default: true,
|
default: true,
|
||||||
restartNeeded: true
|
restartNeeded: true
|
||||||
},
|
},
|
||||||
showInVoiceMemberList: {
|
showInMemberList: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Show a user's Voice Channel indicator in the member and DMs list",
|
description: "Show a user's Voice Channel indicator in the member and DMs list",
|
||||||
default: true,
|
default: true,
|
||||||
|
@ -82,12 +82,12 @@ export default definePlugin({
|
||||||
match: /\.subtext,children:.+?}\)\]}\)(?=])/,
|
match: /\.subtext,children:.+?}\)\]}\)(?=])/,
|
||||||
replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})"
|
replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})"
|
||||||
},
|
},
|
||||||
predicate: () => settings.store.showInVoiceMemberList
|
predicate: () => settings.store.showInMemberList
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if (settings.store.showInVoiceMemberList) {
|
if (settings.store.showInMemberList) {
|
||||||
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
|
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-uvs-tooltip-container {
|
.vc-uvs-tooltip-container {
|
||||||
max-width: 200px;
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-uvs-tooltip-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-uvs-guild-name {
|
.vc-uvs-guild-name {
|
||||||
|
@ -31,7 +37,5 @@
|
||||||
|
|
||||||
.vc-uvs-vc-members {
|
.vc-uvs-vc-members {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 8px 0;
|
|
||||||
flex-direction: row;
|
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue