stuff
This commit is contained in:
parent
92dbd75e2e
commit
48ca031ccd
|
@ -1410,7 +1410,14 @@ module.exports = (_ => {
|
|||
return BDFDB.ArrayUtils.removeCopies([firstReturn].concat(secondReturn).flat(10));
|
||||
};
|
||||
|
||||
const DiscordConstantsObject = BDFDB.ModuleUtils.findByProperties("AnalyticsSections", "ChannelTypes", "MessageTypes");
|
||||
const DiscordConstantsObject = BDFDB.ModuleUtils.find(m => {try {
|
||||
if (!m || !Object.keys(m)) return;
|
||||
if ([["CUSTOM_STATUS", "STREAMING", "WATCHING"], ["GUILD_TEXT", "GUILD_FORUM", "GUILD_STORE"], ["THREAD_CREATED", "CHAT_INPUT_COMMAND"]].every(array => Object.keys(m).some(k => {
|
||||
if (!m[k]) return false;
|
||||
let keys = Object.keys(m[k]);
|
||||
if (keys && array.every(n => keys.indexOf(n) > -1)) return true;
|
||||
}))) return m;
|
||||
} catch (err) {}});
|
||||
if (InternalData.CustomDiscordConstants) DiscordConstants = Object.assign(DiscordConstants, InternalData.CustomDiscordConstants);
|
||||
if (DiscordConstantsObject) DiscordConstants = Object.assign(DiscordConstants, DiscordConstantsObject);
|
||||
Internal.DiscordConstants = new Proxy(DiscordConstants, {
|
||||
|
@ -1421,7 +1428,13 @@ module.exports = (_ => {
|
|||
return {};
|
||||
}
|
||||
if (InternalData.DiscordConstants[item].strings) DiscordConstants[item] = BDFDB.ModuleUtils.findByString(InternalData.DiscordConstants[item].strings);
|
||||
else DiscordConstants[item] = BDFDB.ModuleUtils.findByProperties(InternalData.DiscordConstants[item]);
|
||||
else {
|
||||
if (DiscordConstantsObject) DiscordConstants[item] = DiscordConstantsObject[Object.keys(DiscordConstantsObject).find(n => {
|
||||
let keys = Object.keys(DiscordConstantsObject[n]);
|
||||
if (keys && InternalData.DiscordConstants[item].every(k => keys.indexOf(n) > -1)) return true;
|
||||
})];
|
||||
if (!DiscordConstants[item]) DiscordConstants[item] = BDFDB.ModuleUtils.findByProperties(InternalData.DiscordConstants[item]);
|
||||
}
|
||||
if (InternalData.DiscordConstants[item].value) DiscordConstants[item] = DiscordConstants[item][InternalData.DiscordConstants[item].value] || DiscordConstants[item];
|
||||
return DiscordConstants[item] ? DiscordConstants[item] : {};
|
||||
}
|
||||
|
|
|
@ -68,13 +68,16 @@
|
|||
"UserPremiumLevels": {"1": 1, "2": 2, "3": 3, "4": 6, "5": 9, "6": 12, "7": 15, "8": 18, "9": 24}
|
||||
},
|
||||
"DiscordConstants": {
|
||||
"ActivityTypes": ["CUSTOM_STATUS", "STREAMING", "WATCHING"],
|
||||
"AnalyticsSections": ["FRIENDS_LIST", "PROFILE_POPOUT", "ACCOUNT_PANEL"],
|
||||
"AutocompleterResultTypes": ["VOICE_CHANNEL", "TEXT_CHANNEL", "USER", "LINK"],
|
||||
"ChannelTextAreaTypes": ["CREATE_FORUM_POST", "PROFILE_BIO_INPUT", "FORUM_CHANNEL_GUIDELINES"],
|
||||
"Colors": ["SPOTIFY", "RED_100", "BLUE"],
|
||||
"ColorsCSS": {"strings": ["var(--status-positive", "var(--bg-brand)"], "value": "Z"},
|
||||
"EmojiSprites": ["DiversityPerRow", "PickerCount", "PickerPerRow"],
|
||||
"InboxTabs": ["MENTIONS", "UNREADS"],
|
||||
"MessageTypes": ["THREAD_CREATED", "CHAT_INPUT_COMMAND"],
|
||||
"MessageTypeGroups": ["USER_MESSAGE", "UNDELETABLE"],
|
||||
"Permissions": ["MOVE_MEMBERS", "ADD_REACTIONS", "USE_EXTERNAL_APPS", "VIEW_CREATOR_MONETIZATION_ANALYTICS"],
|
||||
"ReadStateTypes": ["GUILD_EVENT", "NOTIFICATION_CENTER", "CHANNEL"],
|
||||
"UserSettingsActionTypes": ["SLOW_USER_ACTION", "DAILY"]
|
||||
},
|
||||
|
|
|
@ -271,7 +271,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelTextAreaEditor (e) {
|
||||
if (!this.settings.places.chatTextarea || e.instance.props.disabled || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id] || e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
if (!this.settings.places.chatTextarea || e.instance.props.disabled || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id] || e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
if (changedChannels[e.instance.props.channel.id].name) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${changedChannels[e.instance.props.channel.id].name}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelTextAreaContainer (e) {
|
||||
if (e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY && e.instance.props.type != BDFDB.LibraryComponents.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
if (e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.LibraryComponents.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
const splitMessageLength = this.settings.amounts.splitCounter < 1000 || this.settings.amounts.splitCounter > maxMessageLength ? maxMessageLength : this.settings.amounts.splitCounter;
|
||||
if (!e.returnvalue) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance.props, "onSubmit", {instead: e2 => {
|
||||
|
|
|
@ -679,7 +679,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelTextAreaContainer (e) {
|
||||
if (e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
if (e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
BDFDB.PatchUtils.patch(this, e.instance.props, "onSubmit", {instead: e2 => {
|
||||
if (this.isTranslationEnabled(e.instance.props.channel.id) && e2.methodArguments[0].value) {
|
||||
e2.stopOriginalMethodCall();
|
||||
|
@ -701,7 +701,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelTextAreaButtons (e) {
|
||||
if (!this.settings.general.addTranslateButton || e.instance.props.disabled || e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
if (!this.settings.general.addTranslateButton || e.instance.props.disabled || e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
|
||||
if (e.returnvalue) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(TranslateButtonComponent, {
|
||||
guildId: e.instance.props.channel.guild_id ? e.instance.props.channel.guild_id : "@me",
|
||||
channelId: e.instance.props.channel.id
|
||||
|
|
Loading…
Reference in New Issue