stuff
This commit is contained in:
parent
37212e912c
commit
5904684267
|
@ -1344,6 +1344,59 @@ module.exports = (_ => {
|
|||
return (!config.length || (config.smaller ? amount < config.length : amount == config.length)) && [props].flat(10).every(string => stringified.indexOf(`${string}:`) > -1) && m;
|
||||
}, {onlySearchUnloaded: true});
|
||||
};
|
||||
|
||||
DiscordConstants = {};
|
||||
Internal.DiscordConstants = new Proxy(DiscordConstants, {
|
||||
get: function (_, item) {
|
||||
if (InternalData.CustomDiscordConstants && InternalData.CustomDiscordConstants[item]) return InternalData.CustomDiscordConstants[item];
|
||||
if (DiscordConstants[item]) return DiscordConstants[item];
|
||||
if (!InternalData.DiscordConstants[item]) {
|
||||
BDFDB.LogUtils.warn([item, "Object not found in DiscordConstants"]);
|
||||
return {};
|
||||
}
|
||||
DiscordConstants[item] = BDFDB.ModuleUtils.findByProperties(InternalData.DiscordConstants[item]);
|
||||
return DiscordConstants[item] ? DiscordConstants[item] : {};
|
||||
}
|
||||
});
|
||||
BDFDB.DiscordConstants = Internal.DiscordConstants;
|
||||
|
||||
DiscordObjects = {};
|
||||
Internal.DiscordObjects = new Proxy(DiscordObjects, {
|
||||
get: function (_, item) {
|
||||
if (DiscordObjects[item]) return DiscordObjects[item];
|
||||
if (!InternalData.DiscordObjects[item]) return (function () {});
|
||||
let defaultExport = InternalData.DiscordObjects[item].exported == undefined ? true : InternalData.DiscordObjects[item].exported;
|
||||
if (InternalData.DiscordObjects[item].name) DiscordObjects[item] = BDFDB.ModuleUtils.findByName(InternalData.DiscordObjects[item].name, defaultExport);
|
||||
else if (InternalData.DiscordObjects[item].props) DiscordObjects[item] = BDFDB.ModuleUtils.findByPrototypes(InternalData.DiscordObjects[item].props, defaultExport);
|
||||
else if (InternalData.DiscordObjects[item].strings) DiscordObjects[item] = BDFDB.ModuleUtils.findByString(InternalData.DiscordObjects[item].strings, defaultExport);
|
||||
if (InternalData.DiscordObjects[item].value) DiscordObjects[item] = (DiscordObjects[item] || {})[InternalData.DiscordObjects[item].value];
|
||||
return DiscordObjects[item] ? DiscordObjects[item] : (function () {});
|
||||
}
|
||||
});
|
||||
BDFDB.DiscordObjects = Internal.DiscordObjects;
|
||||
|
||||
LibraryRequires = {};
|
||||
Internal.LibraryRequires = new Proxy(LibraryRequires, {
|
||||
get: function (_, item) {
|
||||
if (LibraryRequires[item]) return LibraryRequires[item];
|
||||
if (InternalData.LibraryRequires.indexOf(item) == -1) return (function () {});
|
||||
try {LibraryRequires[item] = require(item);}
|
||||
catch (err) {}
|
||||
return LibraryRequires[item] ? LibraryRequires[item] : (function () {});
|
||||
}
|
||||
});
|
||||
BDFDB.LibraryRequires = Internal.LibraryRequires;
|
||||
|
||||
LibraryStores = {};
|
||||
Internal.LibraryStores = new Proxy(LibraryStores, {
|
||||
get: function (_, item) {
|
||||
if (LibraryStores[item]) return LibraryStores[item];
|
||||
LibraryStores[item] = BDFDB.ModuleUtils.find(m => m && typeof m.getName == "function" && m.getName() == item && m);
|
||||
if (!LibraryStores[item]) BDFDB.LogUtils.warn(item, "could not be found in Webmodule Stores");
|
||||
return LibraryStores[item] ? LibraryStores[item] : null;
|
||||
}
|
||||
});
|
||||
BDFDB.LibraryStores = Internal.LibraryStores;
|
||||
|
||||
BDFDB.ObserverUtils = {};
|
||||
BDFDB.ObserverUtils.connect = function (plugin, eleOrSelec, observer, config = {childList: true}) {
|
||||
|
@ -2534,59 +2587,6 @@ module.exports = (_ => {
|
|||
}
|
||||
};
|
||||
|
||||
DiscordConstants = {};
|
||||
Internal.DiscordConstants = new Proxy(DiscordConstants, {
|
||||
get: function (_, item) {
|
||||
if (InternalData.CustomDiscordConstants && InternalData.CustomDiscordConstants[item]) return InternalData.CustomDiscordConstants[item];
|
||||
if (DiscordConstants[item]) return DiscordConstants[item];
|
||||
if (!InternalData.DiscordConstants[item]) {
|
||||
BDFDB.LogUtils.warn([item, "Object not found in DiscordConstants"]);
|
||||
return {};
|
||||
}
|
||||
DiscordConstants[item] = BDFDB.ModuleUtils.findByProperties(InternalData.DiscordConstants[item]);
|
||||
return DiscordConstants[item] ? DiscordConstants[item] : {};
|
||||
}
|
||||
});
|
||||
BDFDB.DiscordConstants = Internal.DiscordConstants;
|
||||
|
||||
DiscordObjects = {};
|
||||
Internal.DiscordObjects = new Proxy(DiscordObjects, {
|
||||
get: function (_, item) {
|
||||
if (DiscordObjects[item]) return DiscordObjects[item];
|
||||
if (!InternalData.DiscordObjects[item]) return (function () {});
|
||||
let defaultExport = InternalData.DiscordObjects[item].exported == undefined ? true : InternalData.DiscordObjects[item].exported;
|
||||
if (InternalData.DiscordObjects[item].name) DiscordObjects[item] = BDFDB.ModuleUtils.findByName(InternalData.DiscordObjects[item].name, defaultExport);
|
||||
else if (InternalData.DiscordObjects[item].props) DiscordObjects[item] = BDFDB.ModuleUtils.findByPrototypes(InternalData.DiscordObjects[item].props, defaultExport);
|
||||
else if (InternalData.DiscordObjects[item].strings) DiscordObjects[item] = BDFDB.ModuleUtils.findByString(InternalData.DiscordObjects[item].strings, defaultExport);
|
||||
if (InternalData.DiscordObjects[item].value) DiscordObjects[item] = (DiscordObjects[item] || {})[InternalData.DiscordObjects[item].value];
|
||||
return DiscordObjects[item] ? DiscordObjects[item] : (function () {});
|
||||
}
|
||||
});
|
||||
BDFDB.DiscordObjects = Internal.DiscordObjects;
|
||||
|
||||
LibraryRequires = {};
|
||||
Internal.LibraryRequires = new Proxy(LibraryRequires, {
|
||||
get: function (_, item) {
|
||||
if (LibraryRequires[item]) return LibraryRequires[item];
|
||||
if (InternalData.LibraryRequires.indexOf(item) == -1) return (function () {});
|
||||
try {LibraryRequires[item] = require(item);}
|
||||
catch (err) {}
|
||||
return LibraryRequires[item] ? LibraryRequires[item] : (function () {});
|
||||
}
|
||||
});
|
||||
BDFDB.LibraryRequires = Internal.LibraryRequires;
|
||||
|
||||
LibraryStores = {};
|
||||
Internal.LibraryStores = new Proxy(LibraryStores, {
|
||||
get: function (_, item) {
|
||||
if (LibraryStores[item]) return LibraryStores[item];
|
||||
LibraryStores[item] = BDFDB.ModuleUtils.find(m => m && typeof m.getName == "function" && m.getName() == item && m);
|
||||
if (!LibraryStores[item]) BDFDB.LogUtils.warn(item, "could not be found in Webmodule Stores");
|
||||
return LibraryStores[item] ? LibraryStores[item] : null;
|
||||
}
|
||||
});
|
||||
BDFDB.LibraryStores = Internal.LibraryStores;
|
||||
|
||||
LibraryModules = {};
|
||||
LibraryModules.LanguageStore = BDFDB.ModuleUtils.find(m => m.Messages && m.Messages.IMAGE && m);
|
||||
LibraryModules.React = BDFDB.ModuleUtils.findByProperties("createElement", "cloneElement");
|
||||
|
@ -3192,7 +3192,7 @@ module.exports = (_ => {
|
|||
};
|
||||
BDFDB.MessageUtils.openMenu = function (message, e = mousePosition, slim = false) {
|
||||
if (!message) return;
|
||||
let channel = Internal.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = Internal.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (!channel) return;
|
||||
e = BDFDB.ListenerUtils.copyEvent(e.nativeEvent || e, (e.nativeEvent || e).currentTarget);
|
||||
let menu = BDFDB.ModuleUtils.findByName(slim ? "MessageSearchResultContextMenu" : "MessageContextMenu", false, true);
|
||||
|
@ -3257,7 +3257,7 @@ module.exports = (_ => {
|
|||
BDFDB.UserUtils.can = function (permission, id = BDFDB.UserUtils.me.id, channelId = Internal.LibraryModules.LastChannelStore.getChannelId()) {
|
||||
if (!Internal.DiscordConstants.Permissions[permission]) BDFDB.LogUtils.warn([permission, "not found in Permissions"]);
|
||||
else {
|
||||
let channel = Internal.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let channel = Internal.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
if (channel) return Internal.LibraryModules.PermissionRoleUtils.can({permission: Internal.DiscordConstants.Permissions[permission], user: id, context: channel});
|
||||
}
|
||||
return false;
|
||||
|
@ -3280,12 +3280,12 @@ module.exports = (_ => {
|
|||
return guild instanceof Internal.DiscordObjects.Guild || Object.keys(new Internal.DiscordObjects.Guild({})).every(key => keys.indexOf(key) > -1);
|
||||
};
|
||||
BDFDB.GuildUtils.getIcon = function (id) {
|
||||
let guild = Internal.LibraryModules.GuildStore.getGuild(id);
|
||||
let guild = Internal.LibraryStores.GuildStore.getGuild(id);
|
||||
if (!guild || !guild.icon) return "";
|
||||
return Internal.LibraryModules.IconUtils.getGuildIconURL(guild).split("?")[0];
|
||||
};
|
||||
BDFDB.GuildUtils.getBanner = function (id) {
|
||||
let guild = Internal.LibraryModules.GuildStore.getGuild(id);
|
||||
let guild = Internal.LibraryStores.GuildStore.getGuild(id);
|
||||
if (!guild || !guild.banner) return "";
|
||||
return Internal.LibraryModules.IconUtils.getGuildBannerURL(guild).split("?")[0];
|
||||
};
|
||||
|
@ -3303,7 +3303,7 @@ module.exports = (_ => {
|
|||
});
|
||||
};
|
||||
BDFDB.GuildUtils.markAsRead = function (guildIds) {
|
||||
guildIds = [guildIds].flat(10).filter(id => id && typeof id == "string" && Internal.LibraryModules.GuildStore.getGuild(id));
|
||||
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);
|
||||
if (channels.length) BDFDB.ChannelUtils.markAsRead(channels);
|
||||
|
@ -3329,7 +3329,7 @@ module.exports = (_ => {
|
|||
let folder = Internal.LibraryModules.FolderStore.getGuildFolderById(folderId);
|
||||
if (!folder) return "";
|
||||
let rest = 2 * Internal.DiscordConstants.MAX_GUILD_FOLDER_NAME_LENGTH;
|
||||
let names = [], allNames = folder.guildIds.map(guildId => (Internal.LibraryModules.GuildStore.getGuild(guildId) || {}).name).filter(n => n);
|
||||
let names = [], allNames = folder.guildIds.map(guildId => (Internal.LibraryStores.GuildStore.getGuild(guildId) || {}).name).filter(n => n);
|
||||
for (let name of allNames) if (name.length < rest || names.length === 0) {
|
||||
names.push(name);
|
||||
rest -= name.length;
|
||||
|
@ -3344,15 +3344,15 @@ module.exports = (_ => {
|
|||
return channel instanceof Internal.DiscordObjects.Channel || Object.keys(new Internal.DiscordObjects.Channel({})).every(key => keys.indexOf(key) > -1);
|
||||
};
|
||||
BDFDB.ChannelUtils.isTextChannel = function (channelOrId) {
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryModules.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryStores.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||
return BDFDB.ObjectUtils.is(channel) && (channel.type == Internal.DiscordConstants.ChannelTypes.GUILD_TEXT || channel.type == Internal.DiscordConstants.ChannelTypes.GUILD_STORE || channel.type == Internal.DiscordConstants.ChannelTypes.GUILD_ANNOUNCEMENT);
|
||||
};
|
||||
BDFDB.ChannelUtils.isThread = function (channelOrId) {
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryModules.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryStores.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||
return channel && channel.isThread();
|
||||
};
|
||||
BDFDB.ChannelUtils.isForumPost = function (channelOrId) {
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryModules.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||
let channel = typeof channelOrId == "string" ? Internal.LibraryStores.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||
return channel && channel.parentChannelThreadType && channel.parentChannelThreadType == Internal.DiscordConstants.ChannelTypes.GUILD_FORUM;
|
||||
};
|
||||
BDFDB.ChannelUtils.isEvent = function (channelOrId) {
|
||||
|
@ -3360,7 +3360,7 @@ module.exports = (_ => {
|
|||
return channel && Internal.LibraryModules.GuildEventStore.getGuildScheduledEvent(channel.id) && true;
|
||||
};
|
||||
BDFDB.ChannelUtils.markAsRead = function (channelIds) {
|
||||
let unreadChannels = [channelIds].flat(10).filter(id => id && typeof id == "string" && (BDFDB.LibraryModules.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.LibraryModules.UnreadChannelUtils.hasUnread(id) || Internal.LibraryModules.UnreadChannelUtils.getMentionCount(id) > 0)).map(id => ({
|
||||
channelId: id,
|
||||
readStateType: Internal.LibraryModules.UnreadStateTypes.CHANNEL,
|
||||
messageId: Internal.LibraryModules.UnreadChannelUtils.lastMessageId(id)
|
||||
|
@ -3384,11 +3384,11 @@ module.exports = (_ => {
|
|||
|
||||
BDFDB.DMUtils = {};
|
||||
BDFDB.DMUtils.isDMChannel = function (id) {
|
||||
let channel = Internal.LibraryModules.ChannelStore.getChannel(id);
|
||||
let channel = Internal.LibraryStores.ChannelStore.getChannel(id);
|
||||
return BDFDB.ObjectUtils.is(channel) && (channel.isDM() || channel.isGroupDM());
|
||||
};
|
||||
BDFDB.DMUtils.getIcon = function (id) {
|
||||
let channel = Internal.LibraryModules.ChannelStore.getChannel(id);
|
||||
let channel = Internal.LibraryStores.ChannelStore.getChannel(id);
|
||||
if (!channel) return "";
|
||||
if (!channel.icon) return channel.isDM() ? BDFDB.UserUtils.getAvatar(channel.recipients[0]) : (channel.isGroupDM() ? window.location.origin + Internal.LibraryModules.IconUtils.getChannelIconURL(channel).split("?")[0] : null);
|
||||
return Internal.LibraryModules.IconUtils.getChannelIconURL(channel).split("?")[0];
|
||||
|
@ -6333,7 +6333,7 @@ module.exports = (_ => {
|
|||
this.props.guildId = this.props.guild.id;
|
||||
this.props.selectedChannelId = Internal.LibraryModules.LastChannelStore.getChannelId(this.props.guild.id);
|
||||
|
||||
let currentVoiceChannel = Internal.LibraryModules.ChannelStore.getChannel(Internal.LibraryModules.CurrentVoiceUtils.getChannelId());
|
||||
let currentVoiceChannel = Internal.LibraryStores.ChannelStore.getChannel(Internal.LibraryModules.CurrentVoiceUtils.getChannelId());
|
||||
let hasVideo = currentVoiceChannel && Internal.LibraryModules.VoiceUtils.hasVideo(currentVoiceChannel);
|
||||
|
||||
this.props.selected = this.props.state ? Internal.LibraryModules.LastGuildStore.getGuildId() == this.props.guild.id : false;
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
"LibraryModules": {
|
||||
"AckUtils": {"props": ["localAck", "bulkAck"]},
|
||||
"ActivityUtils": {"props": ["sendActivityInvite", "updateActivity"]},
|
||||
"ActiveThreadsStore": {"name": "ActiveThreadsStore"},
|
||||
"APIEncodeUtils": {"props": ["stringify", "parse", "encode"]},
|
||||
"APIUtils": {"props": ["getAPIBaseURL"]},
|
||||
"AnalyticsUtils": {"props": ["isThrottled", "track"]},
|
||||
|
@ -78,8 +77,6 @@
|
|||
"CategoryCollapseStore": {"props": ["getCollapsedCategories", "isCollapsed"]},
|
||||
"CategoryCollapseUtils": {"props": ["categoryCollapse", "categoryCollapseAll"]},
|
||||
"ChannelIconUtils": {"props": ["getChannelIconComponent", "getChannelIconTooltipText"]},
|
||||
"ChannelListStore": {"name": "ChannelListStore"},
|
||||
"ChannelStore": {"name": "ChannelStore"},
|
||||
"ChannelUtils": {"props": ["selectChannel", "selectPrivateChannel"]},
|
||||
"ChatRestrictionUtils": {"props": ["applyChatRestrictions"]},
|
||||
"ColorUtils": {"props": ["hex2int", "hex2rgb"]},
|
||||
|
|
|
@ -92,7 +92,7 @@ module.exports = (_ => {
|
|||
|
||||
processRichRoleMention (e) {
|
||||
if (e.instance.props.id && e.instance.props.guildId && e.instance.props.id != e.instance.props.guildId) {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.guildId);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(e.instance.props.guildId);
|
||||
let channelId = e.instance.props.channelId;
|
||||
if (!channelId) {
|
||||
let currentChannelId = BDFDB.LibraryModules.LastChannelStore.getChannelId();
|
||||
|
|
|
@ -382,7 +382,7 @@ module.exports = (_ => {
|
|||
|
||||
let quoteFormat = formats[choice] || formats.Standard || "";
|
||||
|
||||
let guild = channel.guild_id ? (BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {id: channel.guild_id, name: "Test Server"}) : {id: BDFDB.DiscordConstants.ME, name: BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES};
|
||||
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 content = message.content;
|
||||
|
|
|
@ -137,10 +137,10 @@ 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.LibraryModules.ChannelStore.getMutableGuildChannelsForGuild(id))).flat()) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
for (let id of BDFDB.LibraryModules.FolderStore.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.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
||||
let category = channel.parent_id && BDFDB.LibraryStores.ChannelStore.getChannel(channel.parent_id);
|
||||
if (((changedChannels[id] && changedChannels[id].name && changedChannels[id].name.toLocaleLowerCase().indexOf(e.methodArguments[0].query.toLocaleLowerCase()) > -1) || (category && changedChannels[category.id] && changedChannels[category.id].name && changedChannels[category.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.VOICE_CHANNEL || n.type == BDFDB.LibraryModules.QueryUtils.AutocompleterResultTypes.TEXT_CHANNEL))) e.returnValue.push({
|
||||
comparator: channel.name,
|
||||
record: channel,
|
||||
|
@ -346,12 +346,12 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processHeaderBarContainer (e) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
if (channel && this.settings.places.channelHeader) {
|
||||
let thread;
|
||||
if (BDFDB.ChannelUtils.isThread(channel)) {
|
||||
thread = channel;
|
||||
channel = BDFDB.LibraryModules.ChannelStore.getChannel(thread.parent_id);
|
||||
channel = BDFDB.LibraryStores.ChannelStore.getChannel(thread.parent_id);
|
||||
}
|
||||
if (changedChannels[channel.id] || thread && changedChannels[thread.id]) {
|
||||
if (!e.returnvalue) {
|
||||
|
@ -472,7 +472,7 @@ module.exports = (_ => {
|
|||
}
|
||||
let icon = iconClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", iconClass]]});
|
||||
if (icon) this.changeChannelIconColor(icon, channelId, modify);
|
||||
let categoryId = (BDFDB.LibraryModules.ChannelStore.getChannel(channelId) || {}).parent_id;
|
||||
let categoryId = (BDFDB.LibraryStores.ChannelStore.getChannel(channelId) || {}).parent_id;
|
||||
if (categoryId) {
|
||||
let categoryName = categoyClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", categoyClass]]});
|
||||
if (categoryName) {
|
||||
|
@ -656,10 +656,10 @@ module.exports = (_ => {
|
|||
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.LibraryModules.ThreadStore.getThreadsForGuild(guildId)).map(id => ({channel: BDFDB.LibraryModules.ChannelStore.getChannel(id)})));
|
||||
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)})));
|
||||
if (BDFDB.ArrayUtils.is(channels)) for (let channelObj of channels) {
|
||||
if (channelName == channelObj.channel.name) {
|
||||
let category = BDFDB.LibraryModules.ChannelStore.getChannel(channelObj.channel.parent_id);
|
||||
let category = BDFDB.LibraryStores.ChannelStore.getChannel(channelObj.channel.parent_id);
|
||||
if (!category || category && ele.props.text == category.name) {
|
||||
if (category) {
|
||||
let categoryData = changedChannels[category.id];
|
||||
|
@ -730,7 +730,7 @@ module.exports = (_ => {
|
|||
|
||||
changeAppTitle () {
|
||||
if (this.settings.places.appTitle) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let title = document.head.querySelector("title");
|
||||
if (title && channel && (document.location.href || "").indexOf(channel.id) > -1 && changedChannels[channel.id] && changedChannels[channel.id].name) {
|
||||
if (channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id));
|
||||
|
@ -788,14 +788,14 @@ module.exports = (_ => {
|
|||
|
||||
getChannelDataColor (channelId) {
|
||||
if (changedChannels[channelId] && changedChannels[channelId].color) return changedChannels[channelId].color;
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let category = channel && (BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryModules.ChannelStore.getChannel((BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.ChannelStore.getChannel(channel.id).parent_id) || {}).parent_id) : BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id));
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
let category = channel && (BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryStores.ChannelStore.getChannel((BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryStores.ChannelStore.getChannel(channel.id).parent_id) || {}).parent_id) : BDFDB.LibraryStores.ChannelStore.getChannel(channel.parent_id));
|
||||
if (category && changedChannels[category.id] && changedChannels[category.id].inheritColor && changedChannels[category.id].color) return changedChannels[category.id].color;
|
||||
return null;
|
||||
}
|
||||
|
||||
getChannelData (channelId, change = true, fallbackData) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
if (!channel && BDFDB.ObjectUtils.is(fallbackData) || channel && BDFDB.ObjectUtils.is(fallbackData) && channel.name != fallbackData.name) channel = fallbackData;
|
||||
if (!channel) return new BDFDB.DiscordObjects.Channel({});
|
||||
let data = change && changedChannels[channel.id];
|
||||
|
@ -815,7 +815,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getGroupIcon (channelId, change = true) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
if (!channel) return "";
|
||||
let data = change && changedChannels[channel.id];
|
||||
if (data) {
|
||||
|
|
|
@ -89,7 +89,7 @@ module.exports = (_ => {
|
|||
}});
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MemberStore, "getMember", {after: e => {
|
||||
if (e.returnValue) {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0]);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(e.methodArguments[0]);
|
||||
if (guild) {
|
||||
let colorRole, iconRole;
|
||||
for (let id of e.returnValue.roles) {
|
||||
|
|
|
@ -110,7 +110,7 @@ module.exports = (_ => {
|
|||
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.IconUtils, "getGuildBannerURL", {instead: e => {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(e.methodArguments[0].id);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(e.methodArguments[0].id);
|
||||
if (guild) {
|
||||
let data = changedGuilds[guild.id];
|
||||
if (data && data.banner && !data.removeBanner) return data.banner;
|
||||
|
@ -126,7 +126,7 @@ module.exports = (_ => {
|
|||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, "queryGuilds", {after: e => {
|
||||
if (!e.methodArguments[0].query) return;
|
||||
for (let id in changedGuilds) if (changedGuilds[id] && changedGuilds[id].name && changedGuilds[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.GUILD)) {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(id);
|
||||
if (guild) e.returnValue.push({
|
||||
comparator: guild.name,
|
||||
record: guild,
|
||||
|
@ -262,7 +262,7 @@ module.exports = (_ => {
|
|||
if (this.settings.places.guildList) {
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "NavItem"});
|
||||
if (index > -1 && children[index].props.to && children[index].props.to.pathname) {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild((children[index].props.to.pathname.split("/channels/")[1] || "").split("/")[0]);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild((children[index].props.to.pathname.split("/channels/")[1] || "").split("/")[0]);
|
||||
if (guild) {
|
||||
let data = changedGuilds[guild.id];
|
||||
if (data) {
|
||||
|
@ -362,7 +362,7 @@ module.exports = (_ => {
|
|||
processGuildHeader (e) {
|
||||
if (e.instance.props.guild && this.settings.places.guildHeader) {
|
||||
e.instance.props.guild = this.getGuildData(e.instance.props.guild.id);
|
||||
let oldName = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.guild.id) || {}).name;
|
||||
let oldName = (BDFDB.LibraryStores.GuildStore.getGuild(e.instance.props.guild.id) || {}).name;
|
||||
if (e.returnvalue && this.settings.general.addOriginalTooltip && oldName != e.instance.props.guild.name) {
|
||||
e.returnvalue.props.children[0] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||
text: oldName,
|
||||
|
@ -381,7 +381,7 @@ module.exports = (_ => {
|
|||
|
||||
processWelcomeArea (e) {
|
||||
if (e.instance.props.channel && this.settings.places.chat) {
|
||||
let name = (BDFDB.LibraryModules.GuildStore.getGuild(e.instance.props.channel.guild_id) || {}).name;
|
||||
let name = (BDFDB.LibraryStores.GuildStore.getGuild(e.instance.props.channel.guild_id) || {}).name;
|
||||
let guildName = name && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", "titleName-3-Lp3Z"]]});
|
||||
if (guildName && guildName.props && BDFDB.ArrayUtils.is(guildName.props.children)) {
|
||||
for (let child of guildName.props.children) if (child && child.props && BDFDB.ArrayUtils.is(child.props.children) && child.props.children[0] == name) {
|
||||
|
@ -393,7 +393,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getGuildData (guildId, change = true) {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(guildId);
|
||||
if (!guild) return new BDFDB.DiscordObjects.Guild({});
|
||||
let data = change && changedGuilds[guild.id];
|
||||
if (data) {
|
||||
|
@ -431,7 +431,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
openGuildSettingsModal (guildId) {
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildId);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(guildId);
|
||||
if (!guild) return;
|
||||
let data = changedGuilds[guild.id] || {};
|
||||
let newData = Object.assign({}, data);
|
||||
|
@ -704,7 +704,7 @@ module.exports = (_ => {
|
|||
|
||||
setBanner (id, data) {
|
||||
data = data || {};
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(id);
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(id);
|
||||
if (!guild) return;
|
||||
if (guild.EditServersCachedBanner === undefined) guild.EditServersCachedBanner = guild.banner;
|
||||
guild.banner = data.removeBanner ? null : (data.banner || guild.EditServersCachedBanner);
|
||||
|
|
|
@ -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.LibraryModules.ChannelStore.getChannel(e.methodArguments[0].channel_id) || {}).guild_id, e.methodArguments[0].author.id);
|
||||
let member = BDFDB.LibraryModules.MemberStore.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, {
|
||||
|
@ -284,7 +284,7 @@ module.exports = (_ => {
|
|||
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.LibraryModules.ChannelStore.getChannel(e.methodArguments[0].channelId) || {}).guild_id, id);
|
||||
let member = user && e.methodArguments[0].channelId && BDFDB.LibraryModules.MemberStore.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,
|
||||
|
@ -512,7 +512,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processHeaderBarContainer (e) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channelId);
|
||||
if (channel && channel.isDM() && this.settings.places.dmHeader) {
|
||||
let userName = BDFDB.ReactUtils.findChild(e.instance, {props: [["className", BDFDB.disCN.channelheadercursorpointer]]});
|
||||
if (userName) {
|
||||
|
@ -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.LibraryModules.ChannelStore.getChannel(header.props.message.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
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 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.LibraryModules.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.LibraryModules.MemberStore.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.LibraryModules.ChannelStore.getChannel(referenceMessage.channel_id) || {}).guild_id, header.props.message.author.id) || {}).colorString || data.color1;
|
||||
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 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.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, author.id) || {}).colorString || data.color1;
|
||||
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;
|
||||
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.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, author.id);
|
||||
let member = BDFDB.LibraryModules.MemberStore.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,
|
||||
|
@ -882,15 +882,15 @@ module.exports = (_ => {
|
|||
let renderChildren = messageUsername.props.children;
|
||||
messageUsername.props.children = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let renderedChildren = renderChildren(...args);
|
||||
this.changeUserColor(renderedChildren, author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
|
||||
this.changeUserColor(renderedChildren, author.id, {guildId: (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
|
||||
return renderedChildren;
|
||||
}, "Error in Children Render of MessageUsername!", this);
|
||||
}
|
||||
else this.changeUserColor(messageUsername, author.id, {guildId: (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
|
||||
else this.changeUserColor(messageUsername, author.id, {guildId: (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id});
|
||||
}
|
||||
}
|
||||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "Popout"});
|
||||
if (index > -1) this.injectBadge(children, author.id, (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.compact ? index : (index + 1), {
|
||||
if (index > -1) this.injectBadge(children, author.id, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, e.instance.props.compact ? index : (index + 1), {
|
||||
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
|
||||
useRem: true
|
||||
});
|
||||
|
@ -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.LibraryModules.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.LibraryModules.MemberStore.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.LibraryModules.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.LibraryModules.MemberStore.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),
|
||||
|
@ -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.LibraryModules.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.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;
|
||||
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});
|
||||
|
@ -1251,7 +1251,7 @@ module.exports = (_ => {
|
|||
if (e.instance.props.channel && this.settings.places.dmCalls) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.id);
|
||||
if (!user) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channel.id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channel.id);
|
||||
if (channel && channel.isDM()) user = BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]);
|
||||
}
|
||||
if (user) {
|
||||
|
@ -1346,7 +1346,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
changeAppTitle () {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
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]);
|
||||
|
@ -1356,7 +1356,7 @@ module.exports = (_ => {
|
|||
|
||||
shouldChangeInChat (channelId) {
|
||||
if (this.settings.types.servers && this.settings.types.dms) return true;
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let isDm = channel && (channel.isDM() || channel.isGroupDM());
|
||||
if (channel && (this.settings.types.servers && !isDm || this.settings.types.dms && isDm)) return true;
|
||||
return false;
|
||||
|
|
|
@ -122,7 +122,7 @@ module.exports = (_ => {
|
|||
|
||||
loadEmojiList () {
|
||||
emojiReplicaList = {};
|
||||
let guilds = BDFDB.LibraryModules.GuildStore.getGuilds();
|
||||
let guilds = BDFDB.LibraryStores.GuildStore.getGuilds();
|
||||
for (let id in guilds) for (let emoji of BDFDB.LibraryModules.GuildEmojiStore.getGuildEmoji(id)) {
|
||||
if (emoji.managed) emojiReplicaList[emoji.name] = emojiReplicaList[emoji.name] != undefined;
|
||||
}
|
||||
|
|
|
@ -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.LibraryModules.ChannelStore.getChannel(n.channelId) && BDFDB.UserUtils.can("VIEW_CHANNEL", BDFDB.UserUtils.me.id, n.channelId));
|
||||
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 status = {
|
||||
name: BDFDB.UserUtils.getStatus(id),
|
||||
activity: null,
|
||||
|
@ -864,7 +864,7 @@ module.exports = (_ => {
|
|||
BDFDB.LibraryModules.WindowUtils.focus();
|
||||
}
|
||||
else {
|
||||
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
|
||||
let DMid = BDFDB.LibraryStores.ChannelStore.getDMFromUserId(user.id)
|
||||
if (DMid) BDFDB.LibraryModules.ChannelUtils.selectPrivateChannel(DMid);
|
||||
else BDFDB.LibraryModules.DirectMessageUtils.openPrivateChannel(user.id);
|
||||
BDFDB.LibraryModules.WindowUtils.focus();
|
||||
|
|
|
@ -120,17 +120,17 @@ module.exports = (_ => {
|
|||
let childrenRender = tree.props.children;
|
||||
tree.props.children = BDFDB.TimeUtils.suppress((...args) => {
|
||||
let children = childrenRender(...args);
|
||||
this.patchList(e.instance.props.guild.id, BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.selectedChannelId), BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.selectedVoiceChannelId), children);
|
||||
this.patchList(e.instance.props.guild.id, BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.selectedChannelId), BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.selectedVoiceChannelId), children);
|
||||
return children;
|
||||
}, "", this);
|
||||
}
|
||||
else this.patchList(e.instance.props.guild.id, BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.selectedChannelId), BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.selectedVoiceChannelId), e.returnvalue);
|
||||
else this.patchList(e.instance.props.guild.id, BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.selectedChannelId), BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.selectedVoiceChannelId), e.returnvalue);
|
||||
}
|
||||
}
|
||||
|
||||
isCategoryMuted (guildId, channelId) {
|
||||
if (!guildId || !channelId) return false;
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
return channel && channel.parent_id && BDFDB.LibraryModules.MutedUtils.isChannelMuted(guildId, channel.parent_id);
|
||||
}
|
||||
|
||||
|
@ -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.LibraryModules.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.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;
|
||||
else return section;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1069,7 +1069,7 @@ module.exports = (_ => {
|
|||
let layerContainer = !event.shiftKey && BDFDB.DOMUtils.getParent(BDFDB.dotCN.itemlayercontainer, event.currentTarget)
|
||||
let backdrop = layerContainer && layerContainer.querySelector(BDFDB.dotCN.backdrop);
|
||||
if (backdrop) backdrop.click();
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(viewedImage.channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(viewedImage.channelId);
|
||||
if (channel) BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(channel.guild_id, channel.id, viewedImage.messageId));
|
||||
}
|
||||
})
|
||||
|
@ -1115,7 +1115,7 @@ module.exports = (_ => {
|
|||
if (this.settings.viewerSettings.galleryMode && viewedImage) {
|
||||
if (!cachedImages || cachedImages.channelId != viewedImage.channelId || cachedImages.amount && this.getImageIndex(cachedImages.all, viewedImage) == -1) {
|
||||
BDFDB.TimeUtils.clear(viewedImageTimeout);
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(viewedImage.channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(viewedImage.channelId);
|
||||
BDFDB.LibraryModules.APIUtils.get({
|
||||
url: channel && channel.guild_id ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(channel && channel.guild_id) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(channel.id),
|
||||
query: BDFDB.LibraryModules.APIEncodeUtils.stringify({
|
||||
|
@ -1568,7 +1568,7 @@ module.exports = (_ => {
|
|||
viewedImage = cachedImages.all[cachedImages.index];
|
||||
|
||||
if (offset > 0 && !cachedImages.lastReached && cachedImages.index == (cachedImages.amount - 1)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(viewedImage.channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(viewedImage.channelId);
|
||||
BDFDB.LibraryModules.APIUtils.get({
|
||||
url: channel && channel.guild_id ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(channel && channel.guild_id) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(channel.id),
|
||||
query: BDFDB.LibraryModules.APIEncodeUtils.stringify({
|
||||
|
@ -1598,7 +1598,7 @@ module.exports = (_ => {
|
|||
});
|
||||
}
|
||||
if (offset < 0 && !cachedImages.firstReached && cachedImages.index == 0) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(viewedImage.channelId);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(viewedImage.channelId);
|
||||
BDFDB.LibraryModules.APIUtils.get({
|
||||
url: channel && channel.guild_id ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(channel && channel.guild_id) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(channel.id),
|
||||
query: BDFDB.LibraryModules.APIEncodeUtils.stringify({
|
||||
|
|
|
@ -356,7 +356,7 @@ module.exports = (_ => {
|
|||
let deleteLink = messageDiv.parentElement.querySelector(BDFDB.dotCNS.messagelocalbotoperations + BDFDB.dotCN.anchor);
|
||||
if (deleteLink) deleteLink.click();
|
||||
else if (BDFDB.DiscordConstants.MessageTypeGroups.DELETABLE.has(message.type)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && (BDFDB.UserUtils.can("MANAGE_MESSAGES") || message.author.id == BDFDB.UserUtils.me.id)) {
|
||||
BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != BDFDB.DiscordConstants.MessageStates.SENT);
|
||||
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(this.labels.toast_message_deleted), {type: "success"});
|
||||
|
@ -381,7 +381,7 @@ module.exports = (_ => {
|
|||
|
||||
doPinUnPin ({messageDiv, message}, action, event) {
|
||||
if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("MANAGE_MESSAGES")) && BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(message.type)) {
|
||||
if (message.pinned) {
|
||||
BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
|
||||
|
@ -397,7 +397,7 @@ module.exports = (_ => {
|
|||
|
||||
doReply ({messageDiv, message}, action, event) {
|
||||
if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES")) && BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(message.type)) {
|
||||
BDFDB.LibraryModules.MessageManageUtils.replyToMessage(channel, message, {});
|
||||
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.NOTIFICATION_REPLY), {type: "success"});
|
||||
|
@ -413,7 +413,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
doCopyLink ({messageDiv, message}, action, event) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) {
|
||||
BDFDB.LibraryModules.MessageManageUtils.copyLink(channel, message);
|
||||
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED), {type: "success"});
|
||||
|
@ -422,21 +422,21 @@ module.exports = (_ => {
|
|||
|
||||
doQuote ({messageDiv, message}, action, event) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Quote_Message.plugin).quote(channel, message);
|
||||
}
|
||||
}
|
||||
|
||||
doNote ({messageDiv, message}, action, event) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Note_Message.plugin).addMessageToNotes(message, channel);
|
||||
}
|
||||
}
|
||||
|
||||
doTranslate ({messageDiv, message}, action, event) {
|
||||
if (BDFDB.BDUtils.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.BDUtils.getPlugin(this.defaults.bindings.__Translate_Message.plugin).translateMessage(message, channel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ module.exports = (_ => {
|
|||
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)) {
|
||||
const channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_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 focused = document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == channel.id;
|
||||
|
|
|
@ -93,7 +93,7 @@ module.exports = (_ => {
|
|||
message = new BDFDB.DiscordObjects.Message(message);
|
||||
let channel = notes[guild_id][channel_id][message_idPOS].channel && new BDFDB.DiscordObjects.Channel(JSON.parse(notes[guild_id][channel_id][message_idPOS].channel));
|
||||
if (!channel) {
|
||||
channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) {
|
||||
updateData = true;
|
||||
notes[guild_id][channel_id][message_idPOS].channel = JSON.stringify(channel);
|
||||
|
@ -111,7 +111,7 @@ module.exports = (_ => {
|
|||
}
|
||||
if (updateData) BDFDB.DataUtils.save(notes, _this, "notes");
|
||||
let allCount = messages.length;
|
||||
let currentChannel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId()) || {};
|
||||
let currentChannel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId()) || {};
|
||||
switch (popoutProps.selectedFilter.value) {
|
||||
case "channel":
|
||||
messages = messages.filter(m => m.channel_id == currentChannel.id);
|
||||
|
@ -135,7 +135,7 @@ module.exports = (_ => {
|
|||
renderMessage(note, message, channel) {
|
||||
if (!message || !channel) return null;
|
||||
let channelName = channel.name;
|
||||
let guild = channel.guild_id && BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
let guild = channel.guild_id && BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id);
|
||||
let role = guild && BDFDB.LibraryModules.PermissionRoleUtils.getHighestRole(guild, message.author.id);
|
||||
if (role) message.colorString = role.colorString;
|
||||
if (popoutProps.selectedFilter.value != "channel" && !channelName && channel.recipients.length > 0) {
|
||||
|
@ -152,13 +152,13 @@ module.exports = (_ => {
|
|||
tag: "span",
|
||||
className: BDFDB.disCN.messagespopoutchannelname,
|
||||
onClick: _ => {
|
||||
if (!channel.guild_id || BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id)) BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(channel.guild_id, channel.id));
|
||||
if (!channel.guild_id || BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id)) BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(channel.guild_id, channel.id));
|
||||
},
|
||||
children: channelName ? ((channel.guild_id ? "#" : "@") + channelName) : "???"
|
||||
}),
|
||||
popoutProps.selectedFilter.value == "all" ? BDFDB.ReactUtils.createElement("span", {
|
||||
className: BDFDB.disCN.messagespopoutguildname,
|
||||
children: channel.guild_id ? (BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id) || {}).name || BDFDB.LanguageUtils.LanguageStrings.GUILD_UNAVAILABLE_HEADER : BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES
|
||||
children: channel.guild_id ? (BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id) || {}).name || BDFDB.LanguageUtils.LanguageStrings.GUILD_UNAVAILABLE_HEADER : BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES
|
||||
}) : null
|
||||
]
|
||||
}),
|
||||
|
@ -175,7 +175,7 @@ module.exports = (_ => {
|
|||
BDFDB.ReactUtils.createElement("div", {
|
||||
className: BDFDB.disCN.messagespopoutactionbuttons,
|
||||
children: [
|
||||
(!channel.guild_id || BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id)) && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
|
||||
(!channel.guild_id || BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id)) && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
|
||||
className: BDFDB.disCN.messagespopoutjumpbutton,
|
||||
onClick: _ => BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(channel.guild_id, channel.id, message.id)),
|
||||
children: BDFDB.ReactUtils.createElement("div", {
|
||||
|
@ -601,7 +601,7 @@ module.exports = (_ => {
|
|||
|
||||
addMessageToNotes (message, channel) {
|
||||
if (!message) return;
|
||||
channel = channel || BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
channel = channel || BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
|
||||
notes[guild_id] = notes[guild_id] || {};
|
||||
notes[guild_id][channel.id] = notes[guild_id][channel.id] || {}
|
||||
|
@ -626,7 +626,7 @@ module.exports = (_ => {
|
|||
|
||||
getNoteData (message, channel) {
|
||||
if (!message) return;
|
||||
channel = channel || BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
channel = channel || BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
|
||||
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
|
||||
return notes[guild_id] && notes[guild_id][channel.id] && notes[guild_id][channel.id][message.id];
|
||||
}
|
||||
|
|
|
@ -738,7 +738,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
filterDMs (dms, removePredefined) {
|
||||
return dms.filter(id => BDFDB.LibraryModules.ChannelStore.getChannel(id) && !(removePredefined && this.getPredefinedCategory(id)));
|
||||
return dms.filter(id => BDFDB.LibraryStores.ChannelStore.getChannel(id) && !(removePredefined && this.getPredefinedCategory(id)));
|
||||
}
|
||||
|
||||
addToCategory (id, category, type) {
|
||||
|
@ -767,7 +767,7 @@ module.exports = (_ => {
|
|||
|
||||
getPredefinedCategory (id) {
|
||||
if (!id || this.getChannelListCategory(id)) return "";
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
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";
|
||||
|
@ -920,7 +920,7 @@ module.exports = (_ => {
|
|||
sortedDMs = sortedDMs.filter(n => n);
|
||||
for (let pos in sortedDMs) {
|
||||
newData[sortedDMs[pos]] = parseInt(pos);
|
||||
if (BDFDB.LibraryModules.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
|
||||
if (BDFDB.LibraryStores.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
|
||||
}
|
||||
if (!BDFDB.equals(data, newData)) this.savePinnedChannels(newData, this);
|
||||
return this.sortDMsByTime(existingDMs, type);
|
||||
|
|
|
@ -81,7 +81,7 @@ module.exports = (_ => {
|
|||
return this.getGuilds().filter(id => BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(id));
|
||||
}
|
||||
getPingedDMs() {
|
||||
return BDFDB.LibraryModules.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.LibraryModules.UnreadChannelUtils.getMentionCount(id) > 0);
|
||||
}
|
||||
render() {
|
||||
return BDFDB.ReactUtils.createElement("div", {
|
||||
|
|
|
@ -120,7 +120,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.ChannelStore, "getChannel", {after: e => {
|
||||
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))}))
|
||||
}});
|
||||
|
||||
|
@ -548,7 +548,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getGroupName (channelId) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(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));
|
||||
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
|
||||
|
|
|
@ -179,7 +179,7 @@ module.exports = (_ => {
|
|||
|
||||
processReaction (e) {
|
||||
if (e.instance.props.reactions) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id);
|
||||
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);
|
||||
if (users.length) {
|
||||
|
|
|
@ -134,7 +134,7 @@ module.exports = (_ => {
|
|||
folder.guildIds.map(guildId => {
|
||||
return [
|
||||
this.draggedGuild == guildId ? null : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Guild, {
|
||||
guild: BDFDB.LibraryModules.GuildStore.getGuild(guildId),
|
||||
guild: BDFDB.LibraryStores.GuildStore.getGuild(guildId),
|
||||
state: true,
|
||||
list: true,
|
||||
tooltipConfig: Object.assign({
|
||||
|
|
|
@ -220,7 +220,7 @@ 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.LibraryModules.GuildStore.getGuild(guildId)).filter(n => n);
|
||||
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 foldersAdded = [];
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ module.exports = (_ => {
|
|||
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "Popout"});
|
||||
if (index == -1) return;
|
||||
const author = e.instance.props.userOverride || e.instance.props.message.author;
|
||||
this.injectBadges(children, author, (BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat");
|
||||
this.injectBadges(children, author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat");
|
||||
}
|
||||
|
||||
processMemberListItem (e) {
|
||||
|
|
|
@ -355,7 +355,7 @@ module.exports = (_ => {
|
|||
if (!BDFDB.ArrayUtils.is(children) || !user) return;
|
||||
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.LibraryModules.ChannelStore.getChannel(config.channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
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 fallbackLabel = this.settings.general.useCrown && this.getLabelFallback(userType);
|
||||
|
@ -427,9 +427,9 @@ module.exports = (_ => {
|
|||
|
||||
getUserType (user, channelId) {
|
||||
if (!user || this.settings.general.ignoreBots && user.bot || this.settings.general.ignoreMyself && user.id == BDFDB.UserUtils.me.id) return userTypes.NONE;
|
||||
const channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
const channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
if (!channel) return userTypes.NONE;
|
||||
const guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
const guild = BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id);
|
||||
|
||||
if (this.settings.tagTypes.owners && guild && guild.ownerId == user.id) return userTypes.OWNER;
|
||||
else if (this.settings.tagTypes.groupOwners && channel.ownerId == user.id && channel.isGroupDM()) return userTypes.GROUP_OWNER;
|
||||
|
|
|
@ -197,7 +197,7 @@ module.exports = (_ => {
|
|||
|
||||
injectRoleTag (children, user, type, insertIndex, config = {}) {
|
||||
if (!BDFDB.ArrayUtils.is(children) || !user) return;
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(BDFDB.LibraryModules.LastGuildStore.getGuildId());
|
||||
let guild = BDFDB.LibraryStores.GuildStore.getGuild(BDFDB.LibraryModules.LastGuildStore.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});
|
||||
|
|
|
@ -817,7 +817,7 @@ module.exports = (_ => {
|
|||
getLanguageChoice (direction, place, channelId) {
|
||||
this.setLanguages();
|
||||
let choice;
|
||||
let channel = channelId && BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let channel = channelId && BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
let guildId = channel ? (channel.guild_id ? channel.guild_id : "@me") : null;
|
||||
if (channelLanguages[channelId] && channelLanguages[channelId][place]) choice = channelLanguages[channelId][place][direction];
|
||||
else if (guildId && guildLanguages[guildId] && guildLanguages[guildId][place]) choice = guildLanguages[guildId][place][direction];
|
||||
|
@ -828,7 +828,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
saveLanguageChoice (choice, direction, place, channelId) {
|
||||
let channel = channelId && BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
let channel = channelId && BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
|
||||
let guildId = channel ? (channel.guild_id ? channel.guild_id : "@me") : null;
|
||||
if (channelLanguages[channelId] && channelLanguages[channelId][place]) {
|
||||
channelLanguages[channelId][place][direction] = choice;
|
||||
|
|
Loading…
Reference in New Issue