Skip to content

Commit

Permalink
fix(noDefaultHangStatus): forget all that type magic that broke it, j…
Browse files Browse the repository at this point in the history
…ust ignore
  • Loading branch information
D3SOX committed May 16, 2024
1 parent b5d998c commit 3007aad
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions noDefaultHangStatus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@
*/

import { Devs } from "@utils/constants";
import definePlugin, { PluginDef } from "@utils/types";
import definePlugin from "@utils/types";
import { FluxDispatcher } from "@webpack/common";
import { FluxEvents } from "@webpack/types";

type MyPluginDef = PluginDef & {
flux: {
UPDATE_HANG_STATUS: ({ status, saveAsDefault }: { status: string, saveAsDefault?: boolean }) => void;
};
};

type ExtendedFluxDispatcherType = typeof FluxDispatcher & {
// Extend the dispatch method to accept the extended event types
dispatch(event: { [key: string]: unknown; type: FluxEvents | "CLEAR_HANG_STATUS"; }): Promise<void>;
}

const ExtendedFluxDispatcher = FluxDispatcher as unknown as ExtendedFluxDispatcherType;

// @ts-ignore
export default definePlugin({
name: "NoDefaultHangStatus",
description: "Disable the default hang status when joining voice channels",
Expand All @@ -30,8 +17,9 @@ export default definePlugin({
flux: {
UPDATE_HANG_STATUS: ({ status, saveAsDefault }) => {
if (saveAsDefault === undefined && status) {
ExtendedFluxDispatcher.dispatch({ type: "CLEAR_HANG_STATUS" });
// @ts-ignore
FluxDispatcher.dispatch({ type: "CLEAR_HANG_STATUS" });
}
},
}
} as MyPluginDef);
});

0 comments on commit 3007aad

Please sign in to comment.