mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 09:56:24 +00:00
Merge branch 'main' into plugin/NoAutoUnmute
This commit is contained in:
commit
4fc1251341
7 changed files with 36 additions and 6 deletions
|
@ -182,7 +182,7 @@ export default definePlugin({
|
||||||
patchedSettings: new WeakSet(),
|
patchedSettings: new WeakSet(),
|
||||||
|
|
||||||
addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: SectionTypes) {
|
addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: SectionTypes) {
|
||||||
if (this.patchedSettings.has(elements) || !this.isRightSpot(element)) return;
|
if (this.patchedSettings.has(elements)) return;
|
||||||
|
|
||||||
this.patchedSettings.add(elements);
|
this.patchedSettings.add(elements);
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,15 @@ function makeShortcuts() {
|
||||||
guildId: { getter: () => Common.SelectedGuildStore.getGuildId(), preload: false },
|
guildId: { getter: () => Common.SelectedGuildStore.getGuildId(), preload: false },
|
||||||
me: { getter: () => Common.UserStore.getCurrentUser(), preload: false },
|
me: { getter: () => Common.UserStore.getCurrentUser(), preload: false },
|
||||||
meId: { getter: () => Common.UserStore.getCurrentUser().id, preload: false },
|
meId: { getter: () => Common.UserStore.getCurrentUser().id, preload: false },
|
||||||
messages: { getter: () => Common.MessageStore.getMessages(Common.SelectedChannelStore.getChannelId()), preload: false }
|
messages: { getter: () => Common.MessageStore.getMessages(Common.SelectedChannelStore.getChannelId()), preload: false },
|
||||||
|
|
||||||
|
Stores: {
|
||||||
|
getter: () => Object.fromEntries(
|
||||||
|
Common.Flux.Store.getAll()
|
||||||
|
.map(store => [store.getName(), store] as const)
|
||||||
|
.filter(([name]) => name.length > 1)
|
||||||
|
)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ async function embedDidMount(this: Component<Props>) {
|
||||||
|
|
||||||
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
||||||
embed.dearrow.oldTitle = embed.rawTitle;
|
embed.dearrow.oldTitle = embed.rawTitle;
|
||||||
embed.rawTitle = titles[0].title.replace(/ >(\S)/g, " $1");
|
embed.rawTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
||||||
|
|
|
@ -42,7 +42,18 @@ const subscribedFluxEventsPlugins = new Set<string>();
|
||||||
const pluginsValues = Object.values(Plugins);
|
const pluginsValues = Object.values(Plugins);
|
||||||
const settings = Settings.plugins;
|
const settings = Settings.plugins;
|
||||||
|
|
||||||
|
const forceDisabled = new Set([
|
||||||
|
"MessageLogger",
|
||||||
|
"ShowHiddenChannels",
|
||||||
|
"MoreUserTags",
|
||||||
|
"Decor",
|
||||||
|
"IgnoreActivities",
|
||||||
|
"NoBlockedMessages",
|
||||||
|
"BetterFolders",
|
||||||
|
"NoPendingCount"
|
||||||
|
]);
|
||||||
export function isPluginEnabled(p: string) {
|
export function isPluginEnabled(p: string) {
|
||||||
|
if (forceDisabled.has(p)) return false;
|
||||||
return (
|
return (
|
||||||
Plugins[p]?.required ||
|
Plugins[p]?.required ||
|
||||||
Plugins[p]?.isDependency ||
|
Plugins[p]?.isDependency ||
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { UserUtils } from "@webpack/common";
|
||||||
|
|
||||||
import settings from "./settings";
|
import settings from "./settings";
|
||||||
import { ChannelDelete, ChannelType, GuildDelete, RelationshipRemove, RelationshipType } from "./types";
|
import { ChannelDelete, ChannelType, GuildDelete, RelationshipRemove, RelationshipType } from "./types";
|
||||||
import { deleteGroup, deleteGuild, getGroup, getGuild, notify } from "./utils";
|
import { deleteGroup, deleteGuild, getGroup, getGuild, GuildAvailabilityStore, notify } from "./utils";
|
||||||
|
|
||||||
let manuallyRemovedFriend: string | undefined;
|
let manuallyRemovedFriend: string | undefined;
|
||||||
let manuallyRemovedGuild: string | undefined;
|
let manuallyRemovedGuild: string | undefined;
|
||||||
|
@ -63,7 +63,7 @@ export async function onRelationshipRemove({ relationship: { type, id } }: Relat
|
||||||
|
|
||||||
export function onGuildDelete({ guild: { id, unavailable } }: GuildDelete) {
|
export function onGuildDelete({ guild: { id, unavailable } }: GuildDelete) {
|
||||||
if (!settings.store.servers) return;
|
if (!settings.store.servers) return;
|
||||||
if (unavailable) return;
|
if (unavailable || GuildAvailabilityStore.isUnavailable(id)) return;
|
||||||
|
|
||||||
if (manuallyRemovedGuild === id) {
|
if (manuallyRemovedGuild === id) {
|
||||||
deleteGuild(id);
|
deleteGuild(id);
|
||||||
|
|
|
@ -19,11 +19,20 @@
|
||||||
import { DataStore, Notices } from "@api/index";
|
import { DataStore, Notices } from "@api/index";
|
||||||
import { showNotification } from "@api/Notifications";
|
import { showNotification } from "@api/Notifications";
|
||||||
import { getUniqueUsername, openUserProfile } from "@utils/discord";
|
import { getUniqueUsername, openUserProfile } from "@utils/discord";
|
||||||
|
import { findStoreLazy } from "@webpack";
|
||||||
import { ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
|
import { ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
|
||||||
|
import { FluxStore } from "@webpack/types";
|
||||||
|
|
||||||
import settings from "./settings";
|
import settings from "./settings";
|
||||||
import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
|
import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
|
||||||
|
|
||||||
|
export const GuildAvailabilityStore = findStoreLazy("GuildAvailabilityStore") as FluxStore & {
|
||||||
|
totalGuilds: number;
|
||||||
|
totalUnavailableGuilds: number;
|
||||||
|
unavailableGuilds: string[];
|
||||||
|
isUnavailable(guildId: string): boolean;
|
||||||
|
};
|
||||||
|
|
||||||
const guilds = new Map<string, SimpleGuild>();
|
const guilds = new Map<string, SimpleGuild>();
|
||||||
const groups = new Map<string, SimpleGroupChannel>();
|
const groups = new Map<string, SimpleGroupChannel>();
|
||||||
const friends = {
|
const friends = {
|
||||||
|
@ -59,7 +68,7 @@ export async function syncAndRunChecks() {
|
||||||
|
|
||||||
if (settings.store.servers && oldGuilds?.size) {
|
if (settings.store.servers && oldGuilds?.size) {
|
||||||
for (const [id, guild] of oldGuilds) {
|
for (const [id, guild] of oldGuilds) {
|
||||||
if (!guilds.has(id))
|
if (!guilds.has(id) && !GuildAvailabilityStore.isUnavailable(id))
|
||||||
notify(`You are no longer in the server ${guild.name}.`, guild.iconURL);
|
notify(`You are no longer in the server ${guild.name}.`, guild.iconURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
src/webpack/common/types/stores.d.ts
vendored
2
src/webpack/common/types/stores.d.ts
vendored
|
@ -39,6 +39,8 @@ export class FluxStore {
|
||||||
syncWith: GenericFunction;
|
syncWith: GenericFunction;
|
||||||
waitFor: GenericFunction;
|
waitFor: GenericFunction;
|
||||||
__getLocalVars(): Record<string, any>;
|
__getLocalVars(): Record<string, any>;
|
||||||
|
|
||||||
|
static getAll(): FluxStore[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FluxEmitter {
|
export class FluxEmitter {
|
||||||
|
|
Loading…
Reference in a new issue