// Module ID: 11672 // Function ID: 11673 // Name: LegacyCommands // Dependencies: [32, 5987, 5432, 1085, 2041, 9259, 1949, 7900, 4762, 7179, 5107, 2] // Exports: handleLegacyCommands // Module 11672 (LegacyCommands) import UserSettings from "UserSettings" /* 2041 */; import ReactionUtils from "ReactionUtils" /* 4762 */; import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 5107 */; import MessageActionCreatorsDefault from "MessageActionCreators" /* 7179 */; import ReactionActionCreators from "ReactionActionCreators" /* 7900 */; import ChangeNicknameActionCreatorsDefault from "ChangeNicknameActionCreators" /* 9259 */; import _slicedToArray from "_slicedToArray" /* 32 */; import EmojiStore from "EmojiStore" /* 5987 */; import MessageStore from "MessageStore" /* 5432 */; import Constants from "Constants" /* 1085 */; import module_1949_mod from "module_1949" /* 1949 */; import size from "module_2" /* 2 */; let metroImportAll; let metroImportDefault; let metroRequire; let module_1949; let obj2; let obj3; ({ AnalyticEvents: metroRequire, MARKDOWN_SPOILER_WRAPPER: metroImportDefault, ME: metroImportAll } = Constants); const re9 = /\\([*?+/])/g; const COMMANDS = { tts: { action() { let EnableTTSCommand; const obj = { tts: EnableTTSCommand.getSetting() }; EnableTTSCommand = UserSettings.EnableTTSCommand; return obj; } }, me: { action(arg0) { const obj = { content: "_" + arg0 + "_" }; return obj; } }, tableflip: { action(arg0) { let str; const obj = { content: str.trim() }; str = "" + arg0 + " (\u256F\u00B0\u25A1\u00B0)\u256F\uFE35 \u253B\u2501\u253B"; return obj; } }, unflip: { action(arg0) { let str; const obj = { content: str.trim() }; str = "" + arg0 + " \u252C\u2500\u252C\u30CE( \u00BA _ \u00BA\u30CE)"; return obj; } }, shrug: { action(arg0) { let str; const obj = { content: str.trim() }; str = "" + arg0 + " \u00AF\\_(\u30C4)_/\u00AF"; return obj; } }, nick: { action(arg0, channel) { channel = channel.channel; if (null != channel.guild_id) { const obj = ChangeNicknameActionCreatorsDefault; obj.changeNickname(channel.guild_id, channel.id, metroImportAll, arg0); return { content: "" }; } } }, reaction: obj2, searchReplace: obj3, spoiler: { action(arg0) { let str; const obj = { content: str.trim() }; str = metroImportDefault(arg0); return obj; } } }; obj2 = { match: module_1949.anyScopeRegex(/^\+:(.+?): *$/), action(str, channel) { channel = channel.channel; if (!channel.isEdit) { const obj = MessageStore; if (MessageStore.hasPresent(channel.id)) { const messages = obj.getMessages(channel.id); const lastResult = messages.last(); if (null != lastResult) { if (null != lastResult.id) { const disambiguatedEmojiContext = EmojiStore.getDisambiguatedEmojiContext(channel.guild_id); const getByName = disambiguatedEmojiContext.getByName; const trimmed = str.trim(); const byName = getByName(trimmed.slice(2, -1)); if (null != byName) { const addReaction = ReactionActionCreators.addReaction; const id = channel.id; const id2 = lastResult.id; ReactionActionCreators; const obj3 = ReactionUtils; addReaction(id, id2, obj3.toReactionEmoji(byName)); return { content: "" }; } } } } } } }; module_1949 = module_1949_mod; obj3 = { match: module_1949.anyScopeRegex(/^s\/([^\/\\]*(?:\\.[^\/\\]*)*)\/([^\/\\]*(?:\\.[^\/\\]*)*)(?:\/([g]*))?$/), action(str, channel) { let str2; let str3; channel = channel.channel; if (!channel.isEdit) { const lastEditableMessage = MessageStore.getLastEditableMessage(channel.id); if (null != lastEditableMessage) { if (null != lastEditableMessage.id) { let str7; const self = this; const _Array = Array; let match = str.match(this.match.regex); if (match == null) { match = []; } [r10014, str, str2, str3] = from(match); let parts; _slicedToArray(from(match), 4); if (str3 != null) { parts = str3.split(""); } if (parts == null) { parts = []; } const replaced = str.replace(re9, (arg0, arg1) => arg1); const replaced1 = str2.replace(re9, (arg0, arg1) => arg1); if (parts.includes("g")) { str7 = str6.replaceAll(replaced, replaced1); } else { str7 = str6.replace(replaced, replaced1); } if (null == str7) { if (0 === lastEditableMessage.attachments.length) { const obj = MessageActionCreatorsDefault; obj.deleteMessage(channel.id, lastEditableMessage.id); } return { content: "" }; } if (str7 !== lastEditableMessage.content) { const obj3 = { content: str7 }; const obj2 = MessageActionCreatorsDefault; obj2.editMessage(channel.id, lastEditableMessage.id, obj3); } } } return { content: "" }; } } }; module_1949 = module_1949_mod; Object.setPrototypeOf(COMMANDS, null); const result = size.fileFinishedImporting("modules/messages/LegacyCommands.tsx"); export { COMMANDS }; export const handleLegacyCommands = function handleLegacyCommands(text, arg1) { for (const key10005 in obj) { let obj; let str = obj[key10005]; if (null == str.match) { continue; } else { let regex = str.match.regex; let isMatch; if (regex != null) { isMatch = regex.test(text); } if (!isMatch) { continue; } else { obj = AppAnalyticsUtilsDefault; let obj2 = { command: key10005 }; let trackWithMetadataResult = obj.trackWithMetadata(metroRequire.SLASH_COMMAND_USED, obj2); return str.action(text, arg1); } } continue; } };