Ditch unneccesary classes in plugin entries

This commit is contained in:
amsyarasyiq 2023-07-09 08:30:26 +08:00
parent 646bc0b40b
commit 4d3eabc9f2
4 changed files with 25 additions and 41 deletions

View file

@ -1,17 +1,16 @@
import { logger } from "@vendetta";
import { findByName } from "@vendetta/metro";
const ChatInput = findByName("ChatInput");
export default new class HideGiftButton {
origState: boolean;
// Object.defineProperty(ChatInput.defaultProps, "hideGiftButton", {
// get: () => plugins?.[plugin.id]?.enabled
// });
export default {
onLoad() {
logger.log("Starting HideGiftButton...");
this.origState = ChatInput.defaultProps.hideGiftButton;
ChatInput.defaultProps.hideGiftButton = true;
}
},
onUnload() {
logger.log("Unloading HideGiftButton..");
ChatInput.defaultProps.hideGiftButton = this.origState;
ChatInput.defaultProps.hideGiftButton = false;
}
};

View file

@ -10,18 +10,15 @@ export interface SettingsSchema {
exempted: string[];
}
export const settings = storage as SettingsSchema;
storage.isBlacklistMode ??= false;
storage.exempted ??= [];
const ReplyManager = findByProps("createPendingReply");
settings.isBlacklistMode ??= false;
settings.exempted ??= [];
export default new class NoAutoReplyMention {
settings = Settings;
onUnload = patcher.before("createPendingReply", ReplyManager, ([arg]) => {
const isListed = settings.exempted.includes(arg.message?.author?.id);
arg.shouldMention &&= settings.isBlacklistMode ? !isListed : isListed;
});
export default {
settings: Settings,
onUnload: patcher.before("createPendingReply", ReplyManager, ([arg]) => {
const isListed = storage.exempted.includes(arg.message?.author?.id);
arg.shouldMention &&= storage.isBlacklistMode ? !isListed : isListed;
})
};

View file

@ -1,20 +1,8 @@
import { logger, patcher } from "@vendetta";
import { patcher } from "@vendetta";
import { FluxDispatcher } from "@vendetta/metro/common";
let unpatch: () => void;
export const onUnload = patcher.before("dispatch", FluxDispatcher, ([{ type }]) => {
if (type !== "IDLE") return;
export default new class NoIdle {
onLoad() {
logger.log("Starting NoIdle...");
unpatch = patcher.before("dispatch", FluxDispatcher, ([{ type }]) => {
if (type !== "IDLE") return;
return [{ type: "IDLE", idle: false }];
});
}
onUnload() {
logger.log("Disabling NoIdle..");
unpatch?.();
}
};
return [{ type: "IDLE", idle: false }];
});

10
plugins/defs.d.ts vendored
View file

@ -1,4 +1,4 @@
type Activity = {
export type Activity = {
name: string;
application_id: string;
flags: number;
@ -14,19 +14,19 @@ type Activity = {
buttons: ActivityButton[];
};
type ActivityButton = {
export type ActivityButton = {
label: string;
url: string;
};
type ActivityAssets = {
export type ActivityAssets = {
large_image?: string;
large_text?: string;
small_image?: string;
small_text?: string;
};
type LFMSettings = {
export type LFMSettings = {
appName: string;
username: string;
showTimestamp: boolean;
@ -36,7 +36,7 @@ type LFMSettings = {
verboseLogging: boolean;
};
type Track = {
export type Track = {
name: string;
artist: string;
album: string;