stuff
This commit is contained in:
parent
bad0e640aa
commit
e8f0d42452
|
@ -1998,8 +1998,8 @@ module.exports = (_ => {
|
|||
};
|
||||
const setText = newText => {
|
||||
if (BDFDB.ObjectUtils.is(config.guild)) {
|
||||
let isMuted = Internal.LibraryModules.MutedUtils.isMuted(config.guild.id);
|
||||
let muteConfig = Internal.LibraryModules.MutedUtils.getMuteConfig(config.guild.id);
|
||||
let isMuted = Internal.LibraryStores.UserGuildSettingsStore.isMuted(config.guild.id);
|
||||
let muteConfig = Internal.LibraryStores.UserGuildSettingsStore.getMuteConfig(config.guild.id);
|
||||
|
||||
let children = [typeof newText == "function" ? newText() : newText].flat(10).filter(n => typeof n == "string" || BDFDB.ReactUtils.isValidElement(n));
|
||||
|
||||
|
@ -3207,11 +3207,11 @@ module.exports = (_ => {
|
|||
BDFDB.UserUtils.is = function (user) {
|
||||
return user && user instanceof Internal.DiscordObjects.User;
|
||||
};
|
||||
const myDataUser = Internal.LibraryModules.UserStore && Internal.LibraryModules.UserStore.getCurrentUser && Internal.LibraryModules.UserStore.getCurrentUser();
|
||||
const myDataUser = Internal.LibraryStores.UserStore && Internal.LibraryStores.UserStore.getCurrentUser && Internal.LibraryStores.UserStore.getCurrentUser();
|
||||
if (myDataUser && BDFDB.UserUtils._id != myDataUser.id) BDFDB.UserUtils._id = myDataUser.id;
|
||||
BDFDB.UserUtils.me = new Proxy(myDataUser || {}, {
|
||||
get: function (list, item) {
|
||||
const user = Internal.LibraryModules.UserStore && Internal.LibraryModules.UserStore.getCurrentUser && Internal.LibraryModules.UserStore.getCurrentUser();
|
||||
const user = Internal.LibraryStores.UserStore && Internal.LibraryStores.UserStore.getCurrentUser && Internal.LibraryStores.UserStore.getCurrentUser();
|
||||
if (user && BDFDB.UserUtils._id != user.id) {
|
||||
Cache.data = {};
|
||||
BDFDB.UserUtils._id = user.id;
|
||||
|
@ -3222,7 +3222,7 @@ module.exports = (_ => {
|
|||
BDFDB.UserUtils.getStatus = function (id = BDFDB.UserUtils.me.id) {
|
||||
id = typeof id == "number" ? id.toFixed() : id;
|
||||
let activity = BDFDB.UserUtils.getActivity(id);
|
||||
return activity && activity.type == Internal.DiscordConstants.ActivityTypes.STREAMING ? "streaming" : Internal.LibraryModules.StatusMetaUtils.getStatus(id);
|
||||
return activity && activity.type == Internal.DiscordConstants.ActivityTypes.STREAMING ? "streaming" : Internal.LibraryStores.PresenceStore.getStatus(id);
|
||||
};
|
||||
BDFDB.UserUtils.getStatusColor = function (status, useColor) {
|
||||
if (!Internal.DiscordConstants.Colors) return null;
|
||||
|
@ -3238,19 +3238,19 @@ module.exports = (_ => {
|
|||
}
|
||||
};
|
||||
BDFDB.UserUtils.getActivity = function (id = BDFDB.UserUtils.me.id) {
|
||||
for (let activity of Internal.LibraryModules.StatusMetaUtils.getActivities(id)) if (activity.type != Internal.DiscordConstants.ActivityTypes.CUSTOM_STATUS) return activity;
|
||||
for (let activity of Internal.LibraryStores.PresenceStore.getActivities(id)) if (activity.type != Internal.DiscordConstants.ActivityTypes.CUSTOM_STATUS) return activity;
|
||||
return null;
|
||||
};
|
||||
BDFDB.UserUtils.getCustomStatus = function (id = BDFDB.UserUtils.me.id) {
|
||||
for (let activity of Internal.LibraryModules.StatusMetaUtils.getActivities(id)) if (activity.type == Internal.DiscordConstants.ActivityTypes.CUSTOM_STATUS) return activity;
|
||||
for (let activity of Internal.LibraryStores.PresenceStore.getActivities(id)) if (activity.type == Internal.DiscordConstants.ActivityTypes.CUSTOM_STATUS) return activity;
|
||||
return null;
|
||||
};
|
||||
BDFDB.UserUtils.getAvatar = function (id = BDFDB.UserUtils.me.id) {
|
||||
let user = Internal.LibraryModules.UserStore.getUser(id);
|
||||
let user = Internal.LibraryStores.UserStore.getUser(id);
|
||||
if (!user) return window.location.origin + "/assets/1f0bfc0865d324c2587920a7d80c609b.png";
|
||||
else return ((user.avatar ? "" : window.location.origin) + Internal.LibraryModules.IconUtils.getUserAvatarURL(user)).split("?")[0];
|
||||
};
|
||||
BDFDB.UserUtils.getBanner = function (id = BDFDB.UserUtils.me.id, guildId = Internal.LibraryModules.LastGuildStore.getGuildId(), canAnimate = false) {
|
||||
BDFDB.UserUtils.getBanner = function (id = BDFDB.UserUtils.me.id, guildId = Internal.LibraryStores.SelectedGuildStore.getGuildId(), canAnimate = false) {
|
||||
let displayProfile = Internal.LibraryModules.MemberDisplayUtils.getDisplayProfile(id, guildId);
|
||||
return (Internal.LibraryModules.IconUtils.getUserBannerURL(Object.assign({banner: displayProfile && displayProfile.banner, id: id}, {canAnimate})) || "").split("?")[0];
|
||||
};
|
||||
|
@ -3290,7 +3290,7 @@ module.exports = (_ => {
|
|||
return Internal.LibraryModules.IconUtils.getGuildBannerURL(guild).split("?")[0];
|
||||
};
|
||||
BDFDB.GuildUtils.getFolder = function (id) {
|
||||
return Internal.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).find(n => n.guildIds.includes(id));
|
||||
return Internal.LibraryStores.SortedGuildStore.guildFolders.filter(n => n.folderId).find(n => n.guildIds.includes(id));
|
||||
};
|
||||
BDFDB.GuildUtils.openMenu = function (guild, e = mousePosition) {
|
||||
if (!guild) return;
|
||||
|
@ -3305,12 +3305,12 @@ module.exports = (_ => {
|
|||
BDFDB.GuildUtils.markAsRead = function (guildIds) {
|
||||
guildIds = [guildIds].flat(10).filter(id => id && typeof id == "string" && Internal.LibraryStores.GuildStore.getGuild(id));
|
||||
if (!guildIds) return;
|
||||
let channels = guildIds.map(id => [BDFDB.ObjectUtils.toArray(Internal.LibraryModules.GuildChannelStore.getChannels(id)), Internal.LibraryModules.GuildEventStore.getGuildScheduledEventsForGuild(id)]).flat(10).map(n => n && (n.channel && n.channel.id || n.id)).flat().filter(n => n);
|
||||
let channels = guildIds.map(id => [BDFDB.ObjectUtils.toArray(Internal.LibraryStores.GuildChannelStore.getChannels(id)), Internal.LibraryStores.GuildScheduledEventStore.getGuildScheduledEventsForGuild(id)]).flat(10).map(n => n && (n.channel && n.channel.id || n.id)).flat().filter(n => n);
|
||||
if (channels.length) BDFDB.ChannelUtils.markAsRead(channels);
|
||||
let eventChannels = guildIds.map(id => ({
|
||||
channelId: id,
|
||||
readStateType: Internal.LibraryModules.UnreadStateTypes.GUILD_EVENT,
|
||||
messageId: Internal.LibraryModules.UnreadChannelUtils.lastMessageId(id, Internal.LibraryModules.UnreadStateTypes.GUILD_EVENT)
|
||||
messageId: Internal.LibraryStores.ReadStateStore.lastMessageId(id, Internal.LibraryModules.UnreadStateTypes.GUILD_EVENT)
|
||||
})).filter(n => n.messageId);
|
||||
if (eventChannels.length) Internal.LibraryModules.AckUtils.bulkAck(eventChannels);
|
||||
};
|
||||
|
@ -3326,7 +3326,7 @@ module.exports = (_ => {
|
|||
return BDFDB.ReactUtils.findValue(div, "folderId", {up: true});
|
||||
};
|
||||
BDFDB.FolderUtils.getDefaultName = function (folderId) {
|
||||
let folder = Internal.LibraryModules.FolderStore.getGuildFolderById(folderId);
|
||||
let folder = Internal.LibraryStores.SortedGuildStore.getGuildFolderById(folderId);
|
||||
if (!folder) return "";
|
||||
let rest = 2 * Internal.DiscordConstants.MAX_GUILD_FOLDER_NAME_LENGTH;
|
||||
let names = [], allNames = folder.guildIds.map(guildId => (Internal.LibraryStores.GuildStore.getGuild(guildId) || {}).name).filter(n => n);
|
||||
|
@ -3356,14 +3356,14 @@ module.exports = (_ => {
|
|||
return channel && channel.parentChannelThreadType && channel.parentChannelThreadType == Internal.DiscordConstants.ChannelTypes.GUILD_FORUM;
|
||||
};
|
||||
BDFDB.ChannelUtils.isEvent = function (channelOrId) {
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryModules.GuildEventStore.getGuildScheduledEvent(channelOrId) : channelOrId;
|
||||
return channel && Internal.LibraryModules.GuildEventStore.getGuildScheduledEvent(channel.id) && true;
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryStores.GuildScheduledEventStore.getGuildScheduledEvent(channelOrId) : channelOrId;
|
||||
return channel && Internal.LibraryStores.GuildScheduledEventStore.getGuildScheduledEvent(channel.id) && true;
|
||||
};
|
||||
BDFDB.ChannelUtils.markAsRead = function (channelIds) {
|
||||
let unreadChannels = [channelIds].flat(10).filter(id => id && typeof id == "string" && (BDFDB.LibraryStores.ChannelStore.getChannel(id) || {}).type != Internal.DiscordConstants.ChannelTypes.GUILD_CATEGORY && (Internal.LibraryModules.UnreadChannelUtils.hasUnread(id) || Internal.LibraryModules.UnreadChannelUtils.getMentionCount(id) > 0)).map(id => ({
|
||||
let unreadChannels = [channelIds].flat(10).filter(id => id && typeof id == "string" && (BDFDB.LibraryStores.ChannelStore.getChannel(id) || {}).type != Internal.DiscordConstants.ChannelTypes.GUILD_CATEGORY && (Internal.LibraryStores.ReadStateStore.hasUnread(id) || Internal.LibraryStores.ReadStateStore.getMentionCount(id) > 0)).map(id => ({
|
||||
channelId: id,
|
||||
readStateType: Internal.LibraryModules.UnreadStateTypes.CHANNEL,
|
||||
messageId: Internal.LibraryModules.UnreadChannelUtils.lastMessageId(id)
|
||||
messageId: Internal.LibraryStores.ReadStateStore.lastMessageId(id)
|
||||
}));
|
||||
if (unreadChannels.length) Internal.LibraryModules.AckUtils.bulkAck(unreadChannels);
|
||||
};
|
||||
|
@ -3394,7 +3394,7 @@ module.exports = (_ => {
|
|||
return Internal.LibraryModules.IconUtils.getChannelIconURL(channel).split("?")[0];
|
||||
};
|
||||
BDFDB.DMUtils.markAsRead = function (dmIds) {
|
||||
let unreadDMs = [dmIds].flat(10).filter(id => id && typeof id == "string" && BDFDB.DMUtils.isDMChannel(id) && (Internal.LibraryModules.UnreadChannelUtils.hasUnread(id) || Internal.LibraryModules.UnreadChannelUtils.getMentionCount(id) > 0));
|
||||
let unreadDMs = [dmIds].flat(10).filter(id => id && typeof id == "string" && BDFDB.DMUtils.isDMChannel(id) && (Internal.LibraryStores.ReadStateStore.hasUnread(id) || Internal.LibraryStores.ReadStateStore.getMentionCount(id) > 0));
|
||||
if (unreadDMs.length) for (let i in unreadDMs) BDFDB.TimeUtils.timeout(_ => Internal.LibraryModules.AckUtils.ack(unreadDMs[i]), i * 1000);
|
||||
};
|
||||
|
||||
|
@ -4429,7 +4429,7 @@ module.exports = (_ => {
|
|||
}
|
||||
};
|
||||
BDFDB.DiscordUtils.getTheme = function () {
|
||||
return BDFDB.LibraryModules.ThemeSettingsStore.theme != "dark" ? BDFDB.disCN.themelight : BDFDB.disCN.themedark;
|
||||
return BDFDB.LibraryStores.ThemeStore.theme != "dark" ? BDFDB.disCN.themelight : BDFDB.disCN.themedark;
|
||||
};
|
||||
BDFDB.DiscordUtils.getZoomFactor = function () {
|
||||
let aRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount));
|
||||
|
@ -6307,7 +6307,7 @@ module.exports = (_ => {
|
|||
if (typeof this.props.onMouseLeave == "function") this.props.onMouseLeave(e, this);
|
||||
}
|
||||
handleMouseDown(e) {
|
||||
if (!this.props.unavailable && this.props.guild && this.props.selectedChannelId) Internal.LibraryModules.DirectMessageUtils.preload(this.props.guild.id, this.props.selectedChannelId);
|
||||
if (!this.props.unavailable && this.props.guild && this.props.selectedChannelId) Internal.LibraryModules.PrivateChannelUtils.preload(this.props.guild.id, this.props.selectedChannelId);
|
||||
if (e.button == 0 && typeof this.props.onMouseDown == "function") this.props.onMouseDown(e, this);
|
||||
}
|
||||
handleMouseUp(e) {
|
||||
|
@ -6333,25 +6333,25 @@ module.exports = (_ => {
|
|||
this.props.guildId = this.props.guild.id;
|
||||
this.props.selectedChannelId = Internal.LibraryModules.LastChannelStore.getChannelId(this.props.guild.id);
|
||||
|
||||
let currentVoiceChannel = Internal.LibraryStores.ChannelStore.getChannel(Internal.LibraryModules.CurrentVoiceUtils.getChannelId());
|
||||
let hasVideo = currentVoiceChannel && Internal.LibraryModules.VoiceUtils.hasVideo(currentVoiceChannel);
|
||||
let currentVoiceChannel = Internal.LibraryStores.ChannelStore.getChannel(Internal.LibraryStores.RTCConnectionStore.getChannelId());
|
||||
let hasVideo = currentVoiceChannel && Internal.LibraryStores.SortedVoiceStateStore.hasVideo(currentVoiceChannel);
|
||||
|
||||
this.props.selected = this.props.state ? Internal.LibraryModules.LastGuildStore.getGuildId() == this.props.guild.id : false;
|
||||
this.props.unread = this.props.state ? Internal.LibraryModules.UnreadGuildUtils.hasUnread(this.props.guild.id) : false;
|
||||
this.props.badge = this.props.state ? Internal.LibraryModules.UnreadGuildUtils.getMentionCount(this.props.guild.id) : 0;
|
||||
this.props.selected = this.props.state ? Internal.LibraryStores.SelectedGuildStore.getGuildId() == this.props.guild.id : false;
|
||||
this.props.unread = this.props.state ? Internal.LibraryStores.GuildReadStateStore.hasUnread(this.props.guild.id) : false;
|
||||
this.props.badge = this.props.state ? Internal.LibraryStores.GuildReadStateStore.getMentionCount(this.props.guild.id) : 0;
|
||||
|
||||
this.props.mediaState = Object.assign({}, this.props.mediaState, {
|
||||
audio: this.props.state ? currentVoiceChannel && currentVoiceChannel.guild_id == this.props.guild.id && !hasVideo : false,
|
||||
video: this.props.state ? currentVoiceChannel && currentVoiceChannel.guild_id == this.props.guild.id && hasVideo : false,
|
||||
screenshare: this.props.state ? !!Internal.LibraryModules.StreamUtils.getAllApplicationStreams().filter(stream => stream.guildId == this.props.guild.id)[0] : false,
|
||||
liveStage: this.props.state ? Object.keys(Internal.LibraryModules.StageChannelStore.getStageInstancesByGuild(this.props.guild.id)).length > 0 : false,
|
||||
hasLiveVoiceChannel: this.props.state && false ? !Internal.LibraryModules.MutedUtils.isMuted(this.props.guild.id) && BDFDB.ObjectUtils.toArray(Internal.LibraryModules.VoiceUtils.getVoiceStates(this.props.guild.id)).length > 0 : false,
|
||||
participating: this.props.state ? Internal.LibraryModules.CurrentVoiceUtils.getGuildId() == this.props.guild.id : false,
|
||||
screenshare: this.props.state ? !!Internal.LibraryStores.ApplicationStreamingStore.getAllApplicationStreams().filter(stream => stream.guildId == this.props.guild.id)[0] : false,
|
||||
liveStage: this.props.state ? Object.keys(Internal.LibraryStores.StageInstanceStore.getStageInstancesByGuild(this.props.guild.id)).length > 0 : false,
|
||||
hasLiveVoiceChannel: this.props.state && false ? !Internal.LibraryStores.UserGuildSettingsStore.isMuted(this.props.guild.id) && BDFDB.ObjectUtils.toArray(Internal.LibraryStores.SortedVoiceStateStore.getVoiceStates(this.props.guild.id)).length > 0 : false,
|
||||
participating: this.props.state ? Internal.LibraryStores.RTCConnectionStore.getGuildId() == this.props.guild.id : false,
|
||||
participatingInStage: this.props.state ? currentVoiceChannel && currentVoiceChannel.guild_id == this.props.guild.id && currentVoiceChannel.isGuildStageVoice() : false
|
||||
});
|
||||
|
||||
this.props.animatable = this.props.state ? this.props.guild.icon && Internal.LibraryModules.IconUtils.isAnimatedIconHash(this.props.guild.icon) : false;
|
||||
this.props.unavailable = this.props.state ? Internal.LibraryModules.GuildUnavailableStore.unavailableGuilds.includes(this.props.guild.id) : false;
|
||||
this.props.unavailable = this.props.state ? Internal.LibraryStores.GuildAvailabilityStore.unavailableGuilds.includes(this.props.guild.id) : false;
|
||||
|
||||
let isDraggedGuild = this.props.draggingGuildId === this.props.guild.id;
|
||||
let guild = isDraggedGuild ? BDFDB.ReactUtils.createElement("div", {
|
||||
|
@ -6482,13 +6482,13 @@ module.exports = (_ => {
|
|||
|
||||
CustomComponents.GuildVoiceList = reactInitialized && class BDFDB_GuildVoiceList extends Internal.LibraryModules.React.Component {
|
||||
render() {
|
||||
let channels = Internal.LibraryModules.GuildChannelStore.getChannels(this.props.guild.id);
|
||||
let channels = Internal.LibraryStores.GuildChannelStore.getChannels(this.props.guild.id);
|
||||
let voiceChannels = (channels[Internal.LibraryModules.GuildChannelKeys.GUILD_VOCAL_CHANNELS_KEY] || []).filter(c => c.channel.type == Internal.DiscordConstants.ChannelTypes.GUILD_VOICE).map(c => c.channel.id);
|
||||
let stageChannels = (channels[Internal.LibraryModules.GuildChannelKeys.GUILD_VOCAL_CHANNELS_KEY] || []).filter(c => c.channel.type == Internal.DiscordConstants.ChannelTypes.GUILD_STAGE_VOICE && Internal.LibraryModules.StageChannelStore.getStageInstanceByChannel(c.channel.id)).map(c => c.channel.id);
|
||||
let streamOwnerIds = Internal.LibraryModules.StreamUtils.getAllApplicationStreams().filter(app => app.guildId === this.props.guild.id).map(app => app.ownerId) || [];
|
||||
let streamOwners = streamOwnerIds.map(ownerId => Internal.LibraryModules.UserStore.getUser(ownerId)).filter(n => n);
|
||||
let connectedVoiceUsers = BDFDB.ObjectUtils.toArray(Internal.LibraryModules.VoiceUtils.getVoiceStates(this.props.guild.id)).map(state => voiceChannels.includes(state.channelId) && state.channelId != this.props.guild.afkChannelId && !streamOwnerIds.includes(state.userId) && Internal.LibraryModules.UserStore.getUser(state.userId)).filter(n => n);
|
||||
let connectedStageUsers = BDFDB.ObjectUtils.toArray(Internal.LibraryModules.VoiceUtils.getVoiceStates(this.props.guild.id)).map(state => stageChannels.includes(state.channelId) && state.channelId != this.props.guild.afkChannelId && !streamOwnerIds.includes(state.userId) && Internal.LibraryModules.UserStore.getUser(state.userId)).filter(n => n);
|
||||
let stageChannels = (channels[Internal.LibraryModules.GuildChannelKeys.GUILD_VOCAL_CHANNELS_KEY] || []).filter(c => c.channel.type == Internal.DiscordConstants.ChannelTypes.GUILD_STAGE_VOICE && Internal.LibraryStores.StageInstanceStore.getStageInstanceByChannel(c.channel.id)).map(c => c.channel.id);
|
||||
let streamOwnerIds = Internal.LibraryStores.ApplicationStreamingStore.getAllApplicationStreams().filter(app => app.guildId === this.props.guild.id).map(app => app.ownerId) || [];
|
||||
let streamOwners = streamOwnerIds.map(ownerId => Internal.LibraryStores.UserStore.getUser(ownerId)).filter(n => n);
|
||||
let connectedVoiceUsers = BDFDB.ObjectUtils.toArray(Internal.LibraryStores.SortedVoiceStateStore.getVoiceStates(this.props.guild.id)).map(state => voiceChannels.includes(state.channelId) && state.channelId != this.props.guild.afkChannelId && !streamOwnerIds.includes(state.userId) && Internal.LibraryStores.UserStore.getUser(state.userId)).filter(n => n);
|
||||
let connectedStageUsers = BDFDB.ObjectUtils.toArray(Internal.LibraryStores.SortedVoiceStateStore.getVoiceStates(this.props.guild.id)).map(state => stageChannels.includes(state.channelId) && state.channelId != this.props.guild.afkChannelId && !streamOwnerIds.includes(state.userId) && Internal.LibraryStores.UserStore.getUser(state.userId)).filter(n => n);
|
||||
let children = [
|
||||
!connectedStageUsers.length ? null : BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN.tooltiprow,
|
||||
|
@ -7109,7 +7109,7 @@ module.exports = (_ => {
|
|||
return BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Flex, {
|
||||
className: this.props.className,
|
||||
wrap: Internal.LibraryComponents.Flex.Wrap.WRAP,
|
||||
children: [this.props.includeDMs && {name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES, acronym: "DMs", id: Internal.DiscordConstants.ME, getIconURL: _ => {}}].concat(Internal.LibraryModules.FolderStore.getFlattenedGuilds()).filter(n => n).map(guild => BDFDB.ReactUtils.createElement(Internal.LibraryComponents.TooltipContainer, {
|
||||
children: [this.props.includeDMs && {name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES, acronym: "DMs", id: Internal.DiscordConstants.ME, getIconURL: _ => {}}].concat(Internal.LibraryStores.SortedGuildStore.getFlattenedGuilds()).filter(n => n).map(guild => BDFDB.ReactUtils.createElement(Internal.LibraryComponents.TooltipContainer, {
|
||||
text: guild.name,
|
||||
children: BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.DOMUtils.formatClassName(this.props.guildClassName, BDFDB.disCN.settingsguild, this.props.disabled.includes(guild.id) && BDFDB.disCN.settingsguilddisabled),
|
||||
|
@ -8020,7 +8020,7 @@ module.exports = (_ => {
|
|||
return BDFDB.ReactUtils.createElement(Internal.LibraryComponents.PopoutContainer, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
|
||||
wrap: false,
|
||||
renderPopout: instance => BDFDB.ReactUtils.createElement(Internal.LibraryComponents.UserPopout, {
|
||||
user: Internal.LibraryModules.UserStore.getUser(this.props.userId),
|
||||
user: Internal.LibraryStores.UserStore.getUser(this.props.userId),
|
||||
userId: this.props.userId,
|
||||
channelId: this.props.channelId,
|
||||
guildId: this.props.guildId
|
||||
|
|
|
@ -73,44 +73,29 @@
|
|||
"AutocompleteSentinels": {"props": ["CHANNEL_SENTINEL", "COMMAND_SENTINEL"]},
|
||||
"BadgeUtils": {"props": ["getBadgeCountString", "getBadgeWidthForValue"]},
|
||||
"BannerUtils": {"props": ["getUserBannerURLForContext"]},
|
||||
"CallUtils": {"props": ["getCalls", "isCallActive"]},
|
||||
"CategoryCollapseUtils": {"props": ["categoryCollapse", "categoryCollapseAll"]},
|
||||
"ChannelIconUtils": {"props": ["getChannelIconComponent", "getChannelIconTooltipText"]},
|
||||
"ChannelUtils": {"props": ["selectChannel", "selectPrivateChannel"]},
|
||||
"ChatRestrictionUtils": {"props": ["applyChatRestrictions"]},
|
||||
"ColorUtils": {"props": ["hex2int", "hex2rgb"]},
|
||||
"ConnectionProviderUtils": {"props": ["get", "isSupported", "filter"]},
|
||||
"ConnectionStore": {"props": ["getAccounts", "getLocalAccounts"]},
|
||||
"ConnectionUtils": {"props": ["setShowActivity", "setVisibility"]},
|
||||
"ContextMenuUtils": {"props": ["closeContextMenu", "openContextMenu"]},
|
||||
"CopyLinkUtils": {"props": ["SUPPORTS_COPY", "copy"]},
|
||||
"CurrentUserStore": {"props": ["getCurrentUser"]},
|
||||
"CurrentVoiceUtils": {"props": ["getAveragePing", "getChannelId"]},
|
||||
"DesktopNotificationUtils": {"props": ["showNotification", "requestPermission"]},
|
||||
"DirectMessageStore": {"props": ["getPrivateChannelIds"]},
|
||||
"DirectMessageUnreadStore": {"props": ["getUnreadPrivateChannelIds"]},
|
||||
"DirectMessageUtils": {"props": ["addRecipient", "openPrivateChannel"]},
|
||||
"DispatchApiUtils": {"props": ["dispatch", "isDispatching"]},
|
||||
"DispatchUtils": {"props": ["ComponentDispatch"]},
|
||||
"EmojiUtils": {"props": ["translateInlineEmojiToSurrogates", "translateSurrogatesToInlineEmoji"]},
|
||||
"EmojiStateUtils": {"props": ["getURL", "isEmojiDisabled"]},
|
||||
"Env": {"props": ["env"]},
|
||||
"FolderSettingsUtils": {"props": ["saveGuildFolders"]},
|
||||
"FolderStore": {"props": ["getGuildFolderById", "getFlattenedGuilds"]},
|
||||
"FolderUtils": {"props": ["isFolderExpanded", "getExpandedFolders"]},
|
||||
"GuildBadgeUtils": {"props": ["renderUnavailableBadge", "renderMediaBadge"]},
|
||||
"GuildBoostUtils": {"props": ["getTierName", "getUserLevel"]},
|
||||
"GuildChannelKeys": {"props": ["GUILD_SELECTABLE_CHANNELS_KEY", "GUILD_VOCAL_CHANNELS_KEY"]},
|
||||
"GuildChannelStore": {"props": ["getChannels", "getDefaultChannel"]},
|
||||
"GuildEmojiStore": {"props": ["getGuildEmoji", "getDisambiguatedEmojiContext"]},
|
||||
"GuildEventStore": {"props": ["getGuildScheduledEventsForGuild", "getGuildScheduledEvent"]},
|
||||
"GuildNotificationsUtils": {"props": ["updateChannelOverrideSettings", "updateGuildNotificationSettings"]},
|
||||
"GuildSettingsUtils": {"props": ["open", "updateGuild"]},
|
||||
"GuildStore": {"props": ["getGuild", "getGuilds"]},
|
||||
"GuildUnavailableStore": {"props": ["isUnavailable", "totalUnavailableGuilds"]},
|
||||
"GuildUtils": {"props": ["selectGuild", "transitionToGuildSync"]},
|
||||
"GuildWelcomeStore": {"props": ["hasSeen", "get"]},
|
||||
"GuildWelcomeUtils": {"props": ["welcomeScreenViewed", "resetWelcomeScreen"]},
|
||||
"HistoryUtils": {"props": ["transitionTo", "replaceWith", "getHistory"]},
|
||||
"IconUtils": {"props": ["getGuildIconURL", "getGuildBannerURL"]},
|
||||
"ImageEditUtils": {"props": ["getPrimaryColorForAvatar", "getRatio"]},
|
||||
|
@ -118,88 +103,61 @@
|
|||
"InviteUtils": {"props": ["acceptInvite", "createInvite"]},
|
||||
"KeyCodeUtils": {"props": ["toCombo", "keyToCode"], "assign": true},
|
||||
"KeyEvents": {"props": ["aliases", "code", "codes"]},
|
||||
"LastChannelStore": {"props": ["getLastSelectedChannelId"]},
|
||||
"LastGuildStore": {"props": ["getLastSelectedGuildId"]},
|
||||
"LinkUtils": {"props": ["handleClick", "isLinkTrusted"]},
|
||||
"LocalSettingsStore": {"props": ["darkSidebar", "keyboardModeEnabled"]},
|
||||
"LoginUtils": {"props": ["login", "logout"]},
|
||||
"MediaComponentUtils": {"props": ["renderImageComponent", "renderAudioComponent"]},
|
||||
"MediaDeviceSetUtils": {"props": ["setOutputDevice", "setInputDevice"]},
|
||||
"MediaDeviceUtils": {"props": ["getOutputDevices", "getInputDevices"]},
|
||||
"MediaEngineUtils": {"props": ["setOutputDevice", "setInputDevice"]},
|
||||
"MemberDisplayUtils": {"props": ["getDisplayProfile"]},
|
||||
"MemberCountUtils": {"props": ["getMemberCount", "getMemberCounts"]},
|
||||
"MemberStore": {"props": ["getMember", "getMembers"]},
|
||||
"MentionUtils": {"props": ["isRawMessageMentioned", "isMentioned"]},
|
||||
"MessageAuthorUtils": {"props": ["getMessageAuthor", "useNullableMessageAuthor"]},
|
||||
"MessageManageUtils": {"props": ["copyLink", "replyToMessage"]},
|
||||
"MessageParser": {"props": ["parseEmbedTitle", "defaultRules"]},
|
||||
"MessagePinUtils": {"props": ["pinMessage", "unpinMessage"]},
|
||||
"MessageReplyStore": {"props": ["getPendingReply"]},
|
||||
"MessageReplyUtils": {"props": ["createPendingReply", "deletePendingReply"]},
|
||||
"MessageStore": {"props": ["getMessage", "getMessages"]},
|
||||
"MessageUtils": {"props": ["receiveMessage", "editMessage"]},
|
||||
"ModalUtils": {"props": ["openModal", "hasModalOpen"]},
|
||||
"MutedUtils": {"props": ["isGuildOrCategoryOrChannelMuted"]},
|
||||
"NitroUtils": {"props": ["canUseIncreasedMessageLength", "canUploadAnimatedAvatar"]},
|
||||
"NoteStore": {"props": ["getNote"]},
|
||||
"NotificationSettingsStore": {"props": ["getDesktopType", "getTTSType"]},
|
||||
"NotificationSettingsUtils": {"props": ["setDesktopType", "setTTSType"]},
|
||||
"NotificationUtils": {"props": ["makeTextChatNotification", "shouldNotify"]},
|
||||
"PlatformUtils": {"props": ["isWindows", "isLinux"]},
|
||||
"PendingReplyUtils": {"props": ["createPendingReply", "deletePendingReply"]},
|
||||
"PermissionRoleUtils": {"props": ["can", "ALLOW", "DENY"]},
|
||||
"PermissionUtils": {"props": ["getChannelPermissions", "can"]},
|
||||
"PreferencesContext": {"props": ["AccessibilityPreferencesContext"]},
|
||||
"PremiumConstants": {"props": ["PremiumTypes", "BoostedGuildFeatures"]},
|
||||
"PrivateChannelUtils": {"props": ["addRecipient", "openPrivateChannel"]},
|
||||
"QuerySearchUtils": {"props": ["queryGuilds", "queryGroupDMs"]},
|
||||
"QueryUtils": {"props": ["AutocompleterQuerySymbols", "AutocompleterResultTypes"]},
|
||||
"ReactionEmojiUtils": {"props": ["getReactionEmojiName", "getReactionEmojiName"]},
|
||||
"ReactionUtils": {"props": ["addReaction", "removeReaction"]},
|
||||
"RecentMentionUtils": {"props": ["deleteRecentMention", "fetchRecentMentions"]},
|
||||
"RelationshipStore": {"props": ["getFriendIDs", "getRelationships"]},
|
||||
"RelationshipSuggestionUtils": {"props": ["getSuggestionCount", "getSuggestions"]},
|
||||
"RelationshipUtils": {"props": ["addRelationship", "removeRelationship"]},
|
||||
"FriendUtils": {"props": ["getFriendIDs", "getRelationships"]},
|
||||
"RoleIconUtils": {"props": ["getRoleIconData"]},
|
||||
"SearchPageUtils": {"props": ["searchNextPage", "searchPreviousPage"]},
|
||||
"SettingsUtils": {"props": ["ShowCurrentGame", "DeveloperMode"]},
|
||||
"SimpleMarkdownComponents": {"strings": ["customEmoji", "emojiTooltipPosition", "timestampTooltip"]},
|
||||
"SimpleMarkdownParser": {"props": ["parseBlock", "parseInline", "defaultOutput"]},
|
||||
"SlateDraftUtils": {"props": ["getRecentlyEditedDrafts", "getDraft"]},
|
||||
"SlateRichUtils": {"props": ["toRichValue", "createEmptyState"]},
|
||||
"SlateTextUtils": {"props": ["toTextValue", "serializeDescendant"]},
|
||||
"SlowmodeUtils": {"props": ["getSlowmodeCooldownGuess"]},
|
||||
"SoundParser": {"strings": ["discodo", "ddr-down", "mute"]},
|
||||
"SoundStateUtils": {"props": ["isSoundDisabled", "getDisabledSounds"]},
|
||||
"SoundUtils": {"props": ["playSound", "createSound"]},
|
||||
"SpotifyTrackUtils": {"props": ["hasConnectedAccount", "getLastPlayedTrackId"]},
|
||||
"SpotifyUtils": {"props": ["setActiveDevice", "pause"]},
|
||||
"StageChannelLiveStore": {"props": ["getAllLiveStageChannels", "useAllLiveStageChannels"]},
|
||||
"StageChannelStore": {"props": ["getStageInstanceByChannel", "getAllStageInstances"]},
|
||||
"StageChannelUtils": {"props": ["getMutableParticipants", "getParticipantCount"]},
|
||||
"StateStoreUtils": {"props": ["useStateFromStores", "useStateFromStoresArray"]},
|
||||
"StatusMetaUtils": {"props": ["getApplicationActivity", "getStatus", "getState"]},
|
||||
"StoreChangeUtils": {"props": ["get", "set", "clear", "remove"]},
|
||||
"StreamUtils": {"props": ["getActiveStreamForUser", "getAllApplicationStreams"]},
|
||||
"TimestampUtils": {"props": ["fromTimestamp", "extractTimestamp"]},
|
||||
"TimeUtils": {"props": ["calendarFormat", "dateFormat"]},
|
||||
"ThemeSettingsStore": {"props": ["theme"]},
|
||||
"ThreadConfigStore": {"props": ["hasJoined", "isMuted"]},
|
||||
"UnreadGuildUtils": {"props": ["hasUnread", "getTotalMentionCount"]},
|
||||
"UnreadChannelUtils": {"props": ["getUnreadCount", "getOldestUnreadMessageId"]},
|
||||
"UnreadStateTypes": {"props": ["ReadStateTypes"], "value": "ReadStateTypes"},
|
||||
"UploadUtils": {"props": ["upload", "instantBatchUpload"]},
|
||||
"URLParser": {"props": ["parse", "resolveObject"]},
|
||||
"UserBadgeKeys": {"props": ["BadgeKeys"], "value": "BadgeKeys"},
|
||||
"UserBioParser": {"props": ["parseBioReact"]},
|
||||
"UserFetchUtils": {"props": ["fetchCurrentUser", "getUser"]},
|
||||
"UserNameUtils": {"props": ["getName", "getNickname"]},
|
||||
"UserProfileModalUtils": {"props": ["openUserProfileModal", "closeUserProfileModal"]},
|
||||
"UserProfileUtils": {"props": ["fetchMutualFriends", "fetchProfile"]},
|
||||
"UserSettingsUtils": {"props": ["open", "updateAccount"]},
|
||||
"UserStore": {"props": ["getUser", "getUsers"]},
|
||||
"Utilities": {"props": ["flatMap", "cloneDeep"]},
|
||||
"VoiceChannelUtils": {"props": ["isFullscreenInContext", "getParticipants"]},
|
||||
"VoiceUtils": {"props": ["getAllVoiceStates", "getVoiceStatesForChannel"]},
|
||||
"WindowUtils": {"props": ["minimize", "maximize", "close"]},
|
||||
"ZoomUtils": {"props": ["setZoom", "setFontSize"]}
|
||||
},
|
||||
|
|
|
@ -180,7 +180,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onUserContextMenu (e) {
|
||||
if (e.instance.props.user && e.subType == "useUserRelationshipItems" && BDFDB.LibraryModules.RelationshipStore.isFriend(e.instance.props.user.id)) {
|
||||
if (e.instance.props.user && e.subType == "useUserRelationshipItems" && BDFDB.LibraryStores.RelationshipStore.isFriend(e.instance.props.user.id)) {
|
||||
let favorized = favorizedFriends.indexOf(e.instance.props.user.id) > -1;
|
||||
let hidden = hiddenFriends.indexOf(e.instance.props.user.id) > -1;
|
||||
e.returnvalue.push(this.settings.general.addFavorizedCategory && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
|
@ -233,7 +233,7 @@ module.exports = (_ => {
|
|||
}
|
||||
else {
|
||||
if (this.settings.general.addTotalAmount) {
|
||||
let relationships = BDFDB.LibraryModules.RelationshipStore.getRelationships(), relationshipCount = {};
|
||||
let relationships = BDFDB.LibraryStores.RelationshipStore.getRelationships(), relationshipCount = {};
|
||||
for (let type in BDFDB.DiscordConstants.RelationshipTypes) relationshipCount[type] = 0;
|
||||
for (let id in relationships) if (!this.settings.general.addHiddenCategory || (hiddenFriends.indexOf(id) == -1 || relationships[id] != BDFDB.DiscordConstants.RelationshipTypes.FRIEND)) relationshipCount[relationships[id]]++;
|
||||
for (let child of e.returnvalue.props.children) if (child && child.props.id != BDFDB.DiscordConstants.FriendsSections.ADD_FRIEND) {
|
||||
|
@ -246,7 +246,7 @@ module.exports = (_ => {
|
|||
newChildren.push(this.createBadge(favorizedFriends.filter(id => relationships[id] == BDFDB.DiscordConstants.RelationshipTypes.FRIEND).length));
|
||||
break;
|
||||
case BDFDB.DiscordConstants.FriendsSections.ONLINE:
|
||||
newChildren.push(this.createBadge(Object.entries(relationships).filter(n => n[1] == BDFDB.DiscordConstants.RelationshipTypes.FRIEND && !(this.settings.general.addHiddenCategory && hiddenFriends.indexOf(n[0]) > -1) && BDFDB.LibraryModules.StatusMetaUtils.getStatus(n[0]) != BDFDB.DiscordConstants.StatusTypes.OFFLINE).length));
|
||||
newChildren.push(this.createBadge(Object.entries(relationships).filter(n => n[1] == BDFDB.DiscordConstants.RelationshipTypes.FRIEND && !(this.settings.general.addHiddenCategory && hiddenFriends.indexOf(n[0]) > -1) && BDFDB.LibraryStores.PresenceStore.getStatus(n[0]) != BDFDB.DiscordConstants.StatusTypes.OFFLINE).length));
|
||||
break;
|
||||
case BDFDB.DiscordConstants.FriendsSections.PENDING:
|
||||
newChildren.push(this.createBadge(relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.PENDING_INCOMING], this.labels.incoming, relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.PENDING_INCOMING] > 0));
|
||||
|
|
|
@ -216,7 +216,7 @@ module.exports = (_ => {
|
|||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._charcountercounter, type && BDFDB.DiscordClasses[`_charcounter${typeMap[type] || type}counter`] && BDFDB.disCN[`_charcounter${typeMap[type] || type}counter`]),
|
||||
refClass: refClass,
|
||||
parsing: parsing,
|
||||
max: maxLengths[type] || (BDFDB.LibraryModules.NitroUtils.canUseIncreasedMessageLength(BDFDB.LibraryModules.UserStore.getCurrentUser()) ? BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH_PREMIUM : BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH),
|
||||
max: maxLengths[type] || (BDFDB.LibraryModules.NitroUtils.canUseIncreasedMessageLength(BDFDB.LibraryStores.UserStore.getCurrentUser()) ? BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH_PREMIUM : BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH),
|
||||
showPercentage: this.settings.sliders.showPercentage,
|
||||
onChange: instance => {
|
||||
let node = BDFDB.ReactUtils.findDOMNode(instance);
|
||||
|
|
|
@ -381,7 +381,7 @@ module.exports = (_ => {
|
|||
|
||||
processChannelTextAreaForm (e) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {before: e2 => {
|
||||
if (!this.settings.places.normal || !this.settings.general.replaceBeforeSend || BDFDB.LibraryModules.SlowmodeUtils.getSlowmodeCooldownGuess(e.instance.props.channel.id) > 0) return;
|
||||
if (!this.settings.places.normal || !this.settings.general.replaceBeforeSend || BDFDB.LibraryStores.SlowmodeStore.getSlowmodeCooldownGuess(e.instance.props.channel.id) > 0) return;
|
||||
let messageData = this.formatText(e2.methodArguments[0].value);
|
||||
if (messageData) {
|
||||
if (messageData.text != null && e2.methodArguments[0].value != messageData.text) {
|
||||
|
@ -400,7 +400,7 @@ module.exports = (_ => {
|
|||
|
||||
processMessageEditor (e) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance, "onSubmit", {before: e2 => {
|
||||
if (!this.settings.places.edit || !this.settings.general.replaceBeforeSend || BDFDB.LibraryModules.SlowmodeUtils.getSlowmodeCooldownGuess(e.instance.props.channel.id) > 0) return;
|
||||
if (!this.settings.places.edit || !this.settings.general.replaceBeforeSend || BDFDB.LibraryStores.SlowmodeStore.getSlowmodeCooldownGuess(e.instance.props.channel.id) > 0) return;
|
||||
let messageData = this.formatText(e2.methodArguments[0]);
|
||||
if (messageData && messageData.text != null && e2.methodArguments[0] != messageData.text) {
|
||||
e2.methodArguments[0] = messageData.text;
|
||||
|
|
|
@ -111,13 +111,13 @@ module.exports = (_ => {
|
|||
words = BDFDB.DataUtils.load(this, "words");
|
||||
for (let rType in this.defaults.replaces) if (!BDFDB.ObjectUtils.is(words[rType])) words[rType] = {};
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.StatusMetaUtils, "findActivity", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.PresenceStore, "findActivity", {after: e => {
|
||||
if (this.settings.general.targetStatuses && e.returnValue && e.returnValue.state && e.returnValue.type === BDFDB.DiscordConstants.ActivityTypes.CUSTOM_STATUS) {
|
||||
let {content} = this.parseMessage({
|
||||
content: e.returnValue.state,
|
||||
embeds: [],
|
||||
id: "status",
|
||||
author: BDFDB.LibraryModules.UserStore.getUser(e.methodArguments[0])
|
||||
author: BDFDB.LibraryStores.UserStore.getUser(e.methodArguments[0])
|
||||
});
|
||||
if (content) return Object.assign({}, e.returnValue, {state: content});
|
||||
else if (!e.returnValue.emoji) return null;
|
||||
|
|
|
@ -81,7 +81,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processRichUserMention (e) {
|
||||
if (e.instance.props.id && BDFDB.LibraryModules.UserStore.getUser(e.instance.props.id)) return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.UserMention, {
|
||||
if (e.instance.props.id && BDFDB.LibraryStores.UserStore.getUser(e.instance.props.id)) return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.UserMention, {
|
||||
className: "mention",
|
||||
userId: e.instance.props.id,
|
||||
channelId: e.instance.props.channelId,
|
||||
|
@ -96,7 +96,7 @@ module.exports = (_ => {
|
|||
let channelId = e.instance.props.channelId;
|
||||
if (!channelId) {
|
||||
let currentChannelId = BDFDB.LibraryModules.LastChannelStore.getChannelId();
|
||||
channelId = BDFDB.LibraryModules.GuildChannelStore.getSelectableChannelIds(guild.id).indexOf(currentChannelId) > -1 ? currentChannelId : BDFDB.LibraryModules.GuildChannelStore.getDefaultChannel(guild.id).id;
|
||||
channelId = BDFDB.LibraryStores.GuildChannelStore.getSelectableChannelIds(guild.id).indexOf(currentChannelId) > -1 ? currentChannelId : BDFDB.LibraryStores.GuildChannelStore.getDefaultChannel(guild.id).id;
|
||||
}
|
||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.RoleMention, {
|
||||
type: "mention_textarea",
|
||||
|
|
|
@ -383,7 +383,7 @@ module.exports = (_ => {
|
|||
let quoteFormat = formats[choice] || formats.Standard || "";
|
||||
|
||||
let guild = channel.guild_id ? (BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id) || {id: channel.guild_id, name: "Test Server"}) : {id: BDFDB.DiscordConstants.ME, name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES};
|
||||
let member = guild && BDFDB.LibraryModules.MemberStore.getMember(guild.id, message.author.id);
|
||||
let member = guild && BDFDB.LibraryStores.GuildMemberStore.getMember(guild.id, message.author.id);
|
||||
|
||||
let content = message.content;
|
||||
let selectedText = document.getSelection().toString().trim();
|
||||
|
@ -391,9 +391,9 @@ module.exports = (_ => {
|
|||
if (content) {
|
||||
content = content.replace(/(@everyone|@here)/g, "`$1`").replace(/``(@everyone|@here)``/g, "`$1`");
|
||||
content = content.replace(/<@[!&]{0,1}([0-9]{10,})>/g, (string, match) => {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(match);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(match);
|
||||
if (user) {
|
||||
let userMember = channel.guild_id && BDFDB.LibraryModules.MemberStore.getMember(guild.id, match);
|
||||
let userMember = channel.guild_id && BDFDB.LibraryStores.GuildMemberStore.getMember(guild.id, match);
|
||||
return `@ ${userMember && userMember.nick || user.username}`;
|
||||
}
|
||||
else if (channel.guild_id && guild.roles[match] && guild.roles[match].name) return `${guild.roles[match].name.indexOf("@") == 0 ? "" : "@"} ${guild.roles[match].name}`;
|
||||
|
|
|
@ -161,7 +161,7 @@ module.exports = (_ => {
|
|||
if (favoritesIndex > -1) favoritesChildren[favoritesIndex] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Favorites, {});
|
||||
let [errorChildren, errorIndex] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "FluxContainer(<Unknown>)"});
|
||||
if (errorIndex > -1) errorChildren[errorIndex] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.UnavailableGuildsButton, {
|
||||
unavailableGuilds: BDFDB.LibraryModules.GuildUnavailableStore.totalUnavailableGuilds
|
||||
unavailableGuilds: BDFDB.LibraryStores.GuildAvailabilityStore.totalUnavailableGuilds
|
||||
});
|
||||
let scroller = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildsscroller]]});
|
||||
if (scroller) {
|
||||
|
@ -184,7 +184,7 @@ module.exports = (_ => {
|
|||
|
||||
processDirectMessage (e) {
|
||||
if (e.instance.props.channel.id) {
|
||||
if (e.returnvalue.props.children && e.returnvalue.props.children.props) e.returnvalue.props.children.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.children.props.className, BDFDB.LibraryModules.MutedUtils.isChannelMuted(null, e.instance.props.channel.id) && BDFDB.disCN._displayserversaschannelsmuted);
|
||||
if (e.returnvalue.props.children && e.returnvalue.props.children.props) e.returnvalue.props.children.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.children.props.className, BDFDB.LibraryStores.UserGuildSettingsStore.isChannelMuted(null, e.instance.props.channel.id) && BDFDB.disCN._displayserversaschannelsmuted);
|
||||
let text = BDFDB.ReactUtils.findValue(e.returnvalue, "text");
|
||||
this.removeTooltip(e.returnvalue);
|
||||
e.returnvalue = this.removeMask(e.returnvalue);
|
||||
|
@ -196,7 +196,7 @@ module.exports = (_ => {
|
|||
|
||||
processGuildItem (e) {
|
||||
if (e.instance.props.guild) {
|
||||
e.returnvalue.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.className, BDFDB.LibraryModules.MutedUtils.isMuted(e.instance.props.guild.id) && BDFDB.disCN._displayserversaschannelsmuted);
|
||||
e.returnvalue.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.className, BDFDB.LibraryStores.UserGuildSettingsStore.isMuted(e.instance.props.guild.id) && BDFDB.disCN._displayserversaschannelsmuted);
|
||||
if (!BDFDB.BDUtils.isPluginEnabled("ServerDetails")) this.removeTooltip(e.returnvalue, e.instance.props.guild);
|
||||
e.returnvalue = this.removeMask(e.returnvalue);
|
||||
this.addElementName(e.returnvalue, e.instance.props.guild.name, {
|
||||
|
|
|
@ -137,7 +137,7 @@ module.exports = (_ => {
|
|||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, "queryChannels", {after: e => {
|
||||
if (!e.methodArguments[0].query) return;
|
||||
for (let id of BDFDB.LibraryModules.FolderStore.getFlattenedGuildIds().map(id => Object.keys(BDFDB.LibraryStores.ChannelStore.getMutableGuildChannelsForGuild(id))).flat()) {
|
||||
for (let id of BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds().map(id => Object.keys(BDFDB.LibraryStores.ChannelStore.getMutableGuildChannelsForGuild(id))).flat()) {
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(id);
|
||||
if (channel && !channel.isCategory()) {
|
||||
let category = channel.parent_id && BDFDB.LibraryStores.ChannelStore.getChannel(channel.parent_id);
|
||||
|
@ -433,7 +433,7 @@ module.exports = (_ => {
|
|||
channelId = (BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id") || "").split("___").pop();
|
||||
nameClass = BDFDB.disCN.categoryname;
|
||||
iconClass = BDFDB.disCN.categoryicon;
|
||||
modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
||||
modify = {muted: BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), channelId)};
|
||||
}
|
||||
else if (this.settings.places.searchPopout && e.returnvalue.props.className.indexOf(BDFDB.disCN.searchpopoutoption) > -1) {
|
||||
change = true;
|
||||
|
@ -655,8 +655,8 @@ module.exports = (_ => {
|
|||
const checkChild = label => {
|
||||
if (label[0] != "#") return;
|
||||
let channelName = label.slice(1);
|
||||
let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
let channels = guildId && [].concat(BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId).SELECTABLE, Object.keys(BDFDB.LibraryStores.ActiveThreadsStore.getThreadsForGuild(guildId)).map(id => ({channel: BDFDB.LibraryStores.ChannelStore.getChannel(id)})));
|
||||
let guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
let channels = guildId && [].concat(BDFDB.LibraryStores.GuildChannelStore.getChannels(guildId).SELECTABLE, Object.keys(BDFDB.LibraryStores.ActiveThreadsStore.getThreadsForGuild(guildId)).map(id => ({channel: BDFDB.LibraryStores.ChannelStore.getChannel(id)})));
|
||||
if (BDFDB.ArrayUtils.is(channels)) for (let channelObj of channels) {
|
||||
if (channelName == channelObj.channel.name) {
|
||||
let category = BDFDB.LibraryStores.ChannelStore.getChannel(channelObj.channel.parent_id);
|
||||
|
@ -810,7 +810,7 @@ module.exports = (_ => {
|
|||
getGroupName (channelId) {
|
||||
let channel = this.getChannelData(channelId);
|
||||
if (channel.name) return channel.name;
|
||||
let recipients = channel.recipients.map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n);
|
||||
let recipients = channel.recipients.map(BDFDB.LibraryStores.UserStore.getUser).filter(n => n);
|
||||
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ module.exports = (_ => {
|
|||
});
|
||||
}
|
||||
}});
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MemberStore, "getMember", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.GuildMemberStore, "getMember", {after: e => {
|
||||
if (e.returnValue) {
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(e.methodArguments[0]);
|
||||
if (guild) {
|
||||
|
@ -257,7 +257,7 @@ module.exports = (_ => {
|
|||
|
||||
processMemberListItem (e) {
|
||||
if (e.instance.props.user) {
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(e.instance.props.guildId, e.instance.props.user.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember(e.instance.props.guildId, e.instance.props.user.id);
|
||||
if (member) e.instance.props.colorString = member.colorString;
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getGuildFromRoleId (roleId) {
|
||||
return BDFDB.LibraryModules.FolderStore.getFlattenedGuilds().find(g => g.roles[roleId]);
|
||||
return BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuilds().find(g => g.roles[roleId]);
|
||||
}
|
||||
|
||||
changeRolesInGuild (guild, useNative) {
|
||||
|
@ -300,7 +300,7 @@ module.exports = (_ => {
|
|||
BDFDB.DataUtils.remove(this, "roles", id);
|
||||
}
|
||||
else {
|
||||
for (let guild of BDFDB.LibraryModules.FolderStore.getFlattenedGuilds()) if (cachedRoles[guild.id]) guild.roles = cachedRoles[guild.id];
|
||||
for (let guild of BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuilds()) if (cachedRoles[guild.id]) guild.roles = cachedRoles[guild.id];
|
||||
cachedRoles = {};
|
||||
BDFDB.DataUtils.remove(this, "roles");
|
||||
}
|
||||
|
|
|
@ -204,11 +204,11 @@ module.exports = (_ => {
|
|||
let observer = new MutationObserver(_ => {this.changeAppTitle();});
|
||||
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UserNameUtils, "getName", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.RelationshipStore, "getName", {after: e => {
|
||||
if (e.methodArguments[2] && changedUsers[e.methodArguments[2].id] && changedUsers[e.methodArguments[2].id].name) return changedUsers[e.methodArguments[2].id].name;
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.StageChannelUtils, "getMutableParticipants", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.StageChannelParticipantStore, "getMutableParticipants", {after: e => {
|
||||
if (BDFDB.ArrayUtils.is(e.returnValue)) for (let i in e.returnValue) {
|
||||
if (e.returnValue[i] && e.returnValue[i].user && changedUsers[e.returnValue[i].user.id]) e.returnValue[i] = Object.assign({}, e.returnValue[i], {user: this.getUserData(e.returnValue[i].user.id)});
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ module.exports = (_ => {
|
|||
if (this.settings.places.chatWindow && e.methodArguments[0] && e.methodArguments[0].author && changedUsers[e.methodArguments[0].author.id] && this.shouldChangeInChat(e.methodArguments[0].channel_id)) {
|
||||
let data = changedUsers[e.methodArguments[0].author.id];
|
||||
if (data) {
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.methodArguments[0].channel_id) || {}).guild_id, e.methodArguments[0].author.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.methodArguments[0].channel_id) || {}).guild_id, e.methodArguments[0].author.id);
|
||||
let color1 = data.color1 && data.useRoleColor && member && member.colorString || data.color1;
|
||||
color1 = color1 && BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color1) ? color1[0] : color1, "HEX");
|
||||
e.returnValue = Object.assign({}, e.returnValue, {
|
||||
|
@ -257,7 +257,7 @@ module.exports = (_ => {
|
|||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, ["queryDMUsers", "queryFriends"], {after: e => {
|
||||
if (!e.methodArguments[0].query) return;
|
||||
for (let id in changedUsers) if (changedUsers[id] && changedUsers[id].name && changedUsers[id].name.toLocaleLowerCase().indexOf(e.methodArguments[0].query.toLocaleLowerCase()) > -1 && !e.returnValue.find(n => n.record && n.record.id == id && n.type == BDFDB.LibraryModules.QueryUtils.AutocompleterResultTypes.USER)) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(id);
|
||||
if (user) e.returnValue.push({
|
||||
comparator: user.username,
|
||||
record: user,
|
||||
|
@ -270,8 +270,8 @@ module.exports = (_ => {
|
|||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, "queryGuildUsers", {after: e => {
|
||||
if (!e.methodArguments[0].query) return;
|
||||
for (let id in changedUsers) if (changedUsers[id] && changedUsers[id].name && changedUsers[id].name.toLocaleLowerCase().indexOf(e.methodArguments[0].query.toLocaleLowerCase()) > -1 && !e.returnValue.find(n => n.record && n.record.id == id && n.type == BDFDB.LibraryModules.QueryUtils.AutocompleterResultTypes.USER)) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let member = user && e.methodArguments[0].guildId && BDFDB.LibraryModules.MemberStore.getMember(e.methodArguments[0].guildId, id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(id);
|
||||
let member = user && e.methodArguments[0].guildId && BDFDB.LibraryStores.GuildMemberStore.getMember(e.methodArguments[0].guildId, id);
|
||||
if (user) e.returnValue.push({
|
||||
comparator: member && member.nick ? member.nick.toLocaleLowerCase() : user.username.toLocaleLowerCase(),
|
||||
record: user,
|
||||
|
@ -283,8 +283,8 @@ module.exports = (_ => {
|
|||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, "queryChannelUsers", {after: e => {
|
||||
if (!e.methodArguments[0].query) return;
|
||||
for (let id in changedUsers) if (changedUsers[id] && changedUsers[id].name && changedUsers[id].name.toLocaleLowerCase().indexOf(e.methodArguments[0].query.toLocaleLowerCase()) > -1 && !e.returnValue.find(n => n.record && n.record.id == id && n.type == BDFDB.LibraryModules.QueryUtils.AutocompleterResultTypes.USER)) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let member = user && e.methodArguments[0].channelId && BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.methodArguments[0].channelId) || {}).guild_id, id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(id);
|
||||
let member = user && e.methodArguments[0].channelId && BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.methodArguments[0].channelId) || {}).guild_id, id);
|
||||
if (user) e.returnValue.push({
|
||||
comparator: member && member.nick ? member.nick.toLocaleLowerCase() : user.username.toLocaleLowerCase(),
|
||||
record: user,
|
||||
|
@ -313,7 +313,7 @@ module.exports = (_ => {
|
|||
}
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.StatusMetaUtils, "findActivity", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.PresenceStore, "findActivity", {after: e => {
|
||||
let data = changedUsers[e.methodArguments[0]];
|
||||
if (data && (data.removeStatus || data.status || data.statusEmoji) && (e.returnValue && e.returnValue.type === BDFDB.DiscordConstants.ActivityTypes.CUSTOM_STATUS || !e.returnValue && e.methodArguments[1] && e.methodArguments[1].toString().indexOf("type===") > -1 && e.methodArguments[1].toString().indexOf("CUSTOM_STATUS") > -1)) return this.createCustomStatus(changedUsers[e.methodArguments[0]]);
|
||||
}});
|
||||
|
@ -361,13 +361,13 @@ module.exports = (_ => {
|
|||
type: "Button",
|
||||
color: BDFDB.LibraryComponents.Button.Colors.RED,
|
||||
label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
|
||||
children: !Object.keys(changedUsers).length ? BDFDB.LanguageUtils.LanguageStrings.NONE : Object.keys(changedUsers).filter(BDFDB.LibraryModules.UserStore.getUser).map(id => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||
children: !Object.keys(changedUsers).length ? BDFDB.LanguageUtils.LanguageStrings.NONE : Object.keys(changedUsers).filter(BDFDB.LibraryStores.UserStore.getUser).map(id => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||
text: this.getUserData(id).username,
|
||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.AvatarComponents.default, {
|
||||
className: BDFDB.disCN.listavatar,
|
||||
src: this.getUserAvatar(id),
|
||||
size: BDFDB.LibraryComponents.AvatarComponents.Sizes.SIZE_32,
|
||||
onClick: _ => this.openUserSettingsModal(BDFDB.LibraryModules.UserStore.getUser(id))
|
||||
onClick: _ => this.openUserSettingsModal(BDFDB.LibraryStores.UserStore.getUser(id))
|
||||
})
|
||||
}))
|
||||
}),
|
||||
|
@ -421,7 +421,7 @@ module.exports = (_ => {
|
|||
|
||||
onUserContextMenu (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isDM()) {
|
||||
const user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.getRecipientId());
|
||||
const user = BDFDB.LibraryStores.UserStore.getUser(e.instance.props.channel.getRecipientId());
|
||||
if (user && this.settings.places.contextMenu && e.subType == "useMuteChannelItem") {
|
||||
let userName = this.getUserData(user.id).username;
|
||||
if (userName != user.username) {
|
||||
|
@ -485,7 +485,7 @@ module.exports = (_ => {
|
|||
|
||||
processChannelEditorContainer (e) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && e.instance.props.channel.isDM() && (e.instance.props.type == BDFDB.LibraryComponents.ChannelTextAreaTypes.NORMAL || e.instance.props.type == BDFDB.LibraryComponents.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY) && this.settings.places.chatTextarea) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.recipients[0]);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(e.instance.props.channel.recipients[0]);
|
||||
if (user) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `@${changedUsers[user.id] && changedUsers[user.id].name || user.username}`);
|
||||
}
|
||||
}
|
||||
|
@ -547,12 +547,12 @@ module.exports = (_ => {
|
|||
if (e.instance.props.className) {
|
||||
if (e.instance.props.className.indexOf(BDFDB.disCN.userpopoutheadertagnonickname) > -1) {
|
||||
change = this.settings.places.userPopout;
|
||||
guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
tagClass = BDFDB.disCNS.userpopoutheaderbottag + BDFDB.disCN.bottagnametag;
|
||||
}
|
||||
else if (e.instance.props.className.indexOf(BDFDB.disCN.userpopoutusernametagnonickname) > -1) {
|
||||
change = this.settings.places.userPopout;
|
||||
guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
tagClass = BDFDB.disCNS.userpopoutusernamebottag + BDFDB.disCN.bottagnametag;
|
||||
}
|
||||
else if (e.instance.props.className.indexOf(BDFDB.disCN.guildsettingsinviteusername) > -1) {
|
||||
|
@ -565,11 +565,11 @@ module.exports = (_ => {
|
|||
}
|
||||
if (e.instance.props.usernameClass) {
|
||||
if (e.instance.props.usernameClass.indexOf(BDFDB.disCN.messagereactionsmodalusername) > -1) {
|
||||
change = this.settings.places.reactions && !BDFDB.LibraryModules.MemberStore.getNick(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id);
|
||||
change = this.settings.places.reactions && !BDFDB.LibraryStores.GuildMemberStore.getNick(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), e.instance.props.user.id);
|
||||
}
|
||||
else if (e.instance.props.usernameClass.indexOf(BDFDB.disCN.userprofileusername) > -1) {
|
||||
change = this.settings.places.userProfile;
|
||||
guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
tagClass = BDFDB.disCNS.userprofilebottag + BDFDB.disCN.bottagnametag;
|
||||
}
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ module.exports = (_ => {
|
|||
if (index > -1) {
|
||||
this.changeUserColor(children[index], e.instance.props.user.id);
|
||||
if (!BDFDB.ArrayUtils.is(children[index].props.children)) children[index].props.children = [children[index].props.children].flat(10);
|
||||
this.injectBadge(children[index].props.children, e.instance.props.user.id, BDFDB.LibraryModules.LastGuildStore.getGuildId(), 2, {
|
||||
this.injectBadge(children[index].props.children, e.instance.props.user.id, BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), 2, {
|
||||
tagClass: BDFDB.disCNS.userpopoutheaderbottag + BDFDB.disCN.bottagnametag,
|
||||
inverted: typeof e.instance.getMode == "function" && e.instance.getMode() !== "Normal"
|
||||
});
|
||||
|
@ -686,7 +686,7 @@ module.exports = (_ => {
|
|||
if (index > -1) {
|
||||
this.changeUserColor(children[index], e.instance.props.user.id);
|
||||
if (!BDFDB.ArrayUtils.is(children[index].props.children)) children[index].props.children = [children[index].props.children].flat(10);
|
||||
this.injectBadge(children[index].props.children, e.instance.props.user.id, BDFDB.LibraryModules.LastGuildStore.getGuildId(), 2, {
|
||||
this.injectBadge(children[index].props.children, e.instance.props.user.id, BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), 2, {
|
||||
tagClass: BDFDB.disCNS.userpopoutheaderbottag + BDFDB.disCN.bottagnametag,
|
||||
inverted: typeof e.instance.getMode == "function" && e.instance.getMode() !== "Normal"
|
||||
});
|
||||
|
@ -754,7 +754,7 @@ module.exports = (_ => {
|
|||
e.instance.props.user = this.getUserData(e.instance.props.user.id);
|
||||
let data = changedUsers[e.instance.props.user.id];
|
||||
if (data && data.name) {
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), e.instance.props.user.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), e.instance.props.user.id);
|
||||
e.instance.props.nick = this.getUserNick(e.instance.props.user.id, e.instance.props.nick) || e.instance.props.nick;
|
||||
}
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ module.exports = (_ => {
|
|||
if (header && header.props && header.props.message && this.shouldChangeInChat(header.props.message.channel_id)) {
|
||||
let data = changedUsers[header.props.message.author.id];
|
||||
if (data) {
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(header.props.message.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(header.props.message.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, header.props.message, {author: this.getUserData(header.props.message.author.id, true, false, header.props.message.author)}));
|
||||
if (color1) message.colorString = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color1) ? color1[0] : color1, "HEX");
|
||||
header.props.message = message;
|
||||
|
@ -831,7 +831,7 @@ module.exports = (_ => {
|
|||
if (content && content.type && content.type.type && content.props.message && this.shouldChangeInChat(content.props.message.channel_id)) {
|
||||
let data = changedUsers[content.props.message.author.id];
|
||||
if (data) {
|
||||
let messageColor = data.color2 || (BDFDB.ObjectUtils.get(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.chat") && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(content.props.message.channel_id) || {}).guild_id, content.props.message.author.id) || {}).colorString || data.color1));
|
||||
let messageColor = data.color2 || (BDFDB.ObjectUtils.get(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.chat") && (data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(content.props.message.channel_id) || {}).guild_id, content.props.message.author.id) || {}).colorString || data.color1));
|
||||
if (messageColor) {
|
||||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, content.props.message, {author: this.getUserData(content.props.message.author.id, true, false, content.props.message.author)}));
|
||||
message.colorString = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(messageColor) ? messageColor[0] : messageColor, "HEX");
|
||||
|
@ -844,7 +844,7 @@ module.exports = (_ => {
|
|||
let referenceMessage = repliedMessage.props.children.props.referencedMessage.message;
|
||||
let data = changedUsers[referenceMessage.author.id];
|
||||
if (data) {
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(referenceMessage.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(referenceMessage.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, referenceMessage, {author: this.getUserData(referenceMessage.author.id, true, false, referenceMessage.author)}));
|
||||
if (color1) message.colorString = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color1) ? color1[0] : color1, "HEX");
|
||||
repliedMessage.props.children.props.referencedMessage = Object.assign({}, repliedMessage.props.children.props.referencedMessage, {message: message});
|
||||
|
@ -859,7 +859,7 @@ module.exports = (_ => {
|
|||
let data = changedUsers[author.id];
|
||||
if (!data) return;
|
||||
if (!e.returnvalue) {
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, author.id) || {}).colorString || data.color1;
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, author.id) || {}).colorString || data.color1;
|
||||
color1 = color1 && BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color1) ? color1[0] : color1, "HEX");
|
||||
if (e.instance.props.userOverride) e.instance.props.userOverride = this.getUserData(author.id)
|
||||
else {
|
||||
|
@ -867,7 +867,7 @@ module.exports = (_ => {
|
|||
if (color1) message.colorString = color1;
|
||||
e.instance.props.message = message;
|
||||
}
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, author.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, author.id);
|
||||
e.instance.props.author = Object.assign({}, e.instance.props.author, {
|
||||
nick: this.getUserNick(e.instance.props.author.id, member && member.nick) || e.instance.props.author.nick,
|
||||
guildMemberAvatar: (data.removeIcon || data.url) ? null : e.instance.props.author.guildMemberAvatar,
|
||||
|
@ -904,7 +904,7 @@ module.exports = (_ => {
|
|||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {author: this.getUserData(e.instance.props.message.author.id, true, false, e.instance.props.message.author)}));
|
||||
let data = changedUsers[e.instance.props.message.author.id];
|
||||
if (data) {
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.message.author.id) || {}).colorString || data.color1;
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.message.author.id) || {}).colorString || data.color1;
|
||||
if (color1) message.colorString = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color1) ? color1[0] : color1, "HEX");
|
||||
}
|
||||
e.instance.props.message = message;
|
||||
|
@ -913,7 +913,7 @@ module.exports = (_ => {
|
|||
}
|
||||
else if (e.instance.props.message.state != BDFDB.DiscordConstants.MessageStates.SEND_FAILED) {
|
||||
let data = changedUsers[e.instance.props.message.author.id];
|
||||
let messageColor = data && (data.color2 || (BDFDB.ObjectUtils.get(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.chat") && (data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.message.author.id) || {}).colorString || data.color1)));
|
||||
let messageColor = data && (data.color2 || (BDFDB.ObjectUtils.get(BDFDB.BDUtils.getPlugin("BetterRoleColors", true), "settings.modules.chat") && (data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.message.author.id) || {}).colorString || data.color1)));
|
||||
if (messageColor) {
|
||||
if (BDFDB.ObjectUtils.is(messageColor)) e.returnvalue.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
|
||||
gradient: BDFDB.ColorUtils.createGradient(messageColor),
|
||||
|
@ -935,7 +935,7 @@ module.exports = (_ => {
|
|||
processReactorsComponent (e) {
|
||||
if (this.settings.places.reactions && BDFDB.ArrayUtils.is(e.instance.props.reactors) && this.shouldChangeInChat(e.instance.props.channel.id)) {
|
||||
if (!e.returnvalue) {
|
||||
for (let i in e.instance.props.reactors) if (!BDFDB.LibraryModules.MemberStore.getNick(e.instance.props.guildId, e.instance.props.reactors[i].id)) e.instance.props.reactors[i] = this.getUserData(e.instance.props.reactors[i].id, true, false, e.instance.props.reactors[i]);
|
||||
for (let i in e.instance.props.reactors) if (!BDFDB.LibraryStores.GuildMemberStore.getNick(e.instance.props.guildId, e.instance.props.reactors[i].id)) e.instance.props.reactors[i] = this.getUserData(e.instance.props.reactors[i].id, true, false, e.instance.props.reactors[i]);
|
||||
}
|
||||
else {
|
||||
let renderRow = e.returnvalue.props.renderRow;
|
||||
|
@ -945,7 +945,7 @@ module.exports = (_ => {
|
|||
let type = row.type;
|
||||
row.type = (...args2) => {
|
||||
let result = type(...args2);
|
||||
let nickName = BDFDB.LibraryModules.MemberStore.getNick(row.props.guildId, row.props.user.id) && BDFDB.ReactUtils.findChild(result, {props: [["className", BDFDB.disCN.messagereactionsmodalnickname]]});
|
||||
let nickName = BDFDB.LibraryStores.GuildMemberStore.getNick(row.props.guildId, row.props.user.id) && BDFDB.ReactUtils.findChild(result, {props: [["className", BDFDB.disCN.messagereactionsmodalnickname]]});
|
||||
if (nickName) {
|
||||
if (changedUsers[row.props.user.id].name) BDFDB.ReactUtils.setChild(nickName, changedUsers[row.props.user.id].name);
|
||||
this.changeUserColor(nickName, row.props.user.id);
|
||||
|
@ -1024,7 +1024,7 @@ module.exports = (_ => {
|
|||
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.reply.message, {author: this.getUserData(e.instance.props.reply.message.author.id)}));
|
||||
let data = changedUsers[e.instance.props.reply.message.author.id];
|
||||
if (data) {
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryModules.MemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.reply.message.channel_id) || {}).guild_id, e.instance.props.reply.message.author.id) || {}).colorString || data.color1;
|
||||
let color1 = data.color1 && data.useRoleColor && (BDFDB.LibraryStores.GuildMemberStore.getMember((BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.reply.message.channel_id) || {}).guild_id, e.instance.props.reply.message.author.id) || {}).colorString || data.color1;
|
||||
if (color1) message.colorString = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color1) ? color1[0] : color1, "HEX");
|
||||
}
|
||||
e.instance.props.reply = Object.assign({}, e.instance.props.reply, {message: message});
|
||||
|
@ -1043,7 +1043,7 @@ module.exports = (_ => {
|
|||
let data = changedUsers[e.instance.props.user.id];
|
||||
if (data) {
|
||||
if (data.name) {
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(e.instance.props.channel.guild_id, e.instance.props.user.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember(e.instance.props.channel.guild_id, e.instance.props.user.id);
|
||||
e.instance.props.nick = this.getUserNick(e.instance.props.user.id, member && member.nick);
|
||||
}
|
||||
if (data.removeStatus || data.status || data.statusEmoji) {
|
||||
|
@ -1055,7 +1055,7 @@ module.exports = (_ => {
|
|||
}
|
||||
else {
|
||||
this.changeUserColor(e.returnvalue.props.name, e.instance.props.user.id, {e: e, guildId: e.instance.props.channel.guild_id});
|
||||
this.injectBadge(BDFDB.ObjectUtils.get(e.returnvalue, "props.decorators.props.children"), e.instance.props.user.id, BDFDB.LibraryModules.LastGuildStore.getGuildId(), 2, {
|
||||
this.injectBadge(BDFDB.ObjectUtils.get(e.returnvalue, "props.decorators.props.children"), e.instance.props.user.id, BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), 2, {
|
||||
tagClass: BDFDB.disCN.bottagmember
|
||||
});
|
||||
}
|
||||
|
@ -1133,7 +1133,7 @@ module.exports = (_ => {
|
|||
|
||||
processTypingUsers (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && this.settings.places.typing) {
|
||||
let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.RelationshipStore.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user);
|
||||
let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryStores.RelationshipStore.isBlocked(id)).map(id => BDFDB.LibraryStores.UserStore.getUser(id)).filter(user => user);
|
||||
if (users.length) {
|
||||
let typingText = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]});
|
||||
if (typingText && BDFDB.ArrayUtils.is(typingText.props.children)) for (let child of typingText.props.children) if (child.type == "strong") {
|
||||
|
@ -1203,7 +1203,7 @@ module.exports = (_ => {
|
|||
processQuickSwitcherConnected (e) {
|
||||
if (e.returnvalue && e.returnvalue.props && e.returnvalue.props.query && (!e.returnvalue.props.queryMode || e.returnvalue.props.queryMode == BDFDB.LibraryModules.QueryUtils.AutocompleterResultTypes.USER)) {
|
||||
for (let id in changedUsers) if (changedUsers[id] && changedUsers[id].name && changedUsers[id].name.toLocaleLowerCase().indexOf(e.returnvalue.props.query.toLocaleLowerCase()) > -1 && !e.returnvalue.props.results.find(n => n.record && n.record.id == id && n.type == BDFDB.LibraryModules.QueryUtils.AutocompleterResultTypes.USER)) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(id);
|
||||
if (user) e.returnvalue.props.results.splice(1, 0, {
|
||||
comparator: `${user.username}#${user.discriminator}`,
|
||||
record: user,
|
||||
|
@ -1249,10 +1249,10 @@ module.exports = (_ => {
|
|||
|
||||
processIncomingCallModal (e) {
|
||||
if (e.instance.props.channel && this.settings.places.dmCalls) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(e.instance.props.channel.id);
|
||||
if (!user) {
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channel.id);
|
||||
if (channel && channel.isDM()) user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
|
||||
if (channel && channel.isDM()) user = BDFDB.LibraryStores.UserStore.getUser(channel.recipients[0]);
|
||||
}
|
||||
if (user) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.callincomingtitle]]});
|
||||
|
@ -1330,7 +1330,7 @@ module.exports = (_ => {
|
|||
|
||||
processPictureInPictureVideo (e) {
|
||||
if (e.instance.props.backgroundKey) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.backgroundKey);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(e.instance.props.backgroundKey);
|
||||
if (user) {
|
||||
e.instance.props.title = this.getUserData(user.id).username;
|
||||
let videoBackground = BDFDB.ReactUtils.findChild(e.instance.props.children, {name: "VideoBackground"});
|
||||
|
@ -1349,7 +1349,7 @@ module.exports = (_ => {
|
|||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let title = document.head.querySelector("title");
|
||||
if (title && channel && channel.isDM() && (document.location.href || "").indexOf(channel.id) > -1) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(channel.recipients[0]);
|
||||
if (user) BDFDB.DOMUtils.setText(title, "@" + this.getUserData(user.id, this.settings.places.appTitle).username);
|
||||
}
|
||||
}
|
||||
|
@ -1367,11 +1367,11 @@ module.exports = (_ => {
|
|||
let data = changedUsers[userId] || {};
|
||||
if (data.color1) {
|
||||
let childProp = child.props.children ? "children" : "text";
|
||||
let color1 = data.color1 && data.useRoleColor && options.guildId && (BDFDB.LibraryModules.MemberStore.getMember(options.guildId, userId) || {}).colorString || data.color1;
|
||||
let color1 = data.color1 && data.useRoleColor && options.guildId && (BDFDB.LibraryStores.GuildMemberStore.getMember(options.guildId, userId) || {}).colorString || data.color1;
|
||||
let fontColor = options.modify && !(data.useRoleColor && options.guildId) ? this.chooseColor(color1, options.modify) : color1;
|
||||
let fontGradient = BDFDB.ObjectUtils.is(fontColor);
|
||||
if (BDFDB.ObjectUtils.is(child.props.style)) delete child.props.style.color;
|
||||
if (child.props[childProp].props && BDFDB.LibraryModules.LocalSettingsStore.roleStyle != "dot") delete child.props[childProp].props.color;
|
||||
if (child.props[childProp].props && BDFDB.LibraryStores.AccessibilityStore.roleStyle != "dot") delete child.props[childProp].props.color;
|
||||
child.props[childProp] = BDFDB.ReactUtils.createElement("span", {
|
||||
style: {
|
||||
color: fontGradient ? BDFDB.ColorUtils.convert(fontColor[0], "RGBA") : BDFDB.ColorUtils.convert(fontColor, "RGBA")
|
||||
|
@ -1396,7 +1396,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getUserData (userId, change = true, keepName = false, fallbackData) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(userId);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(userId);
|
||||
if (!user && BDFDB.ObjectUtils.is(fallbackData) || user && BDFDB.ObjectUtils.is(fallbackData) && user.username != fallbackData.username) user = fallbackData;
|
||||
if (!user) return new BDFDB.DiscordObjects.User({});
|
||||
let data = change && changedUsers[user.id];
|
||||
|
@ -1439,7 +1439,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getUserNick (userId, nick, change = true) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(userId);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(userId);
|
||||
if (!user) return "";
|
||||
let data = change && changedUsers[user.id];
|
||||
if (data) return (data.useServerNick && nick || data.name && [data.name, data.showServerNick && nick && `(${nick})` || data.showAccountName && user.username && `(${user.username})`].filter(n => n).join(" ")) || nick || "";
|
||||
|
@ -1447,7 +1447,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getUserAvatar (userId, change = true) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(userId);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(userId);
|
||||
if (!user) return "";
|
||||
let data = change && changedUsers[user.id];
|
||||
if (data) {
|
||||
|
@ -1461,7 +1461,7 @@ module.exports = (_ => {
|
|||
if (!BDFDB.ArrayUtils.is(children) || !userId) return;
|
||||
let data = changedUsers[userId];
|
||||
if (data && data.tag) {
|
||||
let memberColor = data.ignoreTagColor && (BDFDB.LibraryModules.MemberStore.getMember(guildId, userId) || {}).colorString;
|
||||
let memberColor = data.ignoreTagColor && (BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, userId) || {}).colorString;
|
||||
let fontColor = !config.inverted ? data.color4 : (memberColor || data.color3);
|
||||
let backgroundColor = !config.inverted ? (memberColor || data.color3) : data.color4;
|
||||
let fontGradient = BDFDB.ObjectUtils.is(fontColor);
|
||||
|
@ -1495,8 +1495,8 @@ module.exports = (_ => {
|
|||
openUserSettingsModal (user) {
|
||||
let data = changedUsers[user.id] || {};
|
||||
let newData = Object.assign({}, data);
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), user.id) || {};
|
||||
let activity = BDFDB.LibraryModules.StatusMetaUtils.getApplicationActivity(user.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), user.id) || {};
|
||||
let activity = BDFDB.LibraryStores.PresenceStore.getApplicationActivity(user.id);
|
||||
|
||||
let avatarInput, bannerInput, statusEmojiInput, statusInput, colorPicker3, colorPicker4;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ module.exports = (_ => {
|
|||
loadEmojiList () {
|
||||
emojiReplicaList = {};
|
||||
let guilds = BDFDB.LibraryStores.GuildStore.getGuilds();
|
||||
for (let id in guilds) for (let emoji of BDFDB.LibraryModules.GuildEmojiStore.getGuildEmoji(id)) {
|
||||
for (let id in guilds) for (let emoji of BDFDB.LibraryStores.EmojiStore.getGuildEmoji(id)) {
|
||||
if (emoji.managed) emojiReplicaList[emoji.name] = emojiReplicaList[emoji.name] != undefined;
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ module.exports = (_ => {
|
|||
else return item[data.key];
|
||||
}
|
||||
})),
|
||||
data: BDFDB.LibraryModules.FolderStore.getFlattenedGuilds().map((guild, i) => {
|
||||
data: BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuilds().map((guild, i) => {
|
||||
let itemData = {
|
||||
index: i,
|
||||
guild: guild,
|
||||
|
@ -169,7 +169,7 @@ module.exports = (_ => {
|
|||
local: 0,
|
||||
copies: 0
|
||||
}
|
||||
for (let emoji of BDFDB.LibraryModules.GuildEmojiStore.getGuildEmoji(guild.id)) {
|
||||
for (let emoji of BDFDB.LibraryStores.EmojiStore.getGuildEmoji(guild.id)) {
|
||||
if (emoji.managed) {
|
||||
itemData.global++;
|
||||
if (emojiReplicaList[emoji.name]) itemData.copies++;
|
||||
|
|
|
@ -494,7 +494,7 @@ module.exports = (_ => {
|
|||
let settingsItems = [];
|
||||
|
||||
let observed = this.getObservedData();
|
||||
let friendIds = BDFDB.LibraryModules.RelationshipStore.getFriendIDs();
|
||||
let friendIds = BDFDB.LibraryStores.RelationshipStore.getFriendIDs();
|
||||
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
|
||||
title: "Settings",
|
||||
|
@ -546,8 +546,8 @@ module.exports = (_ => {
|
|||
}))
|
||||
}));
|
||||
|
||||
let friendCards = Object.keys(observed.friends).map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n);
|
||||
let strangerCards = Object.keys(observed.strangers).map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n);
|
||||
let friendCards = Object.keys(observed.friends).map(BDFDB.LibraryStores.UserStore.getUser).filter(n => n);
|
||||
let strangerCards = Object.keys(observed.strangers).map(BDFDB.LibraryStores.UserStore.getUser).filter(n => n);
|
||||
|
||||
if (friendCards.length) settingsItems.push(createUserList(friendCards.map(user => Object.assign({}, user, observed.friends[user.id], {
|
||||
key: user.id,
|
||||
|
@ -576,7 +576,7 @@ module.exports = (_ => {
|
|||
else if (friendIds.includes(userId)) BDFDB.NotificationUtils.toast("User is already a Friend of yours, please use the 'Friend-List' Area to configure them", {type: "danger"});
|
||||
else if (observed.strangers[userId]) BDFDB.NotificationUtils.toast("User is already being observed as a 'Stranger'", {type: "danger"});
|
||||
else {
|
||||
let user = /.+#[0-9]{4}/.test(userId) ? BDFDB.LibraryModules.UserStore.findByTag(userId.split("#").slice(0, -1).join("#"), userId.split("#").pop()) : BDFDB.LibraryModules.UserStore.getUser(userId);
|
||||
let user = /.+#[0-9]{4}/.test(userId) ? BDFDB.LibraryStores.UserStore.findByTag(userId.split("#").slice(0, -1).join("#"), userId.split("#").pop()) : BDFDB.LibraryStores.UserStore.getUser(userId);
|
||||
if (user) {
|
||||
observed.strangers[user.id || userId] = Object.assign({}, defaultSettings);
|
||||
BDFDB.DataUtils.save(observed, this, "observed");
|
||||
|
@ -739,10 +739,10 @@ module.exports = (_ => {
|
|||
|
||||
getObservedData () {
|
||||
let observed = Object.assign({friends: {}, strangers: {}}, BDFDB.DataUtils.load(this, "observed"));
|
||||
let friendIds = BDFDB.LibraryModules.RelationshipStore.getFriendIDs();
|
||||
let friendIds = BDFDB.LibraryStores.RelationshipStore.getFriendIDs();
|
||||
|
||||
for (let id of friendIds) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(id);
|
||||
if (user) {
|
||||
observed.friends[id] = Object.assign({}, defaultSettings, observed.friends[id] || observed.strangers[id]);
|
||||
delete observed.strangers[id];
|
||||
|
@ -761,7 +761,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getStatusWithMobileAndActivity (id, config, clientStatuses) {
|
||||
let voiceState = BDFDB.LibraryModules.FolderStore.getFlattenedGuildIds().map(BDFDB.LibraryModules.VoiceUtils.getVoiceStates).map(BDFDB.ObjectUtils.toArray).flat(10).find(n => n.selfStream & n.userId == id && BDFDB.LibraryStores.ChannelStore.getChannel(n.channelId) && BDFDB.UserUtils.can("VIEW_CHANNEL", BDFDB.UserUtils.me.id, n.channelId));
|
||||
let voiceState = BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds().map(BDFDB.LibraryStores.SortedVoiceStateStore.getVoiceStates).map(BDFDB.ObjectUtils.toArray).flat(10).find(n => n.selfStream & n.userId == id && BDFDB.LibraryStores.ChannelStore.getChannel(n.channelId) && BDFDB.UserUtils.can("VIEW_CHANNEL", BDFDB.UserUtils.me.id, n.channelId));
|
||||
let status = {
|
||||
name: BDFDB.UserUtils.getStatus(id),
|
||||
activity: null,
|
||||
|
@ -796,7 +796,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getOnlineCount () {
|
||||
return Object.entries(BDFDB.LibraryModules.RelationshipStore.getRelationships()).filter(n => n[1] == BDFDB.DiscordConstants.RelationshipTypes.FRIEND && BDFDB.LibraryModules.StatusMetaUtils.getStatus(n[0]) != BDFDB.DiscordConstants.StatusTypes.OFFLINE).length;
|
||||
return Object.entries(BDFDB.LibraryStores.RelationshipStore.getRelationships()).filter(n => n[1] == BDFDB.DiscordConstants.RelationshipTypes.FRIEND && BDFDB.LibraryStores.PresenceStore.getStatus(n[0]) != BDFDB.DiscordConstants.StatusTypes.OFFLINE).length;
|
||||
}
|
||||
|
||||
startInterval () {
|
||||
|
@ -806,7 +806,7 @@ module.exports = (_ => {
|
|||
observedUsers = Object.assign({}, data.strangers, data.friends);
|
||||
delete observedUsers[BDFDB.UserUtils.me.id];
|
||||
|
||||
let clientStatuses = BDFDB.LibraryModules.StatusMetaUtils.getState().clientStatuses;
|
||||
let clientStatuses = BDFDB.LibraryStores.PresenceStore.getState().clientStatuses;
|
||||
for (let id in observedUsers) userStatusStore[id] = this.getStatusWithMobileAndActivity(id, observedUsers[id], clientStatuses);
|
||||
|
||||
checkInterval = BDFDB.TimeUtils.interval(_ => {
|
||||
|
@ -815,9 +815,9 @@ module.exports = (_ => {
|
|||
friendCounter.props.amount = amount;
|
||||
BDFDB.ReactUtils.forceUpdate(friendCounter);
|
||||
}
|
||||
clientStatuses = BDFDB.LibraryModules.StatusMetaUtils.getState().clientStatuses;
|
||||
clientStatuses = BDFDB.LibraryStores.PresenceStore.getState().clientStatuses;
|
||||
for (let id in observedUsers) if (!observedUsers[id].disabled) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
let user = BDFDB.LibraryStores.UserStore.getUser(id);
|
||||
let status = this.getStatusWithMobileAndActivity(id, observedUsers[id], clientStatuses);
|
||||
let transitionChannelId = null;
|
||||
let customChanged = false, loginNotice = false, screensharingNotice = false;
|
||||
|
@ -866,7 +866,7 @@ module.exports = (_ => {
|
|||
else {
|
||||
let DMid = BDFDB.LibraryStores.ChannelStore.getDMFromUserId(user.id)
|
||||
if (DMid) BDFDB.LibraryModules.ChannelUtils.selectPrivateChannel(DMid);
|
||||
else BDFDB.LibraryModules.DirectMessageUtils.openPrivateChannel(user.id);
|
||||
else BDFDB.LibraryModules.PrivateChannelUtils.openPrivateChannel(user.id);
|
||||
BDFDB.LibraryModules.WindowUtils.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ module.exports = (_ => {
|
|||
e.instance.props.guildChannels.categories = Object.assign({}, e.instance.props.guildChannels.categories);
|
||||
for (let id in e.instance.props.guildChannels.categories) if (e.instance.props.guildChannels.categories[id].isMuted) {
|
||||
let channelArray = BDFDB.ObjectUtils.toArray(e.instance.props.guildChannels.categories[id].channels);
|
||||
for (let n of channelArray) if (n.renderLevel > renderLevels.DO_NOT_SHOW && n.id != e.instance.props.selectedChannelId && n.id != e.instance.props.selectedVoiceChannelId && BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(n.id) <= 0) {
|
||||
for (let n of channelArray) if (n.renderLevel > renderLevels.DO_NOT_SHOW && n.id != e.instance.props.selectedChannelId && n.id != e.instance.props.selectedVoiceChannelId && BDFDB.LibraryStores.ReadStateStore.getMentionCount(n.id) <= 0) {
|
||||
n.renderLevel = renderLevels.CAN_NOT_SHOW;
|
||||
BDFDB.ArrayUtils.remove(e.instance.props.guildChannels.categories[id].shownChannelIds, n.id, true);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ module.exports = (_ => {
|
|||
let topIsVisible = topBar.props.isVisible;
|
||||
topBar.props.isVisible = (...args) => {
|
||||
args[2] = args[2].filter(id => !this.isCategoryMuted(e.instance.props.guildId, id));
|
||||
return args[2].some(id => BDFDB.LibraryModules.UnreadChannelUtils.hasUnread(id) || BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id)) ? topIsVisible(...args) : true;
|
||||
return args[2].some(id => BDFDB.LibraryStores.ReadStateStore.hasUnread(id) || BDFDB.LibraryStores.ReadStateStore.getMentionCount(id)) ? topIsVisible(...args) : true;
|
||||
};
|
||||
}
|
||||
let bottomBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelsunreadbarbottom]]});
|
||||
|
@ -112,7 +112,7 @@ module.exports = (_ => {
|
|||
let bottomIsVisible = bottomBar.props.isVisible;
|
||||
bottomBar.props.isVisible = (...args) => {
|
||||
args[2] = args[2].filter(id => !this.isCategoryMuted(e.instance.props.guildId, id));
|
||||
return args[2].some(id => BDFDB.LibraryModules.UnreadChannelUtils.hasUnread(id) || BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id)) ? bottomIsVisible(...args) : true;
|
||||
return args[2].some(id => BDFDB.LibraryStores.ReadStateStore.hasUnread(id) || BDFDB.LibraryStores.ReadStateStore.getMentionCount(id)) ? bottomIsVisible(...args) : true;
|
||||
};
|
||||
}
|
||||
let tree = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"});
|
||||
|
@ -131,7 +131,7 @@ module.exports = (_ => {
|
|||
isCategoryMuted (guildId, channelId) {
|
||||
if (!guildId || !channelId) return false;
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
return channel && channel.parent_id && BDFDB.LibraryModules.MutedUtils.isChannelMuted(guildId, channel.parent_id);
|
||||
return channel && channel.parent_id && BDFDB.LibraryStores.UserGuildSettingsStore.isChannelMuted(guildId, channel.parent_id);
|
||||
}
|
||||
|
||||
patchList (guildId, selectedChannel, selectedVoiceChannel, returnvalue) {
|
||||
|
@ -140,7 +140,7 @@ module.exports = (_ => {
|
|||
let renderSection = list.props.renderSection;
|
||||
list.props.renderSection = (...args) => {
|
||||
let section = renderSection(...args);
|
||||
if (section && section.props && section.props.channel && BDFDB.LibraryModules.MutedUtils.isChannelMuted(guildId, section.props.channel.id) && !(selectedChannel && selectedChannel.parent_id == section.props.channel.id) && !(selectedVoiceChannel && selectedVoiceChannel.parent_id == section.props.channel.id) && BDFDB.ObjectUtils.toArray(BDFDB.LibraryStores.ChannelStore.getMutableGuildChannelsForGuild(guildId)).filter(n => n.parent_id == section.props.channel.id && BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(n.id) > 0).length == 0) return null;
|
||||
if (section && section.props && section.props.channel && BDFDB.LibraryStores.UserGuildSettingsStore.isChannelMuted(guildId, section.props.channel.id) && !(selectedChannel && selectedChannel.parent_id == section.props.channel.id) && !(selectedVoiceChannel && selectedVoiceChannel.parent_id == section.props.channel.id) && BDFDB.ObjectUtils.toArray(BDFDB.LibraryStores.ChannelStore.getMutableGuildChannelsForGuild(guildId)).filter(n => n.parent_id == section.props.channel.id && BDFDB.LibraryStores.ReadStateStore.getMentionCount(n.id) > 0).length == 0) return null;
|
||||
else return section;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -687,8 +687,8 @@ module.exports = (_ => {
|
|||
|
||||
onUserContextMenu (e) {
|
||||
if (e.instance.props.user && this.settings.places.userAvatars && e.subType == "useBlockUserItem") {
|
||||
const guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
const member = BDFDB.LibraryModules.MemberStore.getMember(guildId, e.instance.props.user.id);
|
||||
const guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, e.instance.props.user.id);
|
||||
let validUrls = this.filterUrls((e.instance.props.user.getAvatarURL(null, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(null, 4096, true), (e.instance.props.user.getAvatarURL(guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), member && member.avatar && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(member.avatar) && e.instance.props.user.getAvatarURL(guildId, 4096, true));
|
||||
if (!validUrls.length) return;
|
||||
|
||||
|
@ -1641,7 +1641,7 @@ module.exports = (_ => {
|
|||
naturalWidth: viewedImage.width,
|
||||
naturalHeight: viewedImage.height,
|
||||
play: true,
|
||||
playOnHover: !!BDFDB.LibraryModules.LocalSettingsStore.useReducedMotion
|
||||
playOnHover: !!BDFDB.LibraryStores.AccessibilityStore.useReducedMotion
|
||||
}));
|
||||
BDFDB.ReactUtils.forceUpdate(modalInstance);
|
||||
}
|
||||
|
|
|
@ -191,8 +191,8 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
injectDate (children, index, user, guildId) {
|
||||
if (!guildId) guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
if (!BDFDB.ArrayUtils.is(children) || !user || !guildId || user.isNonUserBot() || !BDFDB.LibraryModules.MemberStore.getMember(guildId, user.id)) return;
|
||||
if (!guildId) guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
if (!BDFDB.ArrayUtils.is(children) || !user || !guildId || user.isNonUserBot() || !BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, user.id)) return;
|
||||
|
||||
if (!loadedUsers[guildId]) loadedUsers[guildId] = {};
|
||||
if (!requestedUsers[guildId]) requestedUsers[guildId] = {};
|
||||
|
|
|
@ -201,7 +201,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
injectDate (children, index, user, guildId) {
|
||||
if (!guildId) guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
if (!guildId) guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
if (!BDFDB.ArrayUtils.is(children) || !user || user.isNonUserBot()) return;
|
||||
let isGuild = guildId && guildId != BDFDB.DiscordConstants.ME;
|
||||
guildId = isGuild ? guildId : BDFDB.LibraryModules.LastChannelStore.getChannelId();
|
||||
|
|
|
@ -133,7 +133,7 @@ module.exports = (_ => {
|
|||
let audio = new Audio;
|
||||
audio.src = this._src && this._src.startsWith("data") ? this._src.replace(/ /g, "") : this._src;
|
||||
audio.onloadeddata = _ => {
|
||||
audio.volume = Math.min((BDFDB.LibraryModules.MediaDeviceUtils.getOutputVolume() / 100) * (this._volume / 100) * (volumes.globalVolume / 100), 1);
|
||||
audio.volume = Math.min((BDFDB.LibraryStores.MediaEngineStore.getOutputVolume() / 100) * (this._volume / 100) * (volumes.globalVolume / 100), 1);
|
||||
BDFDB.LibraryModules.PlatformUtils.embedded && audio.setSinkId(currentDevice || defaultDevice);
|
||||
callback(audio);
|
||||
};
|
||||
|
@ -200,8 +200,8 @@ module.exports = (_ => {
|
|||
let change = _ => {
|
||||
if (window.navigator.mediaDevices && window.navigator.mediaDevices.enumerateDevices) {
|
||||
window.navigator.mediaDevices.enumerateDevices().then(enumeratedDevices => {
|
||||
let id = BDFDB.LibraryModules.MediaDeviceUtils.getOutputDeviceId();
|
||||
let allDevices = BDFDB.LibraryModules.MediaDeviceUtils.getOutputDevices();
|
||||
let id = BDFDB.LibraryStores.MediaEngineStore.getOutputDeviceId();
|
||||
let allDevices = BDFDB.LibraryStores.MediaEngineStore.getOutputDevices();
|
||||
let filteredDevices = enumeratedDevices.filter(d => d.kind == "audiooutput" && d.deviceId != "communications");
|
||||
let deviceIndex = BDFDB.LibraryModules.ArrayUtils(allDevices).sortBy(d => d.index).findIndex(d => d.id == id);
|
||||
let deviceViaId = allDevices[id];
|
||||
|
@ -213,7 +213,7 @@ module.exports = (_ => {
|
|||
});
|
||||
}
|
||||
};
|
||||
BDFDB.StoreChangeUtils.add(this, BDFDB.LibraryModules.MediaDeviceUtils, change);
|
||||
BDFDB.StoreChangeUtils.add(this, BDFDB.LibraryStores.MediaEngineStore, change);
|
||||
change();
|
||||
}
|
||||
|
||||
|
@ -221,10 +221,10 @@ module.exports = (_ => {
|
|||
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == "MESSAGE_CREATE" && e.methodArguments[0].message) {
|
||||
const message = e.methodArguments[0].message;
|
||||
const guildId = message.guild_id || null;
|
||||
if (message.author.id != BDFDB.UserUtils.me.id && !BDFDB.LibraryModules.RelationshipStore.isBlocked(message.author.id)) {
|
||||
if (message.author.id != BDFDB.UserUtils.me.id && !BDFDB.LibraryStores.RelationshipStore.isBlocked(message.author.id)) {
|
||||
const channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
const isGroupDM = channel.isGroupDM();
|
||||
const muted = BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryModules.ThreadConfigStore.isMuted(channel.id) : BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId, channel.id);
|
||||
const muted = BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryStores.JoinedThreadsStore.isMuted(channel.id) : BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId, channel.id);
|
||||
const focused = document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == channel.id;
|
||||
if (!guildId && !muted && !(choices[isGroupDM ? "groupdm" : "dm"].focus && focused)) {
|
||||
this.fireEvent(isGroupDM ? "groupdm" : "dm");
|
||||
|
@ -245,15 +245,15 @@ module.exports = (_ => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (message.mention_roles.length && !BDFDB.LibraryModules.MutedUtils.isSuppressRolesEnabled(guildId, channel.id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) {
|
||||
const member = BDFDB.LibraryModules.MemberStore.getMember(guildId, BDFDB.UserUtils.me.id);
|
||||
if (message.mention_roles.length && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressRolesEnabled(guildId, channel.id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) {
|
||||
const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, BDFDB.UserUtils.me.id);
|
||||
if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) {
|
||||
this.fireEvent("role");
|
||||
this.playAudio("role");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (message.mention_everyone && !BDFDB.LibraryModules.MutedUtils.isSuppressEveryoneEnabled(guildId, channel.id)) {
|
||||
if (message.mention_everyone && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressEveryoneEnabled(guildId, channel.id)) {
|
||||
if (message.content.indexOf("@everyone") > -1 && (!muted || choices.everyone.force) && !(choices.everyone.focus && focused)) {
|
||||
this.fireEvent("everyone");
|
||||
this.playAudio("everyone");
|
||||
|
@ -266,7 +266,7 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (BDFDB.LibraryModules.MutedUtils.allowAllMessages(channel) && (!muted || choices.message1.force) && !(choices.message1.focus && focused)) {
|
||||
if (BDFDB.LibraryStores.UserGuildSettingsStore.allowAllMessages(channel) && (!muted || choices.message1.force) && !(choices.message1.focus && focused)) {
|
||||
this.fireEvent("message1");
|
||||
this.playAudio("message1");
|
||||
return;
|
||||
|
@ -316,7 +316,7 @@ module.exports = (_ => {
|
|||
if (callListenerModule) {
|
||||
callListenerModule.terminate();
|
||||
BDFDB.PatchUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => {
|
||||
if (BDFDB.LibraryModules.CallUtils.getCalls().filter(call => call.ringing.length > 0 && BDFDB.LibraryModules.VoiceUtils.getCurrentClientVoiceChannelId() === call.channelId).length > 0 && !BDFDB.LibraryModules.SoundStateUtils.isSoundDisabled("call_calling") && !BDFDB.LibraryStores.StreamerModeStore.disableSounds) {
|
||||
if (BDFDB.LibraryStores.CallStore.getCalls().filter(call => call.ringing.length > 0 && BDFDB.LibraryStores.SortedVoiceStateStore.getCurrentClientVoiceChannelId() === call.channelId).length > 0 && !BDFDB.LibraryStores.NotificationSettingsStore.isSoundDisabled("call_calling") && !BDFDB.LibraryStores.StreamerModeStore.disableSounds) {
|
||||
createdAudios["call_calling"].loop();
|
||||
}
|
||||
else createdAudios["call_calling"].stop();
|
||||
|
@ -721,8 +721,8 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
isSuppressMentionsEnabled (guildId, channelId) {
|
||||
let channelSettings = BDFDB.LibraryModules.MutedUtils.getChannelMessageNotifications(guildId, channelId);
|
||||
return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryModules.MutedUtils.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES);
|
||||
let channelSettings = BDFDB.LibraryStores.UserGuildSettingsStore.getChannelMessageNotifications(guildId, channelId);
|
||||
return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryStores.UserGuildSettingsStore.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES);
|
||||
}
|
||||
|
||||
dontPlayAudio (type) {
|
||||
|
|
|
@ -141,7 +141,7 @@ module.exports = (_ => {
|
|||
if (popoutProps.selectedFilter.value != "channel" && !channelName && channel.recipients.length > 0) {
|
||||
for (let dmuser_id of channel.recipients) {
|
||||
channelName = channelName ? channelName + ", @" : channelName;
|
||||
channelName = channelName + ((BDFDB.LibraryModules.UserStore.getUser(dmuser_id) || {}).username || BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER);
|
||||
channelName = channelName + ((BDFDB.LibraryStores.UserStore.getUser(dmuser_id) || {}).username || BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER);
|
||||
}
|
||||
}
|
||||
return [
|
||||
|
|
|
@ -157,7 +157,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DirectMessageUnreadStore, "getUnreadPrivateChannelIds", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.PrivateChannelReadStateStore, "getUnreadPrivateChannelIds", {after: e => {
|
||||
let sortedRecents = this.sortAndUpdate("guildList");
|
||||
if (sortedRecents.length) {
|
||||
const dms = [];
|
||||
|
@ -448,7 +448,7 @@ module.exports = (_ => {
|
|||
if (category && draggedCategory != category.id) {
|
||||
let color = BDFDB.ColorUtils.convert(category.color, "RGBA");
|
||||
let foundDMs = this.filterDMs(category.dms, !category.predefined);
|
||||
let unreadAmount = this.settings.general.unreadAmount && BDFDB.ArrayUtils.sum(foundDMs.map(id => BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id)));
|
||||
let unreadAmount = this.settings.general.unreadAmount && BDFDB.ArrayUtils.sum(foundDMs.map(id => BDFDB.LibraryStores.ReadStateStore.getMentionCount(id)));
|
||||
return category.predefined && foundDMs.length < 1 ? null : [
|
||||
BDFDB.ReactUtils.createElement("h2", {
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.dmchannelheadercontainer, BDFDB.disCN._pindmspinnedchannelsheadercontainer, category.collapsed && BDFDB.disCN._pindmspinnedchannelsheadercollapsed, color && BDFDB.disCN._pindmspinnedchannelsheadercolored, BDFDB.disCN.namecontainernamecontainer),
|
||||
|
@ -769,9 +769,9 @@ module.exports = (_ => {
|
|||
if (!id || this.getChannelListCategory(id)) return "";
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(id);
|
||||
if (!channel) return "";
|
||||
else if (this.settings.preCategories.friends.enabled && channel.isDM() && BDFDB.LibraryModules.RelationshipStore.isFriend(channel.recipients[0])) return "friends";
|
||||
else if (this.settings.preCategories.blocked.enabled && channel.isDM() && BDFDB.LibraryModules.RelationshipStore.isBlocked(channel.recipients[0])) return "blocked";
|
||||
else if (this.settings.preCategories.bots.enabled && channel.isDM() && (BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]) || {}).bot) return "bots";
|
||||
else if (this.settings.preCategories.friends.enabled && channel.isDM() && BDFDB.LibraryStores.RelationshipStore.isFriend(channel.recipients[0])) return "friends";
|
||||
else if (this.settings.preCategories.blocked.enabled && channel.isDM() && BDFDB.LibraryStores.RelationshipStore.isBlocked(channel.recipients[0])) return "blocked";
|
||||
else if (this.settings.preCategories.bots.enabled && channel.isDM() && (BDFDB.LibraryStores.UserStore.getUser(channel.recipients[0]) || {}).bot) return "bots";
|
||||
else if (this.settings.preCategories.groups.enabled && channel.isGroupDM()) return "groups";
|
||||
return "";
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ module.exports = (_ => {
|
|||
if (!BDFDB.equals(data, newData)) this.savePinnedChannels(newData, type);
|
||||
if (type == "channelList" && Object.keys(this.settings.preCategories).some(type => this.settings.preCategories[type].enabled)) {
|
||||
let predefinedDMs = {};
|
||||
for (let channelId of BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds()) {
|
||||
for (let channelId of BDFDB.LibraryStores.PrivateChannelSortStore.getPrivateChannelIds()) {
|
||||
let category = this.getPredefinedCategory(channelId);
|
||||
if (category) {
|
||||
if (!predefinedDMs[category]) predefinedDMs[category] = [];
|
||||
|
@ -813,7 +813,7 @@ module.exports = (_ => {
|
|||
|
||||
sortDMsByTime (dms, type) {
|
||||
if (dms.length > 1 && this.settings.recentOrder[type]) {
|
||||
let timestamps = BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(channelId), newObj), {});
|
||||
let timestamps = BDFDB.LibraryStores.PrivateChannelSortStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryStores.ReadStateStore.lastMessageId(channelId), newObj), {});
|
||||
return [].concat(dms).sort(function (x, y) {
|
||||
const xT = parseFloat(timestamps[x]), yT = parseFloat(timestamps[y]);
|
||||
return xT > yT ? -1 : xT < yT ? 1 : 0;
|
||||
|
|
|
@ -69,19 +69,19 @@ module.exports = (_ => {
|
|||
BDFDB.GuildUtils.markAsRead(guildIds.filter(id => id && !blacklist.includes(id)));
|
||||
}
|
||||
getGuilds() {
|
||||
return BDFDB.LibraryModules.FolderStore.getFlattenedGuilds().map(g => g.id).filter(n => n);
|
||||
return BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuilds().map(g => g.id).filter(n => n);
|
||||
}
|
||||
getUnread() {
|
||||
return this.getGuilds().filter(id => BDFDB.LibraryModules.UnreadGuildUtils.hasUnread(id) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(id) > 0);
|
||||
return this.getGuilds().filter(id => BDFDB.LibraryStores.GuildReadStateStore.hasUnread(id) || BDFDB.LibraryStores.GuildReadStateStore.getMentionCount(id) > 0);
|
||||
}
|
||||
getPinged() {
|
||||
return this.getGuilds().filter(id => BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(id) > 0);
|
||||
return this.getGuilds().filter(id => BDFDB.LibraryStores.GuildReadStateStore.getMentionCount(id) > 0);
|
||||
}
|
||||
getMuted() {
|
||||
return this.getGuilds().filter(id => BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(id));
|
||||
return this.getGuilds().filter(id => BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(id));
|
||||
}
|
||||
getPingedDMs() {
|
||||
return BDFDB.LibraryStores.ChannelStore.getSortedPrivateChannels().map(c => c.id).filter(id => id && BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id) > 0);
|
||||
return BDFDB.LibraryStores.ChannelStore.getSortedPrivateChannels().map(c => c.id).filter(id => id && BDFDB.LibraryStores.ReadStateStore.getMentionCount(id) > 0);
|
||||
}
|
||||
render() {
|
||||
return BDFDB.ReactUtils.createElement("div", {
|
||||
|
@ -314,7 +314,7 @@ module.exports = (_ => {
|
|||
|
||||
batchSetGuilds (settingsPanel, collapseStates, value) {
|
||||
if (!value) {
|
||||
for (let id of BDFDB.LibraryModules.FolderStore.getFlattenedGuildIds()) blacklist.push(id);
|
||||
for (let id of BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds()) blacklist.push(id);
|
||||
this.saveBlacklist(BDFDB.ArrayUtils.removeCopies(blacklist));
|
||||
}
|
||||
else this.saveBlacklist([]);
|
||||
|
|
|
@ -121,11 +121,11 @@ module.exports = (_ => {
|
|||
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.ChannelStore, "getChannel", {after: e => {
|
||||
if (e.returnValue && e.returnValue.isGroupDM()) return new BDFDB.DiscordObjects.Channel(Object.assign({}, e.returnValue, {rawRecipients: e.returnValue.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.returnValue.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}))
|
||||
if (e.returnValue && e.returnValue.isGroupDM()) return new BDFDB.DiscordObjects.Channel(Object.assign({}, e.returnValue, {rawRecipients: e.returnValue.rawRecipients.filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id)), recipients: e.returnValue.recipients.filter(id => !id || !BDFDB.LibraryStores.RelationshipStore.isBlocked(id))}))
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.StageChannelUtils, "getMutableParticipants", {after: e => {
|
||||
e.returnValue = e.returnValue.filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.StageChannelParticipantStore, "getMutableParticipants", {after: e => {
|
||||
e.returnValue = e.returnValue.filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.RelationshipUtils, "addRelationship", {after: e => {
|
||||
|
@ -133,21 +133,21 @@ module.exports = (_ => {
|
|||
}});
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.RelationshipUtils, "removeRelationship", {after: e => this.forceUpdateAll()});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "getUnreadCount", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.ReadStateStore, "getUnreadCount", {after: e => {
|
||||
if (e.returnValue && this.settings.notifcations.messages && e.returnValue < BDFDB.DiscordConstants.MAX_MESSAGES_PER_CHANNEL) {
|
||||
let sub = 0, messages = [].concat(BDFDB.LibraryModules.MessageStore.getMessages(e.methodArguments[0])._array).reverse();
|
||||
let sub = 0, messages = [].concat(BDFDB.LibraryStores.MessageStore.getMessages(e.methodArguments[0])._array).reverse();
|
||||
for (let i = 0; i < e.returnValue; i++) if (messages[i] && messages[i].blocked) sub++;
|
||||
e.returnValue -= sub;
|
||||
}
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadChannelUtils, "hasUnread", {after: e => {
|
||||
if (e.returnValue && this.settings.notifcations.messages && BDFDB.LibraryModules.UnreadChannelUtils.getUnreadCount(e.methodArguments[0]) < BDFDB.DiscordConstants.MAX_MESSAGES_PER_CHANNEL) {
|
||||
let id = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(e.methodArguments[0]);
|
||||
let message = id && BDFDB.LibraryModules.MessageStore.getMessage(e.methodArguments[0], id);
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.ReadStateStore, "hasUnread", {after: e => {
|
||||
if (e.returnValue && this.settings.notifcations.messages && BDFDB.LibraryStores.ReadStateStore.getUnreadCount(e.methodArguments[0]) < BDFDB.DiscordConstants.MAX_MESSAGES_PER_CHANNEL) {
|
||||
let id = BDFDB.LibraryStores.ReadStateStore.lastMessageId(e.methodArguments[0]);
|
||||
let message = id && BDFDB.LibraryStores.MessageStore.getMessage(e.methodArguments[0], id);
|
||||
if (message && message.blocked) {
|
||||
let oldestId = BDFDB.LibraryModules.UnreadChannelUtils.getOldestUnreadMessageId(e.methodArguments[0]);
|
||||
let messages = BDFDB.LibraryModules.MessageStore.getMessages(e.methodArguments[0]);
|
||||
let oldestId = BDFDB.LibraryStores.ReadStateStore.getOldestUnreadMessageId(e.methodArguments[0]);
|
||||
let messages = BDFDB.LibraryStores.MessageStore.getMessages(e.methodArguments[0]);
|
||||
if (messages && oldestId) {
|
||||
let index = messages._array.indexOf(messages._array.find(c => c.id == oldestId));
|
||||
if (index > -1) return messages._array.slice(index).some(c => !c.blocked);
|
||||
|
@ -156,29 +156,29 @@ module.exports = (_ => {
|
|||
}
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.UnreadGuildUtils, "hasUnread", {after: e => {
|
||||
if (e.returnValue && this.settings.notifcations.messages) return BDFDB.LibraryModules.GuildChannelStore.getChannels(e.methodArguments[0]).SELECTABLE.map(n => n.channel && n.channel.id).filter(n => n && n != "null").some(id => BDFDB.LibraryModules.UnreadChannelUtils.hasUnread(id));
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.GuildReadStateStore, "hasUnread", {after: e => {
|
||||
if (e.returnValue && this.settings.notifcations.messages) return BDFDB.LibraryStores.GuildChannelStore.getChannels(e.methodArguments[0]).SELECTABLE.map(n => n.channel && n.channel.id).filter(n => n && n != "null").some(id => BDFDB.LibraryStores.ReadStateStore.hasUnread(id));
|
||||
}});
|
||||
|
||||
if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS.MENTIONS, "queryResults", {after: e => {
|
||||
if (this.settings.places.autocompletes && e.returnValue.results && e.returnValue.results.users) e.returnValue.results.users = e.returnValue.results.users.filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
if (this.settings.places.autocompletes && e.returnValue.results && e.returnValue.results.users) e.returnValue.results.users = e.returnValue.results.users.filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
}});
|
||||
|
||||
let muteTimeout;
|
||||
let channelId = BDFDB.LibraryModules.CurrentVoiceUtils.getChannelId();
|
||||
let connectedUsers = BDFDB.ObjectUtils.filter(BDFDB.LibraryModules.VoiceUtils.getVoiceStates(BDFDB.LibraryModules.CurrentVoiceUtils.getGuildId()), n => n && n.channelId == channelId && !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.userId));
|
||||
let channelId = BDFDB.LibraryStores.RTCConnectionStore.getChannelId();
|
||||
let connectedUsers = BDFDB.ObjectUtils.filter(BDFDB.LibraryStores.SortedVoiceStateStore.getVoiceStates(BDFDB.LibraryStores.RTCConnectionStore.getGuildId()), n => n && n.channelId == channelId && !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.userId));
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "playSound", {instead: e => {
|
||||
let type = e.methodArguments[0];
|
||||
if (this.settings.notifcations.voiceChat && (type == "disconnect" || type == "user_join" || type == "user_leave" || type == "user_moved")) {
|
||||
channelId = BDFDB.LibraryModules.CurrentVoiceUtils.getChannelId();
|
||||
channelId = BDFDB.LibraryStores.RTCConnectionStore.getChannelId();
|
||||
if (channelId) {
|
||||
let allConnectedUsers = BDFDB.ObjectUtils.filter(BDFDB.LibraryModules.VoiceUtils.getVoiceStates(BDFDB.LibraryModules.CurrentVoiceUtils.getGuildId()), n => n && n.channelId == channelId);
|
||||
let unblockedUsers = BDFDB.ObjectUtils.filter(allConnectedUsers, n => n && !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.userId));
|
||||
let unmutedBlockedUsers = BDFDB.ObjectUtils.toArray(allConnectedUsers).filter(n => n && BDFDB.LibraryModules.RelationshipStore.isBlocked(n.userId) && !BDFDB.LibraryModules.MediaDeviceUtils.isLocalMute(n.userId));
|
||||
let allConnectedUsers = BDFDB.ObjectUtils.filter(BDFDB.LibraryStores.SortedVoiceStateStore.getVoiceStates(BDFDB.LibraryStores.RTCConnectionStore.getGuildId()), n => n && n.channelId == channelId);
|
||||
let unblockedUsers = BDFDB.ObjectUtils.filter(allConnectedUsers, n => n && !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.userId));
|
||||
let unmutedBlockedUsers = BDFDB.ObjectUtils.toArray(allConnectedUsers).filter(n => n && BDFDB.LibraryStores.RelationshipStore.isBlocked(n.userId) && !BDFDB.LibraryStores.MediaEngineStore.isLocalMute(n.userId));
|
||||
if (unmutedBlockedUsers.length) {
|
||||
BDFDB.TimeUtils.clear(muteTimeout);
|
||||
muteTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
while (unmutedBlockedUsers.length) BDFDB.LibraryModules.MediaDeviceSetUtils.toggleLocalMute(unmutedBlockedUsers.pop().userId);
|
||||
while (unmutedBlockedUsers.length) BDFDB.LibraryModules.MediaEngineUtils.toggleLocalMute(unmutedBlockedUsers.pop().userId);
|
||||
}, 1000);
|
||||
}
|
||||
if (Object.keys(unblockedUsers).length == Object.keys(connectedUsers).length) {
|
||||
|
@ -273,7 +273,7 @@ module.exports = (_ => {
|
|||
let messages = messagesIns.props.messages;
|
||||
messagesIns.props.messages = new BDFDB.DiscordObjects.Messages(messages);
|
||||
for (let key in messages) messagesIns.props.messages[key] = messages[key];
|
||||
messagesIns.props.messages._array = [].concat(messagesIns.props.messages._array.filter(n => !n.author || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.author.id)));
|
||||
messagesIns.props.messages._array = [].concat(messagesIns.props.messages._array.filter(n => !n.author || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.author.id)));
|
||||
if (messagesIns.props.oldestUnreadMessageId && messagesIns.props.messages._array.every(n => n.id != messagesIns.props.oldestUnreadMessageId)) messagesIns.props.oldestUnreadMessageId = null;
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ module.exports = (_ => {
|
|||
processMessage (e) {
|
||||
if (this.settings.places.replies) {
|
||||
let repliedMessage = e.instance.props.childrenRepliedMessage;
|
||||
if (repliedMessage && repliedMessage.props && repliedMessage.props.children && repliedMessage.props.children.props && repliedMessage.props.children.props.referencedMessage && repliedMessage.props.children.props.referencedMessage.message && repliedMessage.props.children.props.referencedMessage.message.author && BDFDB.LibraryModules.RelationshipStore.isBlocked(repliedMessage.props.children.props.referencedMessage.message.author.id)) {
|
||||
if (repliedMessage && repliedMessage.props && repliedMessage.props.children && repliedMessage.props.children.props && repliedMessage.props.children.props.referencedMessage && repliedMessage.props.children.props.referencedMessage.message && repliedMessage.props.children.props.referencedMessage.message.author && BDFDB.LibraryStores.RelationshipStore.isBlocked(repliedMessage.props.children.props.referencedMessage.message.author.id)) {
|
||||
delete e.instance.props.childrenRepliedMessage;
|
||||
let header = e.instance.props.childrenHeader;
|
||||
if (header && header.props) {
|
||||
|
@ -307,16 +307,16 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelPins (e) {
|
||||
if (this.settings.places.pins && e.returnvalue.props && e.returnvalue.props.children && e.returnvalue.props.children.props && BDFDB.ArrayUtils.is(e.returnvalue.props.children.props.messages)) e.returnvalue.props.children.props.messages = e.returnvalue.props.children.props.messages.filter(n => !n || !n.author || !n.author.id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.author.id));
|
||||
if (this.settings.places.pins && e.returnvalue.props && e.returnvalue.props.children && e.returnvalue.props.children.props && BDFDB.ArrayUtils.is(e.returnvalue.props.children.props.messages)) e.returnvalue.props.children.props.messages = e.returnvalue.props.children.props.messages.filter(n => !n || !n.author || !n.author.id || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.author.id));
|
||||
}
|
||||
|
||||
processRecentMentions (e) {
|
||||
if (this.settings.places.inbox && BDFDB.ArrayUtils.is(e.returnvalue.props.messages)) e.returnvalue.props.messages = e.returnvalue.props.messages.filter(n => !n || !n.author || !n.author.id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.author.id));
|
||||
if (this.settings.places.inbox && BDFDB.ArrayUtils.is(e.returnvalue.props.messages)) e.returnvalue.props.messages = e.returnvalue.props.messages.filter(n => !n || !n.author || !n.author.id || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.author.id));
|
||||
}
|
||||
|
||||
processReactions (e) {
|
||||
if (this.settings.places.reactions && e.returnvalue && e.returnvalue.props.children && BDFDB.ArrayUtils.is(e.returnvalue.props.children[0])) {
|
||||
let updateTimeout, relationshipCount = BDFDB.LibraryModules.RelationshipStore.getRelationshipCount();
|
||||
let updateTimeout, relationshipCount = BDFDB.LibraryStores.RelationshipStore.getRelationshipCount();
|
||||
if (cachedChannelId != e.instance.props.message.channel_id) {
|
||||
cachedReactions = {};
|
||||
cachedChannelId = e.instance.props.message.channel_id;
|
||||
|
@ -335,7 +335,7 @@ module.exports = (_ => {
|
|||
if (!reactions || !reactions.length) return;
|
||||
let someBlocked = false;
|
||||
let filteredReactions = reactions.filter(n => {
|
||||
let isBlocked = n && BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id);
|
||||
let isBlocked = n && BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id);
|
||||
someBlocked = someBlocked || isBlocked;
|
||||
return !isBlocked;
|
||||
});
|
||||
|
@ -359,15 +359,15 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processReactorsComponent (e) {
|
||||
if (this.settings.places.reactions && BDFDB.ArrayUtils.is(e.instance.props.reactors)) e.instance.props.reactors = e.instance.props.reactors.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id));
|
||||
if (this.settings.places.reactions && BDFDB.ArrayUtils.is(e.instance.props.reactors)) e.instance.props.reactors = e.instance.props.reactors.filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id));
|
||||
}
|
||||
|
||||
processActiveThread (e) {
|
||||
if (!this.settings.places.threads) return;
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: n => n && n.type && n.type.toString().indexOf(".getMostRecentMessage") > -1});
|
||||
if (index > -1 && children[index].props && children[index].props.channel) {
|
||||
let message = BDFDB.LibraryModules.MessageStore.getMessage(children[index].props.channel.id, children[index].props.channel.lastMessageId);
|
||||
if (message && BDFDB.LibraryModules.RelationshipStore.isBlocked(message.author.id)) children[index] = null;
|
||||
let message = BDFDB.LibraryStores.MessageStore.getMessage(children[index].props.channel.id, children[index].props.channel.lastMessageId);
|
||||
if (message && BDFDB.LibraryStores.RelationshipStore.isBlocked(message.author.id)) children[index] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ module.exports = (_ => {
|
|||
for (let i in channelMembers.props.rows) {
|
||||
let row = channelMembers.props.rows[i];
|
||||
if (!row || row.type != "MEMBER") newRows[i] = row;
|
||||
else if (!row.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(row.user.id)) newRows[i] = row;
|
||||
else if (!row.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(row.user.id)) newRows[i] = row;
|
||||
else {
|
||||
hiddenRows = true;
|
||||
let found = false, rowIndex = i - 1;
|
||||
|
@ -418,11 +418,11 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processMemberListItem (e) {
|
||||
if (this.settings.places.memberList && e.instance.props.user && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.user.id)) return null;
|
||||
if (this.settings.places.memberList && e.instance.props.user && BDFDB.LibraryStores.RelationshipStore.isBlocked(e.instance.props.user.id)) return null;
|
||||
}
|
||||
|
||||
processPrivateChannelRecipients (e) {
|
||||
if (this.settings.places.voiceChat && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}));
|
||||
if (this.settings.places.voiceChat && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryStores.RelationshipStore.isBlocked(id))}));
|
||||
}
|
||||
|
||||
processNowPlayingItem (e) {
|
||||
|
@ -431,11 +431,11 @@ module.exports = (_ => {
|
|||
if (index > -1) for (let child of children) if (child && child.props && child.props.party) {
|
||||
if (!e.returnvalue) {
|
||||
if (child.props.party.priorityMembers) {
|
||||
child.props.party.priorityMembers = child.props.party.priorityMembers.filter(n => !n || !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
child.props.party.priorityMembers = child.props.party.priorityMembers.filter(n => !n || !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
if (!child.props.party.priorityMembers.length) child.props.party.priorityMembers.push({user: new BDFDB.DiscordObjects.User({id: 0, username: ""})});
|
||||
}
|
||||
if (child.props.party.partiedMembers) child.props.party.partiedMembers = child.props.party.partiedMembers.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id));
|
||||
if (child.props.party.voiceChannels) for (let i in child.props.party.voiceChannels) child.props.party.voiceChannels[i] = Object.assign({}, child.props.party.voiceChannels[i], {members: child.props.party.voiceChannels[i].members.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id))});
|
||||
if (child.props.party.partiedMembers) child.props.party.partiedMembers = child.props.party.partiedMembers.filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id));
|
||||
if (child.props.party.voiceChannels) for (let i in child.props.party.voiceChannels) child.props.party.voiceChannels[i] = Object.assign({}, child.props.party.voiceChannels[i], {members: child.props.party.voiceChannels[i].members.filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id))});
|
||||
}
|
||||
else {
|
||||
if (child.props.party.priorityMembers && child.props.party.priorityMembers[0].user && child.props.party.priorityMembers[0].user.id == 0) {
|
||||
|
@ -451,7 +451,7 @@ module.exports = (_ => {
|
|||
if (this.settings.places.voiceList) {
|
||||
let channelInfo = BDFDB.ReactUtils.findChild(e.instance.props.children, {props: [["className", BDFDB.disCN.channelinfo]]});
|
||||
if (channelInfo && channelInfo.props && channelInfo.props.children && channelInfo.props.children.props && BDFDB.ArrayUtils.is(channelInfo.props.children.props.voiceStates)) {
|
||||
let newVoiceStates = [].concat(channelInfo.props.children.props.voiceStates).filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
let newVoiceStates = [].concat(channelInfo.props.children.props.voiceStates).filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
if (channelInfo.props.children.props.channel.userLimit) channelInfo.props.children.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, channelInfo.props.children.props.channel, {userLimit: channelInfo.props.children.props.channel.userLimit - (channelInfo.props.children.props.voiceStates.length - newVoiceStates.length)}));
|
||||
channelInfo.props.children.props.voiceStates = newVoiceStates;
|
||||
}
|
||||
|
@ -461,8 +461,8 @@ module.exports = (_ => {
|
|||
processVoiceUsers (e) {
|
||||
if (this.settings.places.voiceList && BDFDB.ArrayUtils.is(e.instance.props.voiceStates)) {
|
||||
if (!e.returnvalue) {
|
||||
if (e.instance.props.children && e.instance.props.children.props && e.instance.props.children.props.numAudience) e.instance.props.children.props.numAudience = BDFDB.LibraryModules.StageChannelUtils.getMutableParticipants(e.instance.props.channel.id).length;
|
||||
e.instance.props.voiceStates = [].concat(e.instance.props.voiceStates).filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
if (e.instance.props.children && e.instance.props.children.props && e.instance.props.children.props.numAudience) e.instance.props.children.props.numAudience = BDFDB.LibraryStores.StageChannelParticipantStore.getMutableParticipants(e.instance.props.channel.id).length;
|
||||
e.instance.props.voiceStates = [].concat(e.instance.props.voiceStates).filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
}
|
||||
else {
|
||||
if (e.instance.props.children && e.instance.props.children.props && e.instance.props.children.props.numAudience === 0) return null;
|
||||
|
@ -471,7 +471,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processVoiceUser (e) {
|
||||
if (this.settings.places.voiceList && e.instance.props.user && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.user.id)) return null;
|
||||
if (this.settings.places.voiceList && e.instance.props.user && BDFDB.LibraryStores.RelationshipStore.isBlocked(e.instance.props.user.id)) return null;
|
||||
}
|
||||
|
||||
processDirectMessage (e) {
|
||||
|
@ -483,7 +483,7 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.channel.getRecipientId())) e.returnvalue = null;
|
||||
if (BDFDB.LibraryStores.RelationshipStore.isBlocked(e.instance.props.channel.getRecipientId())) e.returnvalue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ module.exports = (_ => {
|
|||
if (this.settings.places.channelList && e.instance.props.channel) {
|
||||
if (e.instance.props.channel.isGroupDM()) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}));
|
||||
e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryStores.RelationshipStore.isBlocked(id))}));
|
||||
}
|
||||
else {
|
||||
if (!e.instance.props.channel.name) {
|
||||
|
@ -510,38 +510,38 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (e.returnvalue && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.channel.getRecipientId())) e.returnvalue = null;
|
||||
if (e.returnvalue && BDFDB.LibraryStores.RelationshipStore.isBlocked(e.instance.props.channel.getRecipientId())) e.returnvalue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processPrivateChannelCallParticipants (e) {
|
||||
if (this.settings.places.voiceChat) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants)) e.instance.props.participants = [].concat(e.instance.props.participants).filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.filteredParticipants)) e.instance.props.filteredParticipants = [].concat(e.instance.props.filteredParticipants).filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants)) e.instance.props.participants = [].concat(e.instance.props.participants).filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.filteredParticipants)) e.instance.props.filteredParticipants = [].concat(e.instance.props.filteredParticipants).filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
}
|
||||
}
|
||||
|
||||
processChannelCall (e) {
|
||||
if (this.settings.places.voiceChat) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants)) e.instance.props.participants = [].concat(e.instance.props.participants).filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.filteredParticipants)) e.instance.props.filteredParticipants = [].concat(e.instance.props.filteredParticipants).filter(n => !n.user || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.user.id));
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.participants)) e.instance.props.participants = [].concat(e.instance.props.participants).filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.filteredParticipants)) e.instance.props.filteredParticipants = [].concat(e.instance.props.filteredParticipants).filter(n => !n.user || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.user.id));
|
||||
}
|
||||
}
|
||||
|
||||
processUserSummaryItem (e) {
|
||||
if (this.settings.places.memberList && BDFDB.ArrayUtils.is(e.instance.props.users)) e.instance.props.users = [].concat(e.instance.props.users).filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id));
|
||||
if (this.settings.places.memberList && BDFDB.ArrayUtils.is(e.instance.props.users)) e.instance.props.users = [].concat(e.instance.props.users).filter(n => !n || !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id));
|
||||
}
|
||||
|
||||
processUserMention (e) {
|
||||
if (e.instance.props.userId && this.settings.places.mentions && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.userId)) return BDFDB.ReactUtils.createElement("span", {
|
||||
if (e.instance.props.userId && this.settings.places.mentions && BDFDB.LibraryStores.RelationshipStore.isBlocked(e.instance.props.userId)) return BDFDB.ReactUtils.createElement("span", {
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.mention, BDFDB.disCN.mentionwrapper, e.instance.props.className),
|
||||
children: ["@" + BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER]
|
||||
});
|
||||
}
|
||||
|
||||
processRichUserMention (e) {
|
||||
if (e.instance.props.id && this.settings.places.mentions && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.id)) return BDFDB.ReactUtils.createElement("span", {
|
||||
if (e.instance.props.id && this.settings.places.mentions && BDFDB.LibraryStores.RelationshipStore.isBlocked(e.instance.props.id)) return BDFDB.ReactUtils.createElement("span", {
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.mention, BDFDB.disCN.mentionwrapper, e.instance.props.className),
|
||||
children: ["@" + BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER]
|
||||
});
|
||||
|
@ -550,7 +550,7 @@ module.exports = (_ => {
|
|||
getGroupName (channelId) {
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
if (channel.name) return channel.name;
|
||||
let recipients = channel.recipients.map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n && !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id));
|
||||
let recipients = channel.recipients.map(BDFDB.LibraryStores.UserStore.getUser).filter(n => n && !BDFDB.LibraryStores.RelationshipStore.isBlocked(n.id));
|
||||
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -166,7 +166,7 @@ module.exports = (_ => {
|
|||
|
||||
processTypingUsers (e) {
|
||||
if (BDFDB.ObjectUtils.is(e.instance.props.typingUsers) && Object.keys(e.instance.props.typingUsers).length && this.settings.places.typing) {
|
||||
let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryModules.RelationshipStore.isBlocked(id)).map(id => BDFDB.LibraryModules.UserStore.getUser(id)).filter(user => user);
|
||||
let users = Object.keys(e.instance.props.typingUsers).filter(id => id != BDFDB.UserUtils.me.id).filter(id => !BDFDB.LibraryStores.RelationshipStore.isBlocked(id)).map(id => BDFDB.LibraryStores.UserStore.getUser(id)).filter(user => user);
|
||||
if (users.length) {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.typingtext]]});
|
||||
if (index > -1 && BDFDB.ArrayUtils.is(children[index].props.children)) for (let child of children[index].props.children) if (child.type == "strong") {
|
||||
|
@ -181,7 +181,7 @@ module.exports = (_ => {
|
|||
if (e.instance.props.reactions) {
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id);
|
||||
let guildId = null == channel || channel.isPrivate() ? null : channel.getGuildId();
|
||||
let users = e.instance.props.reactions.filter(user => !BDFDB.LibraryModules.RelationshipStore.isBlocked(user.id)).slice(0, 3).map(user => this.getNewName(user) || guildId && BDFDB.LibraryModules.MemberStore.getNick(guildId, user.id) || user.username).filter(user => user);
|
||||
let users = e.instance.props.reactions.filter(user => !BDFDB.LibraryStores.RelationshipStore.isBlocked(user.id)).slice(0, 3).map(user => this.getNewName(user) || guildId && BDFDB.LibraryStores.GuildMemberStore.getNick(guildId, user.id) || user.username).filter(user => user);
|
||||
if (users.length) {
|
||||
let reaction = e.instance.props.message.getReaction(e.instance.props.emoji);
|
||||
let others = Math.max(0, (reaction && reaction.count || 0) - users.length);
|
||||
|
@ -204,7 +204,7 @@ module.exports = (_ => {
|
|||
|
||||
processUserMention (e) {
|
||||
if (e.instance.props.userId && this.settings.places.mentions) {
|
||||
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.userId));
|
||||
let newName = this.getNewName(BDFDB.LibraryStores.UserStore.getUser(e.instance.props.userId));
|
||||
if (!newName) return;
|
||||
if (typeof e.returnvalue.props.children == "function") {
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
|
@ -220,7 +220,7 @@ module.exports = (_ => {
|
|||
|
||||
processRichUserMention (e) {
|
||||
if (e.instance.props.id && this.settings.places.mentions && typeof e.returnvalue.props.children == "function") {
|
||||
let newName = this.getNewName(BDFDB.LibraryModules.UserStore.getUser(e.instance.props.id));
|
||||
let newName = this.getNewName(BDFDB.LibraryStores.UserStore.getUser(e.instance.props.id));
|
||||
if (newName) {
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
|
||||
|
@ -265,8 +265,8 @@ module.exports = (_ => {
|
|||
|
||||
getNewName (user) {
|
||||
if (!user) return null;
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(BDFDB.LibraryModules.LastGuildStore.getGuildId(), user.id) || {};
|
||||
let origUser = BDFDB.LibraryModules.UserStore.getUser(user.id) || {};
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), user.id) || {};
|
||||
let origUser = BDFDB.LibraryStores.UserStore.getUser(user.id) || {};
|
||||
let EditUsers = BDFDB.BDUtils.getPlugin("EditUsers", true);
|
||||
let username = EditUsers && EditUsers.getUserData(user, true, false, origUser).username || user.username;
|
||||
if (!member.nick || user.id == BDFDB.UserUtils.me.id && !this.settings.general.replaceOwn || user.bot && !this.settings.general.replaceBots) return username != origUser.username ? username : (member.nick || username);
|
||||
|
|
|
@ -79,7 +79,7 @@ module.exports = (_ => {
|
|||
className: BDFDB.disCNS.guildouter + BDFDB.disCN._servercounterservercountwrap,
|
||||
children: BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCNS.guildslabel + BDFDB.disCN._servercounterservercount,
|
||||
children: `${BDFDB.LanguageUtils.LanguageStrings.SERVERS} – ${BDFDB.LibraryModules.FolderStore.getFlattenedGuildIds().length}`
|
||||
children: `${BDFDB.LanguageUtils.LanguageStrings.SERVERS} – ${BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds().length}`
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ module.exports = (_ => {
|
|||
}, _this.settings.amounts.tooltipDelay * 1000);
|
||||
return null;
|
||||
}
|
||||
let owner = BDFDB.LibraryModules.UserStore.getUser(this.props.guild.ownerId);
|
||||
let owner = BDFDB.LibraryStores.UserStore.getUser(this.props.guild.ownerId);
|
||||
if (!owner && !this.state.fetchedOwner) {
|
||||
this.state.fetchedOwner = true;
|
||||
BDFDB.LibraryModules.UserProfileUtils.getUser(this.props.guild.ownerId).then(_ => BDFDB.ReactUtils.forceUpdate(this));
|
||||
|
@ -118,7 +118,7 @@ module.exports = (_ => {
|
|||
}),
|
||||
_this.settings.items.channels && BDFDB.ReactUtils.createElement(GuildDetailsRowComponent, {
|
||||
prefix: BDFDB.LanguageUtils.LanguageStrings.CHANNELS,
|
||||
string: BDFDB.LibraryModules.GuildChannelStore.getChannels(this.props.guild.id).count
|
||||
string: BDFDB.LibraryStores.GuildChannelStore.getChannels(this.props.guild.id).count
|
||||
}),
|
||||
_this.settings.items.roles && BDFDB.ReactUtils.createElement(GuildDetailsRowComponent, {
|
||||
prefix: BDFDB.LanguageUtils.LanguageStrings.ROLES,
|
||||
|
|
|
@ -85,7 +85,7 @@ module.exports = (_ => {
|
|||
render() {
|
||||
let closing = this.props.closing;
|
||||
delete this.props.closing;
|
||||
let folders = Array.from(BDFDB.LibraryModules.FolderUtils.getExpandedFolders()).map(folderId => BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderId)).filter(folder => folder && folder.guildIds);
|
||||
let folders = Array.from(BDFDB.LibraryStores.ExpandedGuildFolderStore.getExpandedFolders()).map(folderId => BDFDB.LibraryStores.SortedGuildStore.getGuildFolderById(folderId)).filter(folder => folder && folder.guildIds);
|
||||
this.props.folders = folders.length || closing ? folders : (this.props.folders || []);
|
||||
BDFDB.TimeUtils.clear(this._rerenderTimeout);
|
||||
if (!folders.length && this.props.folders.length && !closing) this._rerenderTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
|
@ -150,9 +150,9 @@ module.exports = (_ => {
|
|||
}
|
||||
else {
|
||||
if (_this.settings.general.closeAllFolders) {
|
||||
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != folder.folderId || !_this.settings.general.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
for (let openFolderId of BDFDB.LibraryStores.ExpandedGuildFolderStore.getExpandedFolders()) if (openFolderId != folder.folderId || !_this.settings.general.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
}
|
||||
else if (_this.settings.general.closeTheFolder && !_this.settings.general.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
|
||||
else if (_this.settings.general.closeTheFolder && !_this.settings.general.forceOpenFolder && BDFDB.LibraryStores.ExpandedGuildFolderStore.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
|
||||
else BDFDB.ReactUtils.forceUpdate(this);
|
||||
}
|
||||
},
|
||||
|
@ -495,13 +495,13 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
currentGuild = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
currentGuild = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
|
||||
let forceClosing = false;
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.GuildUtils, "toggleGuildFolderExpand", {after: e => {
|
||||
if (this.settings.general.closeOtherFolders && !forceClosing) {
|
||||
forceClosing = true;
|
||||
for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (openFolderId != e.methodArguments[0]) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
for (let openFolderId of BDFDB.LibraryStores.ExpandedGuildFolderStore.getExpandedFolders()) if (openFolderId != e.methodArguments[0]) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
forceClosing = false;
|
||||
}
|
||||
}});
|
||||
|
@ -517,8 +517,8 @@ module.exports = (_ => {
|
|||
|
||||
onSwitch () {
|
||||
if (typeof BDFDB === "object" && BDFDB.loaded && this.settings.general.forceOpenFolder) {
|
||||
let folder = BDFDB.GuildUtils.getFolder(BDFDB.LibraryModules.LastGuildStore.getGuildId());
|
||||
if (folder && !BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
|
||||
let folder = BDFDB.GuildUtils.getFolder(BDFDB.LibraryStores.SelectedGuildStore.getGuildId());
|
||||
if (folder && !BDFDB.LibraryStores.ExpandedGuildFolderStore.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,9 +576,9 @@ module.exports = (_ => {
|
|||
onGuildContextMenu (e) {
|
||||
if (document.querySelector(BDFDB.dotCN.modalwrapper)) return;
|
||||
if (e.instance.props.guild) {
|
||||
let folders = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId);
|
||||
let folders = BDFDB.LibraryStores.SortedGuildStore.guildFolders.filter(n => n.folderId);
|
||||
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
|
||||
let unfolderedGuilds = BDFDB.LibraryModules.FolderStore.getSortedGuilds().filter(n => !n.folderId).map(n => n.guilds[0]).filter(n => n);
|
||||
let unfolderedGuilds = BDFDB.LibraryStores.SortedGuildStore.getSortedGuilds().filter(n => !n.folderId).map(n => n.guilds[0]).filter(n => n);
|
||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||
|
@ -617,9 +617,9 @@ module.exports = (_ => {
|
|||
onGuildFolderContextMenu (e) {
|
||||
if (document.querySelector(BDFDB.dotCN.modalwrapper)) return;
|
||||
if (e.instance.props.target && e.instance.props.folderId) {
|
||||
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(e.instance.props.folderId);
|
||||
let folder = BDFDB.LibraryStores.SortedGuildStore.getGuildFolderById(e.instance.props.folderId);
|
||||
let data = this.getFolderConfig(e.instance.props.folderId);
|
||||
let muted = data.muteFolder && folder.guildIds.every(guildid => BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildid));
|
||||
let muted = data.muteFolder && folder.guildIds.every(guildid => BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildid));
|
||||
if (data.muteFolder != muted) {
|
||||
data.muteFolder = muted;
|
||||
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
|
||||
|
@ -642,7 +642,7 @@ module.exports = (_ => {
|
|||
action: state => {
|
||||
data.muteFolder = state;
|
||||
BDFDB.DataUtils.save(data, this, "folders", e.instance.props.folderId);
|
||||
for (let guildId of folder.guildIds) if (BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId) != state) BDFDB.LibraryModules.GuildNotificationsUtils.updateGuildNotificationSettings(guildId, {muted: state, suppress_everyone: state, suppress_roles: state});
|
||||
for (let guildId of folder.guildIds) if (BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId) != state) BDFDB.LibraryModules.GuildNotificationsUtils.updateGuildNotificationSettings(guildId, {muted: state, suppress_everyone: state, suppress_roles: state});
|
||||
}
|
||||
})
|
||||
}));
|
||||
|
@ -665,15 +665,15 @@ module.exports = (_ => {
|
|||
if (this.settings.general.extraColumn) {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.guilds]]});
|
||||
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(FolderGuildContentComponent, {
|
||||
isAppFullscreen: BDFDB.LibraryModules.VoiceChannelUtils.isFullscreenInContext(),
|
||||
themeOverride: BDFDB.LibraryModules.LocalSettingsStore.darkSidebar
|
||||
isAppFullscreen: BDFDB.LibraryStores.ChannelRTCStore.isFullscreenInContext(),
|
||||
themeOverride: BDFDB.LibraryStores.AccessibilityStore.darkSidebar
|
||||
}, true));
|
||||
}
|
||||
}
|
||||
|
||||
processGuilds (e) {
|
||||
if (this.settings.general.extraColumn) {
|
||||
let fullscreen = BDFDB.LibraryModules.VoiceChannelUtils.isFullscreenInContext();
|
||||
let fullscreen = BDFDB.LibraryStores.ChannelRTCStore.isFullscreenInContext();
|
||||
if (folderGuildContent && (fullscreen != folderGuildContent.props.isAppFullscreen || e.instance.props.themeOverride != folderGuildContent.props.themeOverride)) {
|
||||
folderGuildContent.props.isAppFullscreen = fullscreen;
|
||||
folderGuildContent.props.themeOverride = e.instance.props.themeOverride;
|
||||
|
@ -683,18 +683,18 @@ module.exports = (_ => {
|
|||
if (topBar) {
|
||||
let topIsVisible = topBar.props.isVisible;
|
||||
topBar.props.isVisible = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
|
||||
let ids = BDFDB.LibraryStores.SortedGuildStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
|
||||
args[2] = args[2].filter(id => !ids.includes(id));
|
||||
return topIsVisible(...args) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(args[0]) == 0;
|
||||
return topIsVisible(...args) || BDFDB.LibraryStores.GuildReadStateStore.getMentionCount(args[0]) == 0;
|
||||
}, "Error in isVisible of Top Bar in Guild List!");
|
||||
}
|
||||
let bottomBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbarbottom]]});
|
||||
if (bottomBar) {
|
||||
let bottomIsVisible = bottomBar.props.isVisible;
|
||||
bottomBar.props.isVisible = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
|
||||
let ids = BDFDB.LibraryStores.SortedGuildStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10);
|
||||
args[2] = args[2].filter(id => !ids.includes(id));
|
||||
return bottomIsVisible(...args) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(args[0]) == 0;
|
||||
return bottomIsVisible(...args) || BDFDB.LibraryStores.GuildReadStateStore.getMentionCount(args[0]) == 0;
|
||||
}, "Error in isVisible of Bottom Bar in Guild List!");
|
||||
}
|
||||
}
|
||||
|
@ -702,12 +702,12 @@ module.exports = (_ => {
|
|||
|
||||
processFolderItem (e) {
|
||||
if (!e.instance.props.folderNode) return;
|
||||
let expandedFolders = BDFDB.LibraryModules.FolderUtils.getExpandedFolders();
|
||||
let expandedFolders = BDFDB.LibraryStores.ExpandedGuildFolderStore.getExpandedFolders();
|
||||
if (expandedFolders.size) BDFDB.DOMUtils.addClass(document.body, BDFDB.disCN._serverfoldersfoldercontentisopen);
|
||||
else BDFDB.DOMUtils.removeClassFromDOM(BDFDB.disCN._serverfoldersfoldercontentisopen);
|
||||
|
||||
let data = this.getFolderConfig(e.instance.props.folderNode.id);
|
||||
if (data.muteFolder) for (let guildId of e.instance.props.folderNode.children.map(n => n.id)) if (!BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId)) BDFDB.LibraryModules.GuildNotificationsUtils.updateGuildNotificationSettings(guildId, {muted: true, suppress_everyone: true});
|
||||
if (data.muteFolder) for (let guildId of e.instance.props.folderNode.children.map(n => n.id)) if (!BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId)) BDFDB.LibraryModules.GuildNotificationsUtils.updateGuildNotificationSettings(guildId, {muted: true, suppress_everyone: true});
|
||||
|
||||
let state = this.getState(e.instance);
|
||||
if (folderStates[e.instance.props.folderNode.id] && !BDFDB.equals(state, folderStates[e.instance.props.folderNode.id])) {
|
||||
|
@ -771,11 +771,11 @@ module.exports = (_ => {
|
|||
processGuildItem (e) {
|
||||
BDFDB.TimeUtils.clear(forceCloseTimeout);
|
||||
forceCloseTimeout = BDFDB.TimeUtils.timeout(_ => {
|
||||
let newCurrentGuild = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
||||
let newCurrentGuild = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
|
||||
if (newCurrentGuild != currentGuild && newCurrentGuild) {
|
||||
let folder = BDFDB.GuildUtils.getFolder(newCurrentGuild);
|
||||
if (this.settings.general.closeAllFolders) for (let openFolderId of BDFDB.LibraryModules.FolderUtils.getExpandedFolders()) if (!folder || openFolderId != folder.folderId || !this.settings.general.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
else if (folder && this.settings.general.closeTheFolder && !this.settings.general.forceOpenFolder && BDFDB.LibraryModules.FolderUtils.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
|
||||
if (this.settings.general.closeAllFolders) for (let openFolderId of BDFDB.LibraryStores.ExpandedGuildFolderStore.getExpandedFolders()) if (!folder || openFolderId != folder.folderId || !this.settings.general.forceOpenFolder) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(openFolderId);
|
||||
else if (folder && this.settings.general.closeTheFolder && !this.settings.general.forceOpenFolder && BDFDB.LibraryStores.ExpandedGuildFolderStore.isFolderExpanded(folder.folderId)) BDFDB.LibraryModules.GuildUtils.toggleGuildFolderExpand(folder.folderId);
|
||||
}
|
||||
currentGuild = newCurrentGuild;
|
||||
}, 1000);
|
||||
|
@ -813,7 +813,7 @@ module.exports = (_ => {
|
|||
BDFDB.DOMUtils.removeClass(root, BDFDB.disCN.modalsmall);
|
||||
}
|
||||
if (e.returnvalue) {
|
||||
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(e.instance.props.folderId);
|
||||
let folder = BDFDB.LibraryStores.SortedGuildStore.getGuildFolderById(e.instance.props.folderId);
|
||||
let data = this.getFolderConfig(e.instance.props.folderId);
|
||||
let newData = Object.assign({}, data, {folderName: folder.folderName});
|
||||
|
||||
|
@ -990,7 +990,7 @@ module.exports = (_ => {
|
|||
generateId (prefix) {
|
||||
if (prefix == "folder") {
|
||||
let id = Math.floor(Math.random() * 4294967296);
|
||||
return BDFDB.LibraryModules.FolderStore.guildFolders.every(n => !n.folderId || n.folderId != id) ? id : this.generateId(prefix);
|
||||
return BDFDB.LibraryStores.SortedGuildStore.guildFolders.every(n => !n.folderId || n.folderId != id) ? id : this.generateId(prefix);
|
||||
}
|
||||
else {
|
||||
let data = BDFDB.DataUtils.load(this, prefix + "s");
|
||||
|
@ -1010,7 +1010,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getFolderConfig (folderId) {
|
||||
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderId) || {};
|
||||
let folder = BDFDB.LibraryStores.SortedGuildStore.getGuildFolderById(folderId) || {};
|
||||
let data = folderConfigs[folderId] || {
|
||||
iconID: "-1",
|
||||
muteFolder: false,
|
||||
|
@ -1099,7 +1099,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
updateFolder (folder) {
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryStores.SortedGuildStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
for (let oldFolder of oldGuildFolders) {
|
||||
if (oldFolder.folderId == folder.folderId) guildFolders.push(Object.assign({}, oldFolder, folder));
|
||||
else guildFolders.push(oldFolder);
|
||||
|
@ -1112,7 +1112,7 @@ module.exports = (_ => {
|
|||
if (!guildIds) return;
|
||||
guildIds = [guildIds].flat(10);
|
||||
if (!guildIds.length) return;
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [], added = false;
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryStores.SortedGuildStore.guildFolders), guildFolders = [], guildPositions = [], added = false;
|
||||
for (let oldFolder of oldGuildFolders) {
|
||||
if (!oldFolder.folderId && guildIds.includes(oldFolder.guildIds[0])) {
|
||||
if (!added) {
|
||||
|
@ -1130,7 +1130,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
removeFolder (folderId) {
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryStores.SortedGuildStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
for (let oldFolder of oldGuildFolders) {
|
||||
if (oldFolder.folderId == folderId) {
|
||||
for (let guildId of oldFolder.guildIds) guildFolders.push({guildIds: [guildId]});
|
||||
|
@ -1142,7 +1142,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
addGuildToFolder (folderId, guildId) {
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryStores.SortedGuildStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
for (let oldFolder of oldGuildFolders) {
|
||||
if (oldFolder.folderId) {
|
||||
let newFolder = Object.assign({}, oldFolder);
|
||||
|
@ -1157,7 +1157,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
removeGuildFromFolder (folderId, guildId) {
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryModules.FolderStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
let oldGuildFolders = [].concat(BDFDB.LibraryStores.SortedGuildStore.guildFolders), guildFolders = [], guildPositions = [];
|
||||
for (let oldFolder of oldGuildFolders) {
|
||||
if (oldFolder.folderId == folderId) {
|
||||
let newFolder = Object.assign({}, oldFolder);
|
||||
|
|
|
@ -80,7 +80,7 @@ module.exports = (_ => {
|
|||
if (e.methodArguments[0].type == "STREAMER_MODE_UPDATE") BDFDB.GuildUtils.rerenderAll(true);
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.FolderStore, "getGuildFolderById", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.SortedGuildStore, "getGuildFolderById", {after: e => {
|
||||
let hiddenGuildIds = hiddenEles.servers || [];
|
||||
if (e.returnValue && hiddenGuildIds.length) {
|
||||
let folder = Object.assign({}, e.returnValue);
|
||||
|
@ -201,7 +201,7 @@ module.exports = (_ => {
|
|||
let topIsVisible = topBar.props.isVisible;
|
||||
topBar.props.isVisible = BDFDB.TimeUtils.suppress((...args) => {
|
||||
args[2] = args[2].filter(id => !hiddenGuildIds.includes(id));
|
||||
return topIsVisible(...args) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(args[0]) == 0;
|
||||
return topIsVisible(...args) || BDFDB.LibraryStores.GuildReadStateStore.getMentionCount(args[0]) == 0;
|
||||
}, "Error in isVisible of Top Bar in Guild List!");
|
||||
}
|
||||
let bottomBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbarbottom]]});
|
||||
|
@ -209,7 +209,7 @@ module.exports = (_ => {
|
|||
let bottomIsVisible = bottomBar.props.isVisible;
|
||||
bottomBar.props.isVisible = BDFDB.TimeUtils.suppress((...args) => {
|
||||
args[2] = args[2].filter(id => !hiddenGuildIds.includes(id));
|
||||
return bottomIsVisible(...args) || BDFDB.LibraryModules.UnreadGuildUtils.getMentionCount(args[0]) == 0;
|
||||
return bottomIsVisible(...args) || BDFDB.LibraryStores.GuildReadStateStore.getMentionCount(args[0]) == 0;
|
||||
}, "Error in isVisible of Bottom Bar in Guild List!");
|
||||
}
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ module.exports = (_ => {
|
|||
|
||||
let hiddenGuildIds = hiddenEles && hiddenEles.servers || [];
|
||||
let hiddenFolderIds = hiddenEles && hiddenEles.folders || [];
|
||||
let guilds = BDFDB.LibraryModules.FolderStore.guildFolders.map(n => n.guildIds).flat(10).map(guildId => BDFDB.LibraryStores.GuildStore.getGuild(guildId)).filter(n => n);
|
||||
let folders = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId);
|
||||
let guilds = BDFDB.LibraryStores.SortedGuildStore.guildFolders.map(n => n.guildIds).flat(10).map(guildId => BDFDB.LibraryStores.GuildStore.getGuild(guildId)).filter(n => n);
|
||||
let folders = BDFDB.LibraryStores.SortedGuildStore.guildFolders.filter(n => n.folderId);
|
||||
let foldersAdded = [];
|
||||
|
||||
BDFDB.ModalUtils.open(this, {
|
||||
|
|
|
@ -206,7 +206,7 @@ module.exports = (_ => {
|
|||
};
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dispatch", {after: e => {
|
||||
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == "USER_PROFILE_FETCH_FAILURE" && e.methodArguments[0].userId) {
|
||||
const user = BDFDB.LibraryModules.UserStore.getUser(e.methodArguments[0].userId);
|
||||
const user = BDFDB.LibraryStores.UserStore.getUser(e.methodArguments[0].userId);
|
||||
processUser(e.methodArguments[0].userId, {user: user || {}, flags: user ? user.publicFlags : 0});
|
||||
}
|
||||
else if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == "USER_PROFILE_FETCH_SUCCESS" && e.methodArguments[0].user) processUser(e.methodArguments[0].user.id, e.methodArguments[0])
|
||||
|
@ -415,7 +415,7 @@ module.exports = (_ => {
|
|||
if (level == BDFDB.LibraryModules.GuildBoostUtils.getUserLevel(date)) fakeGuildBoostDate = date;
|
||||
}
|
||||
}
|
||||
let member = guildId && BDFDB.LibraryModules.MemberStore.getMember(guildId, user.id);
|
||||
let member = guildId && BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, user.id);
|
||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.UserBadges.default, {
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._showbadgesinchatbadges, BDFDB.disCN[`_showbadgesinchatbadges${place.toLowerCase()}`]),
|
||||
user: user,
|
||||
|
|
|
@ -85,7 +85,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
maxMessageLength = BDFDB.LibraryModules.NitroUtils.canUseIncreasedMessageLength(BDFDB.LibraryModules.UserStore.getCurrentUser()) ? BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH_PREMIUM : BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH;
|
||||
maxMessageLength = BDFDB.LibraryModules.NitroUtils.canUseIncreasedMessageLength(BDFDB.LibraryStores.UserStore.getCurrentUser()) ? BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH_PREMIUM : BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH;
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.ChatRestrictionUtils, "applyChatRestrictions", {before: e => {
|
||||
if (e.methodArguments[0] && e.methodArguments[0].content && !this.isSlowDowned(e.methodArguments[0].channel)) e.methodArguments[0].content = "_";
|
||||
|
|
|
@ -94,7 +94,7 @@ module.exports = (_ => {
|
|||
}, (error, response, result) => {
|
||||
if (response && response.statusCode == 401) {
|
||||
BDFDB.LibraryModules.SpotifyUtils.getAccessToken(socket.accountId).then(promiseResult => {
|
||||
let newSocketDevice = BDFDB.LibraryModules.SpotifyTrackUtils.getActiveSocketAndDevice();
|
||||
let newSocketDevice = BDFDB.LibraryStores.SpotifyStore.getActiveSocketAndDevice();
|
||||
this.request(newSocketDevice.socket, newSocketDevice.device, type, data).then(_ => {
|
||||
try {callback(JSON.parse(result));}
|
||||
catch (err) {callback({});}
|
||||
|
@ -115,7 +115,7 @@ module.exports = (_ => {
|
|||
});
|
||||
}
|
||||
render() {
|
||||
let socketDevice = BDFDB.LibraryModules.SpotifyTrackUtils.getActiveSocketAndDevice();
|
||||
let socketDevice = BDFDB.LibraryStores.SpotifyStore.getActiveSocketAndDevice();
|
||||
if (this.props.song) this.props.noDevice = false;
|
||||
if (!socketDevice || this.props.noDevice) return null;
|
||||
if (this.props.song) {
|
||||
|
@ -135,7 +135,7 @@ module.exports = (_ => {
|
|||
if (!lastSong) return null;
|
||||
|
||||
let coverSrc = BDFDB.LibraryModules.AssetUtils.getAssetImage(lastSong.application_id, lastSong.assets.large_image);
|
||||
let connection = (BDFDB.LibraryModules.ConnectionStore.getAccounts().find(n => n.type == "spotify") || {});
|
||||
let connection = (BDFDB.LibraryStores.ConnectedAccountsStore.getAccounts().find(n => n.type == "spotify") || {});
|
||||
showActivity = showActivity != undefined ? showActivity : (connection.show_activity || connection.showActivity);
|
||||
currentVolume = this.props.draggingVolume ? currentVolume : socketDevice.device.volume_percent;
|
||||
return BDFDB.ReactUtils.createElement("div", {
|
||||
|
@ -180,7 +180,7 @@ module.exports = (_ => {
|
|||
onClick: event => {
|
||||
BDFDB.ListenerUtils.stopEvent(event);
|
||||
showActivity = !showActivity;
|
||||
let account = BDFDB.LibraryModules.ConnectionStore.getAccounts().find(n => n.type == "spotify");
|
||||
let account = BDFDB.LibraryStores.ConnectedAccountsStore.getAccounts().find(n => n.type == "spotify");
|
||||
account && BDFDB.LibraryModules.ConnectionUtils.setShowActivity("spotify", account.id, showActivity);
|
||||
}
|
||||
})
|
||||
|
@ -381,7 +381,7 @@ module.exports = (_ => {
|
|||
updateInterval = BDFDB.TimeUtils.interval(_ => {
|
||||
if (!this.updater || typeof this.updater.isMounted != "function" || !this.updater.isMounted(this)) BDFDB.TimeUtils.clear(updateInterval);
|
||||
else if (playbackState.is_playing) {
|
||||
let song = BDFDB.LibraryModules.SpotifyTrackUtils.getActivity(false);
|
||||
let song = BDFDB.LibraryStores.SpotifyStore.getActivity(false);
|
||||
if (!song) BDFDB.ReactUtils.forceUpdate(controls);
|
||||
else if (playbackState.is_playing) BDFDB.ReactUtils.forceUpdate(this);
|
||||
}
|
||||
|
@ -676,14 +676,14 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SpotifyTrackUtils, "getActivity", {after: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.SpotifyStore, "getActivity", {after: e => {
|
||||
if (e.methodArguments[0] !== false) {
|
||||
if (e.returnValue && e.returnValue.name == "Spotify") this.updatePlayer(e.returnValue);
|
||||
else if (!e.returnValue) this.updatePlayer(null);
|
||||
}
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SpotifyTrackUtils, "wasAutoPaused", {instead: e => {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.SpotifyStore, "wasAutoPaused", {instead: e => {
|
||||
return false;
|
||||
}});
|
||||
|
||||
|
@ -705,7 +705,7 @@ module.exports = (_ => {
|
|||
children: _ => {
|
||||
let settingsItems = [];
|
||||
|
||||
if (!BDFDB.LibraryModules.SpotifyTrackUtils.hasConnectedAccount()) BDFDB.ModalUtils.open(this, {
|
||||
if (!BDFDB.LibraryStores.SpotifyStore.hasConnectedAccount()) BDFDB.ModalUtils.open(this, {
|
||||
size: "SMALL",
|
||||
header: `${this.name}: ${this.labels.noaccount_header}...`,
|
||||
subHeader: this.labels.noaccount_subheader,
|
||||
|
@ -788,7 +788,7 @@ module.exports = (_ => {
|
|||
if (e.instance.props.section == BDFDB.DiscordConstants.AnalyticsSections.ACCOUNT_PANEL) e.instance.props.children = [
|
||||
BDFDB.ReactUtils.createElement(SpotifyControlsComponent, {
|
||||
key: "SPOTIFY_CONTROLS",
|
||||
song: BDFDB.LibraryModules.SpotifyTrackUtils.getActivity(false),
|
||||
song: BDFDB.LibraryStores.SpotifyStore.getActivity(false),
|
||||
maximized: BDFDB.DataUtils.load(this, "playerState", "maximized"),
|
||||
buttonStates: [],
|
||||
timeline: this.settings.general.addTimeline,
|
||||
|
|
|
@ -356,7 +356,7 @@ module.exports = (_ => {
|
|||
let [_, index] = BDFDB.ReactUtils.findParent(children, {props: [["text", [BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER, BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER]]]});
|
||||
if (index > -1) children[index] = null;
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(config.channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let member = channel && this.settings.general.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, user.id) || {}) : {};
|
||||
let member = channel && this.settings.general.useRoleColor ? (BDFDB.LibraryStores.GuildMemberStore.getMember(channel.guild_id, user.id) || {}) : {};
|
||||
|
||||
let fallbackLabel = this.settings.general.useCrown && this.getLabelFallback(userType);
|
||||
let label = this.getLabel(userType, fallbackLabel);
|
||||
|
|
|
@ -197,12 +197,12 @@ module.exports = (_ => {
|
|||
|
||||
injectRoleTag (children, user, type, insertIndex, config = {}) {
|
||||
if (!BDFDB.ArrayUtils.is(children) || !user) return;
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(BDFDB.LibraryModules.LastGuildStore.getGuildId());
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(BDFDB.LibraryStores.SelectedGuildStore.getGuildId());
|
||||
if (!guild || user.bot && this.settings.general.disableForBots) return;
|
||||
let role = BDFDB.LibraryModules.PermissionRoleUtils.getHighestRole(guild, user.id);
|
||||
if (this.settings.general.showOwnerRole && user.id == guild.ownerId) role = Object.assign({}, role, {name: BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER, ownerRole: true});
|
||||
if (role && !role.colorString && !this.settings.general.includeColorless && !role.ownerRole) {
|
||||
let member = BDFDB.LibraryModules.MemberStore.getMember(guild.id, user.id);
|
||||
let member = BDFDB.LibraryStores.GuildMemberStore.getMember(guild.id, user.id);
|
||||
if (member) for (let sortedRole of BDFDB.ArrayUtils.keySort(member.roles.map(roleId => guild.getRole(roleId)), "position").reverse()) if (sortedRole.colorString) {
|
||||
role = sortedRole;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue