mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-25 16:56:23 +00:00
rename
This commit is contained in:
parent
7b1a776f21
commit
c849657ff0
2 changed files with 72 additions and 52 deletions
72
src/plugins/rpcEditor/index.tsx
Normal file
72
src/plugins/rpcEditor/index.tsx
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Forms, React, TextInput, useState } from "@webpack/common";
|
||||
import { DataStore } from "@api/index";
|
||||
|
||||
const DATASTORE_IDS_KEY = "RPCEditor_ActivityIds";
|
||||
|
||||
function Input({ initialValue, onChange, placeholder }: {
|
||||
placeholder: string;
|
||||
initialValue: string;
|
||||
onChange(value: string): void;
|
||||
}) {
|
||||
const [value, setValue] = useState(initialValue);
|
||||
return (
|
||||
<TextInput
|
||||
placeholder={placeholder}
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
spellCheck={false}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
idsToEdit: {
|
||||
type: OptionType.COMPONENT,
|
||||
description: "",
|
||||
component: async () => {
|
||||
return (
|
||||
<>
|
||||
<Forms.FormTitle style={{ marginBottom: "0px" }}>Comma separated list of activity IDs/names to
|
||||
edit</Forms.FormTitle>
|
||||
<Input placeholder={"886685857560539176, YouTube"}
|
||||
initialValue={DataStore.get(DATASTORE_IDS_KEY) ?? ""} onChange={e => explode()}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function explode() {
|
||||
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "RPCEditor",
|
||||
description: "Allows editing the type or content of any Rich Presence. (Configure in settings)",
|
||||
authors: [Devs.nin0dev],
|
||||
patches: [
|
||||
{
|
||||
find: "LocalActivityStore",
|
||||
replacement: {
|
||||
match: /LOCAL_ACTIVITY_UPDATE:function\((\i)\)\{/,
|
||||
replace: "$&$self.patchActivity($1.activity);",
|
||||
}
|
||||
}
|
||||
],
|
||||
settings,
|
||||
patchActivity(activity: any) {
|
||||
// not finished, this'll change all activities to listening :husk:
|
||||
console.log(activity);
|
||||
activity.type = 2;
|
||||
activity.assets.large_text = null; // bomb premid image text
|
||||
},
|
||||
});
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
listeningActivities: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma separated list of activity IDs/names to change to Listening",
|
||||
placeholder: "235839274917592729, YouTube Music"
|
||||
},
|
||||
watchingActivities: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma separated list of activity IDs/names to change to Watching",
|
||||
placeholder: "706754902072267788, YouTube"
|
||||
},
|
||||
competingActivities: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma separated list of activity IDs/names to change to Competing",
|
||||
placeholder: "373833473001936546, Overwatch"
|
||||
},
|
||||
noLargeImageTextListening: {
|
||||
type: OptionType.STRING,
|
||||
description: "Comma separated list of activity IDs/names to remove the large image text for",
|
||||
placeholder: "589556910426816513, Minecraft"
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "RPCTypeEditor",
|
||||
description: "Allows editing the type of any Rich Presence. (Configure in settings)",
|
||||
authors: [Devs.nin0dev],
|
||||
patches: [
|
||||
{
|
||||
find: "LocalActivityStore",
|
||||
replacement: {
|
||||
match: /LOCAL_ACTIVITY_UPDATE:function\((\i)\)\{/,
|
||||
replace: "$&$self.patchActivity($1.activity);",
|
||||
}
|
||||
}
|
||||
],
|
||||
settings,
|
||||
patchActivity(activity: any) {
|
||||
// not finished, this'll change all activities to listening :husk:
|
||||
activity.type = 2;
|
||||
},
|
||||
});
|
Loading…
Reference in a new issue