Skip to content

Instantly share code, notes, and snippets.

@shinmai
Last active July 21, 2025 15:08
Show Gist options
  • Select an option

  • Save shinmai/8bbd47c16536e6ed932634cbe0e8a098 to your computer and use it in GitHub Desktop.

Select an option

Save shinmai/8bbd47c16536e6ed932634cbe0e8a098 to your computer and use it in GitHub Desktop.
Vencord plug-in to change your status according to another user's status
import { getUserSettingLazy } from "@api/UserSettings";
import definePlugin from "@utils/types";
const TARGET_USER_ID = "142594671078539264",
StatusSetting = getUserSettingLazy("status", "status")!,
export default definePlugin({
name: "StatusMirror",
description: "Peekaboo.",
authors: [{ name: "shi", id: 142594671078539264 }],
flux: {
PRESENCE_UPDATES({ updates }: { updates: PresenceUpdate[] }) {
const currentStatus = StatusSetting.getSetting()
for (const { user: { id: userId, username }, status, clientStatus } of updates) {
if (userId != TARGET_USER_ID) continue
if (!clientStatus) continue
const shouldBe = status!=="offline"?"invisible":"dnd"
if (currentStatus != shouldBe) {
StatusSetting.updateSetting(shouldBe)
break
}
}
}
},
})
import { findByProps } from "@webpack";
import { getUserSettingLazy } from "@api/UserSettings";
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { definePluginSettings } from "@api/Settings";
import definePlugin, { OptionType } from "@utils/types";
const TARGET_USER_ID = "142594671078539264",
StatusSetting = getUserSettingLazy("status", "status")!,
settings = definePluginSettings({
isEnabled: {
type: OptionType.BOOLEAN,
description: "Enable StatusMirror",
default: true,
}
}),
mirrorNow = _ => {
const PresenceStore = findByProps("getStatus", "getState"),
targetStatus = PresenceStore.getStatus(TARGET_USER_ID),
shouldBe = targetStatus !== "offline"?"invisible":"dnd"
if (StatusSetting.getSetting() !== shouldBe) StatusSetting.updateSetting(shouldBe);
},
ChatBarContextCheckbox: NavContextMenuPatchCallback = children => {
const { isEnabled } = settings.use(["isEnabled"]),
group = findGroupChildrenByChildId("submit-button", children)
if (!group) return
const idx = group.findIndex(c => c?.props?.id === "submit-button")
group.splice(idx + 1, 0,
<Menu.MenuCheckboxItem id="vc-status-mirror" label="Enable StatusMirror" checked={isEnabled} action={() => {if(settings.store.isEnabled = !settings.store.isEnabled) mirrorNow()}} />
)
}
export default definePlugin({
name: "StatusMirror",
description: "Peekaboo.",
authors: [{ name: "shi", id: 142594671078539264 }],
settings,
contextMenus: { "textarea-context": ChatBarContextCheckbox },
flux: {
PRESENCE_UPDATES({ updates }: { updates: PresenceUpdate[] }) {
if (!settings.store.isEnabled) return
const currentStatus = StatusSetting.getSetting()
for (const { user: { id: userId, username }, status, clientStatus } of updates) {
if (userId != TARGET_USER_ID) continue
if (!clientStatus) continue
const shouldBe = status!=="offline"?"invisible":"dnd"
if (currentStatus != shouldBe) {
StatusSetting.updateSetting(shouldBe)
break
}
}
}
},
start() {
if (settings.store.isEnabled) mirrorNow()
},
stop() {}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment