QOL: Use Plugin Import
This commit is contained in:
parent
392274ff6e
commit
b204609987
7 changed files with 25 additions and 13 deletions
|
|
@ -8,6 +8,7 @@ import * as DataStore from "@api/DataStore";
|
|||
import { isPluginEnabled } from "@api/PluginManager";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { disableStyle, enableStyle } from "@api/Styles";
|
||||
import usrbg from "@plugins/usrbg";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType, Plugin } from "@utils/types";
|
||||
import { User } from "@vencord/discord-types";
|
||||
|
|
@ -139,8 +140,8 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
getBanner(userId: string): string | undefined {
|
||||
if (isPluginEnabled("USRBG") && (Vencord.Plugins.plugins.USRBG as iUSRBG).userHasBackground(userId)) {
|
||||
let banner = (Vencord.Plugins.plugins.USRBG as iUSRBG).getImageUrl(userId);
|
||||
if (isPluginEnabled(usrbg.name) && usrbg.userHasBackground(userId)) {
|
||||
let banner = usrbg.getImageUrl(userId);
|
||||
if (banner === null) banner = "";
|
||||
return banner;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import { Settings } from "@api/Settings";
|
||||
import { disableStyle, enableStyle } from "@api/Styles";
|
||||
import usrbg from "@plugins/usrbg";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { IconUtils, UserStore } from "@webpack/common";
|
||||
|
|
@ -39,13 +40,12 @@ export default definePlugin({
|
|||
const avatarUrl = IconUtils.getUserAvatarURL(user, false, 1024);
|
||||
|
||||
if (Settings.plugins.USRBG.enabled && Settings.plugins.USRBG.voiceBackground) {
|
||||
const USRBG = (Vencord.Plugins.plugins.USRBG as unknown as iUSRBG);
|
||||
if (USRBG.userHasBackground(participantUserId)) {
|
||||
if (usrbg.userHasBackground(participantUserId)) {
|
||||
document.querySelectorAll('[class*="background_"]').forEach(element => {
|
||||
(element as HTMLElement).style.backgroundColor = "transparent";
|
||||
});
|
||||
return {
|
||||
backgroundImage: `url(${USRBG.getImageUrl(participantUserId)})`,
|
||||
backgroundImage: `url(${usrbg.getImageUrl(participantUserId)})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
backgroundRepeat: "no-repeat",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
import "./styles.css";
|
||||
|
||||
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
import settings from "@plugins/_core/settings";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { React, } from "@webpack/common";
|
||||
|
|
@ -34,7 +35,7 @@ export default definePlugin({
|
|||
data.storageAutoSaveProtocol();
|
||||
|
||||
const customSettingsSections = (
|
||||
Vencord.Plugins.plugins.Settings as any as {
|
||||
settings as any as {
|
||||
customSections: ((ID: Record<string, unknown>) => any)[];
|
||||
}
|
||||
).customSections;
|
||||
|
|
@ -42,12 +43,20 @@ export default definePlugin({
|
|||
customSettingsSections.push(_ => ({
|
||||
section: "iremeberyou.display-data",
|
||||
label: "IRememberYou",
|
||||
id: "IRememberYou",
|
||||
element: () => <DataUI plugin={this} usersCollection={data.usersCollection} />
|
||||
}));
|
||||
},
|
||||
|
||||
stop() {
|
||||
const dataManager = this.dataManager as Data;
|
||||
const customSettingsSections = (
|
||||
Vencord.Plugins.plugins.Settings as any as {
|
||||
customSections: ((ID: Record<string, unknown>) => any)[];
|
||||
}
|
||||
).customSections;
|
||||
const i = customSettingsSections.findIndex(s => s({}).id === "IRememberYou");
|
||||
if (i !== -1) customSettingsSections.splice(i, 1);
|
||||
|
||||
removeMessagePreSendListener(dataManager._onMessagePreSend_preSend);
|
||||
clearInterval(dataManager._storageAutoSaveProtocol_interval);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import settings from "@plugins/_core/settings";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin, { StartAt } from "@utils/types";
|
||||
import { SettingsRouter } from "@webpack/common";
|
||||
|
|
@ -26,7 +27,7 @@ export default definePlugin({
|
|||
settingsAboutComponent: SettingsAbout,
|
||||
start() {
|
||||
const customSettingsSections = (
|
||||
Vencord.Plugins.plugins.Settings as any as {
|
||||
settings as any as {
|
||||
customSections: ((ID: Record<string, unknown>) => any)[];
|
||||
}
|
||||
).customSections;
|
||||
|
|
@ -43,7 +44,7 @@ export default definePlugin({
|
|||
},
|
||||
stop() {
|
||||
const customSettingsSections = (
|
||||
Vencord.Plugins.plugins.Settings as any as {
|
||||
settings as any as {
|
||||
customSections: ((ID: Record<string, unknown>) => any)[];
|
||||
}
|
||||
).customSections;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import {
|
|||
} from "@utils/modal";
|
||||
import { Button, React, TextInput } from "@webpack/common";
|
||||
|
||||
import { decrypt } from "../index";
|
||||
import invisibleChatDesktop, { decrypt } from "../index";
|
||||
|
||||
export function DecModal(props: any) {
|
||||
const encryptedMessage: string = props?.message?.content;
|
||||
|
|
@ -54,8 +54,7 @@ export function DecModal(props: any) {
|
|||
onClick={() => {
|
||||
const toSend = decrypt(encryptedMessage, password, true);
|
||||
if (!toSend || !props?.message) return;
|
||||
// @ts-expect-error
|
||||
Vencord.Plugins.plugins.InvisibleChat.buildEmbed(props?.message, toSend);
|
||||
invisibleChatDesktop.buildEmbed(props?.message, toSend);
|
||||
props.onClose();
|
||||
}}>
|
||||
Decrypt
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { fetchFile } from "@ffmpeg/util";
|
|||
import { findByPropsLazy } from "@webpack";
|
||||
import { ChannelStore, UploadHandler } from "@webpack/common";
|
||||
|
||||
import moreStickers from ".";
|
||||
import { FFmpegState, Sticker } from "./types";
|
||||
|
||||
const PendingReplyStore = findByPropsLazy("getPendingReply");
|
||||
|
|
@ -107,7 +108,7 @@ export async function sendSticker({
|
|||
}: { channelId: string; sticker: Sticker; sendAsLink?: boolean; ctrlKey: boolean; shiftKey: boolean; ffmpegState?: FFmpegState; }) {
|
||||
|
||||
let messageContent = "";
|
||||
const { textEditor } = Vencord.Plugins.plugins.MoreStickers as any;
|
||||
const { textEditor } = moreStickers;
|
||||
if (DraftStore) {
|
||||
messageContent = DraftStore.getDraft(channelId, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,13 @@ import { Margins } from "@utils/margins";
|
|||
import { OptionType } from "@utils/types";
|
||||
import { Forms, TextInput, Tooltip } from "@webpack/common";
|
||||
|
||||
import moreUserTags from ".";
|
||||
import { Tag, tags } from "./consts";
|
||||
import { TagSettings } from "./types";
|
||||
|
||||
function SettingsComponent() {
|
||||
const tagSettings = (settings.store.tagSettings ??= {} as TagSettings);
|
||||
const { localTags } = Vencord.Plugins.plugins.MoreUserTags as any;
|
||||
const { localTags } = moreUserTags;
|
||||
|
||||
tags.forEach(t => {
|
||||
if (!tagSettings[t.name]) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue